BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Pex: Unit Testing Tool from Microsoft Research

| by Anand Narayanaswamy on Oct 27, 2012. Estimated reading time: 1 minute |

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

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and dont miss out on content that matters to you

BT