The whole business is ridiculous. My company does random drug and alcohol tests on us but always after final block in.
You would think it would be better to do these tests before flight but how would you replace a failed crew member without incuring a delay ?!