Diagnosis typically involves a urine sample to test for the presence of bacteria, white blood cells, or red blood cells. A urine culture may also be conducted to identify the specific type of bacteria causing the infection. In recurrent cases, imaging tests like an ultrasound or a CT scan may be performed to check for abnormalities in the urinary tract.