Because ED can occur as a result of different physiological and psychological causes, most doctors first attempt to narrow down the range of possibilities by having you fill out a questionnaire that covers both your medical and sexual history, according to WebMD.

Among the many tests doctors use to diagnose ED are a complete blood count, or CBC, which can show if you’re suffering from anemia-related fatigue, which can cause ED, and a blood glucose test to determine if you have diabetes, a major cause of erectile problems. A blood test to determine blood lipid levels can indicate you’re suffering from atherosclerosis, another cause of ED. Because improper functioning of your liver and/or kidneys can contribute to ED, your doctor will probably run liver and kidney function tests.

Blood hormone studies can tell if your testosterone levels are low, while urinalysis can reveal the presence of kidney disease, diabetes, or a testosterone deficiency, all of which are possible causes of ED. The stamp test can show whether you’re having nocturnal erections. If you are, the ED cause is more likely to be psychological in nature. Other diagnostic testing may be ordered to determine how well the nerves and blood vessels serving the penis are functioning.