Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Pex: Unit Testing Tool from Microsoft Research

Pex: Unit Testing Tool from Microsoft Research

This item in japanese

Pex is a Visual Studio add-in and testing tool developed by Microsoft Research. It investigates, explores the managed code and suggests the tests, which the project requires. It provides support for code contracts, which are used to annotate methods with conditions such as preconditions, postconditions and invariants that must be initially verified for the code to run properly.

Pex automatically adds proper precondition to your code after a detailed analysis to catch any invalid data. On the other hand, code contracts provide additional data and information to refine the analysis done by Pex. The test project created with Pex using Visual Studio target MSTest, which is the default testing framework as well as other frameworks such as NUnit.

In order to work parameterized testing, you need to pass appropriate values to the parameters, which Dino Esposito thinks is a big challenge. According to Dino, Pex comes to the rescue and assists developers to pick meaningful input values using iteration with the help of dynamic symbolic execution technique.

You can check out Pex on the web for free. It is a simplified version of Pex power tools for Visual Studio and includes code puzzles. You just need to provide code in C#, Visual Basic or F# and all the background work happens in the cloud.

Pex Framework works only with Visual Studio 2010. However, if you work with Visual Studio 2012 then you need to make use of Microsoft Fakes framework.

Rate this Article