The electrocardiogram (ECG) is a test that records electrical signals from your heart. The pattern of these signals can help tell the doctor if your heart is in a normal rhythm, having electrical problems, changes in the heartbeat pattern, strain, heart attack, or other damage.