H. pylori tests detect whether you have H. pylori infection — a major cause of stomach ulcers and peptic ulcer disease. Four tests can detect signs of the bacteria: breath (urea) tests, stool tests, blood tests and upper endoscopy tests. A positive test result means you’ll need antibiotics to kill the bacteria and clear the infection.