The test measures the presence of nicotine and its metabolites in hair. Nicotine is a substance found in tobacco that is rapidly metabolized by the body into various metabolites, which are then incorporated into hair as it grows. The test can detect tobacco use over an extended period of time, usually up to several months.