A barium swallow is a test that helps determine reasons for painful swallowing, abdominal pain, unexplained weight loss or bloodstained vomit. During the test, patients drink a beverage containing barium sulfate, which is a metallic compound that shows up on x-rays. As your doctor tracks the x-ray, the appearance of the compound can help highlight abnormalities in the esophagus and stomach, such as a narrowed esophagus, polyp or tumor.