Tests and a bit of guesswork (clinical judgement)
The serum insulin test mentioned above tests insulin resistance. (I 've only come across that one mentioned as being used in a couple of cases but fairly recently... perhaps its cost has come down ) Insulin resistance would indicate type 2
They could do a c peptide test. This determines how much insulin you are producing. A high amount would indicate type 2, a low amount either type 1 or someone who has had type 2 for some time and has lost insulin production
Type 1a, is a result of an autoimmune attack on the pancreas . They may do one or more antibody tests. There are tests for various antibodies [ICA, IA2, GAD65 and IAA ].Older people with type 1.5 or LADA often have GAD antibodies
( latent autoimmune diabetes of adults, a slower onset form of type 1)
see for more detail
http://www.labtestsonline.org/understanding/analytes/diabetes_auto/test.html
Unfortunately antibody tests are not always indicative as these antibodies are present in the non diabetic population and people with type 2. They are also absent in some cases of type 1.
There is also a classification type 1b (idiopathic...in other words, not proven to be autoimmune, but no-one knows what caused it!)
This is where clinical judgement may come in. Things like unexplained weight loss before diagnosis, glucose levels at diagnosis, presence of ketones or DKA at diagnosis, amount of insulin needed (ie this can indicate insulin sensitivity/resistance without a specific tes)
It's not necessarily clear cut.! (but then the official definitions aren't clear cut either)