Detection of cocaine by testing depends upon the dosage and the potency of the drug. It also depends on what kind of test is being conducted. A urine toxicology test is the most commonly employed method to detect cocaine in the system and is done at a hospital. Cocaine can be detected in the urine for up to three days and in the blood for 2 days. Hair follicle testing is done rarely but can detect cocaine for up to 90 days. Thinner people generally clear the drug faster compared to people with more body fat. More frequent usage of cocaine, higher potency and purity of the drug, sedentary lifestyle, and increased amount of drug usage may result in a positive test. If you are worried about passing a drug test for cocaine, you should consider getting help for the disorder.