Your doctor typically prescribes an overnight erection test to see whether you're able to get an erection. A device placed around your penis measures how many erections you have during the night and how strong they are.