There are no definitive tests for insomnia. If you think you have symptoms of insomnia, please consult your doctor for further diagnosis. Your doctor may start with seeing your medical history to check for the use of any drugs or medications that could have possibly lead to insomnia. Also, he may ask you about your life style and sleep patterns.
Doctors may suggest you to keep a sleep diary to keep track of your sleep habits. In that case, you can add the time you go to bed, total sleep time, number of times you wake up in the middle of your sleep, awakening time in the morning, etc in the diary. This helps the doctor to study your sleep habits.
It is also necessary that the doctor does a physical examination and a blood test to rule out any other illness which can cause insomnia.
In the diagnosis, the doctors will try to identify any psychological problems or symptoms such as anxiety, stress, and depression as well that can lead to insomnia.