I guess the pilots on this board can tell more about the frequency of random testing, but there are random tests and additional tests when there is suspicion... I recall that ATC routed a KLM plane to a remote parking at EHAM (and kept it there for a while) to do a last minute breathalyser test. The pilots came out clear, but with 45 minutes delay.
(There were reports of a whiff of alcohol in the forward galley, that's what triggered the test.)