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!

Comment Feed 3 comments on this post

Peter Provost:

Remember, of course, that tests generated from the code you have only confirm that changes you make after that don't change the behavior that was there before. This is excellent for enabling refactoring of legacy code but doesn't necessarily confirm that the code does what you _want_ it to do.

Friday, Oct 24, 2008, 12:25 PM


You are right. We are not solving oracle problem. If your code contains no assertions/checks, Pex will *only* look for runtime violations (null dereference, index out of range, overflows, etc...)

Friday, Oct 24, 2008, 1:20 PM


it is nice

Saturday, Oct 23, 2010, 8:51 PM

comment on this post

HTML tags will be escaped.

Powered By ASP.NET

Hosted by SecureWebs