The test is performed to detect the presence of illegal (and some prescription) substances in your urine, which indicates recent use. The purposes of most drug testing (pre-employment, post-accident, school, random) is to detect the presence of drug use which can negatively impact your job performance or candidacy.