To diagnose gastritis or peptic ulcers, a healthcare professional may perform a physical examination, review the patient's medical history, and order tests such as blood tests, stool tests, breath tests, or endoscopy. These tests can help identify the underlying cause and determine the best course of treatment.