A sterile, moist cotton swab is inserted into the vagina to obtain a sample of vaginal discharge. While you may feel pressure or discomfort, the test shouldn't hurt. The doctor will transfer the sample onto a slide. The slide is examined under a microscope to check for infection.