Is there a test for anxiety?

No. No, there is no actual blood or urine test for anxiety. Most of the times, anxiety is diagnosed by the history or symptoms of discomfort that people experience, and objective signs like an elevated heart rate, blood pressure, sweating, tremors, etc. In the context of a normal medical workup otherwise.
Normally one. Takes a history, rules out medical causes of symptoms and then observes the patient. Psychological testing can be used but most often one can make the diagnosis without it. Take care.