A sweat test is a diagnostic procedure primarily used to diagnose cystic fibrosis (CF). It measures the concentration of chloride in the sweat, which is typically elevated in individuals with CF. The sweat glands are stimulated to produce sweat, which is then collected and analyzed.