Wesley J. Landaker wrote: > What about some other extreme cases? Like, a class that plays a sound on a > speaker? How do you unit test that? Or, likewise, any class that > interfaces with the "world" "outside" your control? What if they are so > complex that you can't easily or acurately model them? What about output > that "needs" human interaction? I've asked similar questions when unit-testing screen-scraping applications. In this case, I'm sending a set of commands to an external system, but there's no way I can prove with a unit test that the commands I send have the effect that I want. I tried to tackle this by examining the output of my class using a mock object that would just check that the commands sent to it were the ones it expected. Then at least one test would have to be done by hand, ensuring that sending those commands to the external system had the desired effect. One limitation of this way of doing things is that the class could be changed in the future to operate in a way that is semantically equivalent from the point of view of the external system (e.g. sending commands in a different order), but this would still cause the test to break. Arguably, this is no bad thing - we're now getting false positives reported but this does indicate that we need to explicitly check the test by hand again to ensure that what we have done is correct. On the whole I think this is better than having no tests. Brett