Is there one specific way to test for stomach ulcers?

Endoscopy. Has largely replaced less clear contrast barium swallows. Also, tests for helicobacter pylorii can be done.