An electrocardiogram (ECG or EKG) is a quick, noninvasive test that records the electrical signals in your heart .