Code Digger analyzes possible execution paths through your .NET code. The result is a table where each row shows a unique behavior of your code. The table helps you understand the behavior of the code, and it may also uncover hidden bugs.
Through the new context menu item "Generate Inputs / Outputs Table" in the Visual Studio editor, you can invoke Code Digger to analyze your code. Code Digger computes and displays input-output pairs. Code Digger systematically hunts for bugs, exceptions, and assertion failures.
Out of the box, Code Digger only works on public .NET code that resides in Portable Class Libraries. Keep reading until the end of the page to learn how to configure Code Digger to explore other .NET projects.
Under the hood, Code Digger uses the Pex engine and Microsoft Research’sZ3 constraint solver to systematically analyze all branches in the code, trying to generate a test suite that achieves high code coverage.
Starting with the Code Digger 0.95.4 update, the extension is available for Visual Studio 2012 and 2013.
Stay tuned for future extensions that bring more aspects of the rich experience of the Pex Visual Studio 2010 Power Tools to the latest versions of Visual Studio. If you have feedback for us, or bug reports, feel free to write an email to thePex 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.
After you have installed the Code Digger extension, create a “Portable Class Library” project.
Write some public code, right-click on it, and select “Generate Inputs / Outputs Table”.
Wait a moment, and you will see a table, listing interesting parameter values which cover all the corner cases in your code.
If you are ready to run Code Digger on code that doesn't sit in Portable Class Libraries, then you can go to [Tools - Options...], select [Pex, General] and under [Code Digger] set [DisableCodeDiggerPortableClassLibraryRestriction] to True. Remember that even though you can launch Code Digger on almost any .NET code afterwards, Code Digger may still not be able to follow calls that leave the assembly under test. This option was introduced in the Code Digger 0.95.2 update.
Starting with the Code Digger 0.95.3 update, you can also enable the option [EnableCodeDiggerFakesSupport] that you can see in the dialog above. When both options are set to True, you may be able to run code digger on test code that uses Fakes, as shown in the following screenshot. We are looking for your feedback about this feature preview. Please send bug reports or any other feedback to thePex team at Microsoft Research.
Try the Pex engine of Code Digger online
If you are not yet convinced that you should install the Code Digger extension,try the Pex engine in your browser on Pex4Fun.com.