In the classical Hartmann test, a screen with holes is placed before the element being tested. The spots corresponding to these holes are recorded on a CCD, before or after (as in the figure at right)the focus. The positions of these spots are mapped back onto the optical element, and the difference between the positions of these spots and the holes of the screen are used to compute the aberrations. This method is mostly obsolete now, as the Shack-Hartmann test has replaced it.
In the Shack-Hartmann test, a lenslet array is placed in the transferred pupil: light from the optical system being tested comes to a focus and is made parallel by the collimator, which also images the pupil on the array. The displacements (shown by red arrows) due to the aberrations from the optical system, with respect to the ideal wavefront (shown by black arrow) are used to compute the aberrations (in terms of Zernike polynomials) and the wavefront.
The Shack-Hartmann system is easier to calibrate and is of much higher precision compared to the Hartmann method. The use of a lenslet array leads to higher sensitivity.