Endoscopy test can be used to look for the causes of problems in the esophagus, stomach, or duodenum. It might be done because of symptoms you are having (such as trouble swallowing, heartburn, feeling full quickly, or coughing up or vomiting blood). Or it might be done to look at an abnormal area seen on an imaging test (such as an x-ray or CT scan).