An electrocardiogram (ECG) is a test that records the electrical activity of the heart. This procedure is very useful for determining whether a person has heart disease or heart rhythem disorders.