There are tests, such as the c-peptide test and some antibody tests, but to be truthful, they are rarely used. Most often, they use the situation as is and guess . Ie T1 tends to come on fast in young people and they generally have ketones as well as glucose in blood and urine. T2 tends to be more insidious and in older people, who usually don't have ketones. The next thing is the treatment. Insulin works for all kinds of diabetes. Diet control, Metformin, sulphonylureas and other oral treatment only work in T2. So if used and working, it must be T2 and if nothing but insulin works, it's T1
I suspect that most often they decide they were right if the treatment works. If it doesn't after a reasonable time, they might re-think. Since tests can be costly, they may well be the last resort.
Actually it's more important that the treatment work, than that you identify T1 or T2 or one of their subsets.