There is no one test that can comprehensively diagnose erectile dysfunction and its root cause. But the most common test which is performed is an ultrasound. A device is held over the blood vessels to check the flow of blood to the penis.
Sometimes the doctor carrying out the scan will inject medication into the penis to stimulate blood flow, resulting in an erection.