A doctor might order this test if there is suspicion of a gastrointestinal infection, monitoring for antibiotic-resistant bacteria, or as part of the testing for sexually transmitted infections. It helps in making an informed decision regarding the choice of antibiotics.