次の方法で共有


Introducing: Code Digger, an extension for VS2012

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.

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.

https://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.

Comments

  • Anonymous
    April 23, 2013
    This is great, but limiting it to portable class libraries makes it irrelevant for a large chunk of development, no doubt it's great for the core library code you want to share between platforms, but there's huge pieces of code in many applications (across many platforms) that this doesn't touch. I agree that unknown dependencies is an issue, but I'd prefer it to fail gracefully rather than to simply not let me try.

  • Anonymous
    April 24, 2013
    Only running on static methods is a bigger limitation than only on portable assemblies.

  • Anonymous
    April 24, 2013
    @Clint Pearson: Our goal is to make the full Pex functionality available for VS2012, supporting Fakes instead of Moles, but this combined functionality is not yet ready at this time. Portable Class Libraries are a neat way in .NET to ensure that there are no external dependencies, otherwise we'd have to implement our own checking layer. @Dan Neely: Code Digger is not limited to static methods (although you won't get detailed output on how to create relevant object instances).

  • Anonymous
    April 25, 2013
    The comment has been removed

  • Anonymous
    April 25, 2013
    @Random Joe: Which exact version of Visual Studio are you running? You need Visual Studio 2012 Professional or better, and it shouldn't be a pre-release version.

  • Anonymous
    June 25, 2013
    Can we use pex and moles in VS2012? or we have to use Code digger and fakes only?

  • Anonymous
    July 11, 2013
    @Rajinder: Use Fakes instead of Moles in VS2012. We just pushed out an update for Code Digger for VS2012 that allows you to explore code that uses Fakes.