An electrocardiogram (ECG) is a non-invasive test that measures the heart’s electrical activity. It is used to detect heart conditions and diagnose electrical heart conditions. It is also referred to as an EKG (which has German origins).