Magnesium deficiency is diagnosed via a blood test and sometimes a urine test. Your doctor may order the blood test if you have symptoms such as weakness, irritability, abnormal heart rhythm, nausea and/or diarrhoea, or if you have abnormal calcium or potassium levels.