A bacterial vaginosis test is a way to diagnose a bacterial vaginal infection, a common condition. A healthcare provider will take a sample of vaginal discharge. Then they’ll look at the sample under a microscope, identify a specific odor or measure the sample’s pH. If the test reveals bacterial vaginosis, you may need antibiotics.