So your employer wants to find out personal information about you. Depending on where you work, you might be surprised at the amount of information your employer can get. But there are limits: both federal law and the laws of some states give various protections to workers' right to privacy.
If your employer invades your privacy, you can try to stop it through a lawsuit. Since privacy laws are different in every state, though, it's hard to know for sure whether your employer has illegally invaded your privacy without talking to a lawyer.
Many employers test their employees to see if they are "under the influence" while on the job. The employer usually requires the employee to provide a urine sample, which is sent to a laboratory that tests the sample and reports back to the employer on what drugs were found in the urine.
If your state has laws protecting your right to privacy, you might be able to refuse a drug test - under very limited circumstances. But employers often have the right to test you for drugs and alcohol, especially if your job is "safety sensitive" and you could hurt yourself or others while intoxicated.
If you are applying for a job, the potential employer generally has the right to ask you to take a drug test.
The laws of your state might prohibit surprise drug tests (random drug tests) if you work in a "non-safety" sensitive job, but allow such tests for "safety-sensitive" jobs. You have a "safety sensitive" job if you are responsible for your own or other people's safety, and it would be especially dangerous if you are using drugs on the job. For example, driving a school bus, operating a forklift, or working in a nuclear power plant are "safety-sensitive" jobs.
A surprise test (or random drug test) is one required without a reason. If your state forbids surprise tests, that means the employer must have a reason to test you - such as the fact that you appear intoxicated or have previously had drug or alcohol problems.
If you work in a government job (local, state, or federal), you generally have more protections against unwanted drug tests. That's because you are probably covered by a constitutional protection against "unreasonable searches and seizures". A drug test is considered a "search" of your urine or blood. But, such a search is deemed "reasonable" if your job includes carrying a gun, protecting public safety (e.g., a firefighter) or working in transportation (such as driving a city bus.)