A new versatile method to measure the focal length of conventional imaging lens, Fourier transform objective and linear scanning objective using laser as light source is reported, which uses a holographic grating and thin laser beam,and the measurement accuracy is analyzed and relative issues are discussed in the paper. The method has the advantages of versatility, high measurement accuracy, no complex auxiliary needed and easy adjustment. In addition, the spherical aberration of the lens undertest can also be obtained from the same set of testing data by some transformation and processing.