Validate first, test second. Eliminate one part of the equation. If testing fails, at least you'll know its not because of invalid code.
I've lost count of the number of times I've been on the phone with a programmer and they can't figure out why certain things are not displaying the way they should. A quick validation on that page and you can easily see where the problem was. Simple to fix too.
I think it all comes down to awareness and due diligence. ;)