You have to do it before taking the test. It has to be done by private clinics designated by the DMV. They are usually located near the test site and will not take you more than 10 minutes. Don’t go at noon because these clinics have lunch breaks.