· The H. pylori bacterium can be detected in a sample of stool (faeces), or in a 'breath test', or from a blood test, or from a biopsy sample taken during a gastroscopy. See the separate leaflet called Helicobacter Pylori for more details. Gastroscopy (endoscopy) is the test that can confirm a stomach ulcer..