Pex - Automated Whitebox Testing for .NET : Creating a Pex Project in Visual Studio

Creating a Pex Project in Visual Studio

This quick start shows how to create an empty Pex test in a new test project in Visual Studio.

  • Start Visual Studio.
  • Create a new test project that uses your favorite test framework (see Supported Test Frameworks).
  • Add a reference to Microsoft.Pex.Framework:

Create a new PexClass

  • Click on the 'New Item' menu item
  • Select 'New Pex Test (xxx)' where xxx is you test framework. Choose a name, and you will get a PexClass with a PexMethod:
public partial class MyPexClass
    public void Test(int i)
        // add parameterized test here

Tell Pex what to monitor

// monitor types in MyProduct.dll
[assembly: PexInstrumentAssembly(typeof(SomeTypeInMyProduct))]

And then: Generate Tests!

Click Here to Continue
(c) Microsoft Corporation. All rights reserved. pex Wiki Documentation 0.93.50813.0