Yes, the doctor should explore all possible causes with the patient. Tests can be done, and the doctor can also discuss stress. That is generally how it is done. Quite often in these cases there will be no final diagnosis.
That sounds a lot like a diagnosis of last resort. Especially if the best tool available for measuring stress is a yes/no question to the patient and a 5-question anxiety questionnaire. Hardly definitive evidence of stress/psychosomatic causes, especially if it comes back "negative".