Following a full medical history and physical examination, a semen analysis is performed to determine the quantity and quality of semen. Additional tests, such as diagnostic and genetic testing, may be required based on early findings. An ultrasound can be used to diagnose a varicocele or sperm tract abnormality.