In the wake of numerous doping scandals in track and field and cross-country skiing, among other sports, the Olympics adopted WADA's World Anti-Doping Code in 2003. Its recommendations include having an independent third party (not the league itself) conduct the drug tests, a routine of rigorous and random in-season testing, and harsh punishments for athletes who are caught.
Under the code, athletes can be banned for two years for the first infraction and banned for life for the second. They also have to pick one hour a day, seven days a week, to be available for unannounced testing.
Scientists say frequency and timing are key to effective testing, and testing at the 2012 summer Olympics was more aggressive than ever. Half of all competitors were tested, as well as every medal winner.
During the Games, Olympians could be tested anytime, without any advance notice. The antidoping lab used during the London 2012 Olympics was the first ever underwritten by a major pharmaceutical company, Glaxo-SmithKline; it tested 400 samples per day.
WADA also advocates the use of a "biological passport" – a compilation of data that shows each athlete's natural level for certain biological markers and hormones. That way, scientists can monitor those levels for unusual activity. Biological passports played a key role in cycling's doping crackdown.