The most accurate test for diabetes is a blood test. There are different types of blood tests, but they all involve measuring the levels of your blood sugar and have prompt results. Some tests will require you to fast beforehand.
In order to test gestational diabetes, you will probably have to take a glucose tolerance test. This involves being tested once, then having to drink a sugary drink and being tested again to see how your body has processed it.
Urine tests can be used to test the levels of sugar in your urine, but they cannot be used as the sole basis for a diabetes diagnosis. There are also home tests which can measure your blood glucose levels at the time of your test, but, again, cannot be used to definitively diagnose if you have diabetes.