The test involves taking a sputum sample from the individual, usually through a deep cough. The sample is then placed under a microscope, treated with a series of stains, and examined microscopically. The pathologist then identifies the type of bacteria based on the color of the bacteria (purple for gram-positive, pink for gram-negative).