Oddly enough, I&#x27;ve spent some time working on &quot;white-box&quot; tests that check the log. It takes taste to do well: you have to be careful to log what your program figures out about the <i>domain</i>, rather than just random details. Done right, I find it actually <i>helps</i> refactoring. My unit tests now usually call some top-level function rather than just the sub-component they test. As a result I can make radical changes, like going to client-server or from sync to async, without having to change any tests.<p>More details: <a href="http:&#x2F;&#x2F;akkartik.name&#x2F;post&#x2F;tracing-tests" rel="nofollow">http:&#x2F;&#x2F;akkartik.name&#x2F;post&#x2F;tracing-tests</a>