Detection of melena often involves a physical examination and a detailed medical history. To confirm the presence of blood in the stool, doctors may use diagnostic tests such as a fecal occult blood test (FOBT). In some cases, more advanced diagnostic tools like endoscopy or colonoscopy are used to directly visualize the source of bleeding.