Sometimes the barium swallow test is used with a pill that produces gas. This helps to take better images of the inside of the body.