Analyze Public .NET Code with Code Digger
Code Digger, an extension for Visual Studio 2012 based on Pex, analyzes possible execution paths through your .NET code. It enables you to understand the behavior of the code by analyzing each row from the displayed table after running the tool from within Visual Studio editor.
The extension recently released by Research in Software Engineering (RiSE) team at Microsoft, not only computes and displays input-output pairs but also locates bugs, exceptions and assertion failures. Moreover, the extension only works on public .NET code that resides in portable class libraries.
Code digger make use of 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.
In order to work with code digger, you have to create a Portable Class Library project using Visual Studio 2012, write public code, right click on the code editor and select Generate Inputs / Outputs Table option. You will now view a table that lists parameter values which cover all the corner cases in your code.
Output Produced by Code Digger
"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. Our goal is to make the full Pex functionality available for Visual Studio 2012, supporting Fakes instead of Moles, but this combined functionality is not yet ready at this time," said Nikolai Tillmann, Principal Research Software Design Engineer, Microsoft.
The functionality included with code digger can also be explored on the web by visiting Pex4Fun.
Olav Maassen, Liz Keogh & Chris Matts Mar 08, 2014