Cavitation erosion is one of the main concerns in hydraulic rock drills and can reduce both performance as well as life span. Current simulation tools can detect a potential risk of cavitation, however, the equations do not include cavitation physics and therefore cannot estimate the severity nor erosion locations. In order to evaluate the cavitation damage, long term tests are performed which are both costly and time consuming. With better computational capacity and more accurate numerical flow models, the possibilities to simulate the course of cavitation have increased. So far, most numerical studies on cavitation focus on steady-state problems while studies on hydraulic transients and water hammer effects have received less attention. This paper is a step towards simulation of water hammer induced cavitation and cavitation erosion in pipe flow using Computational Fluid Dynamics (CFD). In order to validate the results, experimental measurements are performed with a test equipment that creates hydraulic transients in a pipe and records these using piezoelectric pressure sensors. The results from CFD are compared to both the experimental data and to numerical results from a software called Hopsan, a one-dimensional multi-domain system simulation tool that uses wave characteristics to calculate pressures and flows. For smaller transients where no cavitation occur, all results show good agreement. For larger transients with cavitation, the results from Hopsan do not longer agree with the measurements, while the CFD model still performs well and is able to predict both formation and collapse of cavitation.