An upper endoscopy is a test that shows the inside of the upper gastrointestinal (GI) tract. This includes the esophagus, stomach, and the first part of the small intestine (duodenum). The healthcare provider can do a biopsy, check for problems, or remove objects. The test normally takes about 15 to 20 minutes.