Transesophageal echocardiography is a test used to produce ultrasonic imaging of the heart to better diagnose disorders.