October 24, 2008 tools

Tired of writing unit tests yourself? Try Pex!

From the Pex site:

Pex (Program EXploration) produces a traditional unit test suite with high code coverage. … To do so, Pex performs a systematic white box program analysis. Pex learns the program behavior by monitoring execution traces, and uses a constraint solver to produce new test cases with different behavior. At Microsoft, this technique has proven highly effective in testing even an extremely well-tested component.” [ed: emphasis mine]

So, Pex will produce a parameterized set of unit tests for your classes and does all of this integrated with Visual Studio and the unit testing built into VS. I’ve seen the demo and it blew me away. Nikolai Tillmann, a developer at MSR (Microsoft Research), has a nice write-up that discusses his work and when you’re done with that, go download Pex!