Tag Archive for pex

Pex or automated white box testing .net

Microsoft Research - Pex automated testing .net

Yesterday, I randomly discovered a new tool for .Net to help developers with code testing. Microsoft Research has developed Pex, a test plugin which can be integrated to Visual Studio. So far nothing is really new, right ? But, say you’re as lazy as me when it’s about writing unit tests, you should definitely go look the official Pex homepage.
To be more specific, Pex automatically discovers interesting test paths. It finds interesting input-output values for each method and generate a test suite offering a pretty high code coverage. The keyword being “generate”, which means less time on testing and more on… (suit yourself).

At first sight, I must confess this may sounds a bit magical.  So how does it work?  Pex performs a systematic analysis, hunting for boundary conditions, exceptions and assertion failures, which you can debug right away. Bringing all this together, Pex offer a new approach to Parameterized Unit Testing and will hopefully reduce debug time and maintenance costs. This general test technique is also referred as  white box testing.

You will find extra information on this slideshow or on the Pex documentation section. Channel9 offers a “getting started” video as a tutorial on how to use Pex inside Visual Studio 2008. Microsoft Research has also a document about Parameterized Unit Tests.

Also let’s stay cautious: automated or generated tests are not THE solution to avoid code inspection and application stress. As a responsible developer, you should use tools to ease your life and make your products better. But never be too confident when it comes to magic black box software making your job ;)