Tests aren't done on every athlete, just the ones (usually women) whose gender is "in doubt" (think East German weightlifter). Tests in the past have involved physical inspections, but are now genetic tests.
Yes, some athletes have failed the test and been stripped of medals, as described here.
While I'm talking Olympics, here's video of Vince Carter jumping right over Frederic Weiss's head and dunking:
*Buy Olympic posters at eBay.