The doctor will refer the patient for gastroscopy (where a telescope – via a flexible fibreoptic tube- is passed via the mouth into the stomach to directly view the lining and take samples, biopsies).
The alternative diagnostic test is a barium meal study, where the patient drinks some barium solution, the barium making the fluid radio-opaque such that its filling of the stomach allows the visualising radiologist to view the negative image of the stomach wall and discern whether it is irregular to the degree that he can diagnose a stomach cancer. The reason that most would now first go to endoscopy/gastroscopy is that the positive barium meal requires a subsequent endoscopy anyway for the required biopsy proof of the diagnosis.
The doctor will also wish to perform some abdominal scanning, usually CT, and chest x-ray (to check for spread outside the stomach, and blood tests.