An electrocardiogram (ECG) is a test that records the electrical activity of the heart.