This is exactly correct. A work-sample test needs to capture the normal parameters of the work. If team members aren't routinely called on to solve programming problems in a high-stakes stick-the-landing-or-you're-fired exercise on a whiteboard in front of an audience, then the prediction the test is trying to make is confounded by all those factors.
* Eliminate live audiences
* Let people work in the environment they'll be able to choose on the job
* Ideally, let people work in their own comfortable environs, even if they won't be able to do that on the job
* If you're worried about cheating, build that assessment into your in-person followup interview