Your doctor will likely be able to diagnose a boil or carbuncle simply by looking at it. He or she might suggest sending a sample of the pus to a lab for testing. This may be useful if you have recurring infections or an infection that hasn't responded to standard treatment.
Many varieties of the bacteria that cause boils have become resistant to certain types of antibiotics. So lab testing can help determine what type of antibiotic would work best in your situation.