A rectal culture test is performed by inserting a cotton swab in the rectum. The swab is rotated gently and then withdrawn. A smear of the swab is placed in culture media to encourage the growth of microorganisms, which can help identify infections or other medical conditions.