image Today, the Pex team at Microsoft Research (Nikolai Tillmann and Peli de Halleux) is happy to announce that Code Digger, an extension for Visual Studio 2012, has shipped to the Visual Studio Gallery. After shipping the Moles framework as Fakes in Visual Studio 2012, this is the next step of bringing our research projects to the latest and greatest development environment.

Download now from Visual Studio Gallery

UPDATE (June 10th): We just published a minor update to Code Digger where you can enable the exploration of code that doesn't reside in Portable Class Libraries. After updating Code Digger, set [Tools - Options..., Pex, General, Code Digger, DisableCodeDiggerPortableClassLibraryRestriction] to True. This only lifts the restriction, it does not (yet) bring the full Pex functionality to Visual Studio 2012.

Code Digger comes as a lightweight Visual Studio extension.

http://visualstudiogallery.msdn.microsoft.com/fb5badda-4ea3-4314-a723-a1975cbdabb4

image

What is Code Digger?

Code Digger generates interesting values that show different behaviors of your .NET code. The result is a table showing for which inputs your code produces which outputs.

What is the relation between Pex and Code Digger?

Under the hood, Code Digger uses the Pex engine and Microsoft Research’s Z3 constraint solver to systematically analyze all branches in the code, trying to generate a test suite that achieves high code coverage. Working together with Peter Provost from the Visual Studio product group, we tried to create a really simple user interface. We want to bring the idea of code exploration to every programmer’s fingertips. This is different from the Pex Power Tools where we gave you many options to configure, and you had to embrace the idea of (Parameterized) Unit Testing to get all benefits. Code Digger is not a full replacement of Pex, it is merely the first extension that the Pex team ships for Visual Studio 2012 – stay tuned for more.

Limitations

Out of the box, Code Digger only works on public .NET code that resides in Portable Class Libraries.

By restricting the code exploration to Portable Class Libraries, we avoid problems with code that has dependencies on a particular platform which the Pex engine does not understand.

Walkthrough

After you have installed the Code Digger extension for Visual Studio 2012, create a “Portable Class Library” project.

image

Write some public code, right-click on it, and select “Generate Inputs / Outputs Table”.

image

Wait a moment, and you will see a table, listing interesting parameter values which cover all the corner cases in your code.

image

If you are not yet convinced that you should install the Code Digger extension, try the Pex engine in your browser on Pex4Fun.com.

What’s next?

Code Digger is the first extension from the Pex team at Microsoft Research for Visual Studio 2012. Stay tuned for future extensions that bring more aspects of the rich experience of the Pex Visual Studio 2010 Power Tools to the latest version of Visual Studio. If you have feedback for us, or bug reports, feel free to write an email to the Pex team at Microsoft Research. If you have used Pex before, let us know if you are missing a particular feature.

To stay up-to-date, like Pex and Moles on Facebook.