Electrocardiography (ECG) is a medical test that measures the electrical activity of the heart over a period of time. It is a non-invasive procedure that involves placing electrodes on the skin to capture the electrical signals that the heart produces as it beats.