An electrocardiogram records the electrical signals in your heart. It's a common test used to detect heart problems and monitor the heart's status in many situations. An ECG is a noninvasive, painless test with quick results. During an ECG, sensors (electrodes) that can detect the electrical activity of your heart are attached to your chest and sometimes your limbs. These sensors are usually left on for just a few minutes.