Optical testing and metrology