Electromyography (EMG) is a diagnostic test that measures the electrical activity produced by muscles both at rest and during active movement. This test helps to evaluate muscle function and neuromuscular transmission, aiding in the diagnosis of various muscle and nervous system disorders.