Get started with Microsoft IntelliTest

Last Update: 11/22/2016

Visual Studio 2017 | Visual Studio 2015

Important attributes

using Microsoft.Pex.Framework;

[..., PexClass(typeof(Foo))]
public partial class FooTest {
    [PexMethod]
    public void Bar([PexAssumeNotNull]Foo target, int i) {
        target.Bar(i);
    }
}
[assembly: PexAssemblyUnderTest("MyAssembly")] // also instruments "MyAssembly"
[assembly: PexInstrumentAssembly("Lib")]

Important static helper classes

  • PexAssume evaluates assumptions (input filtering)
  • PexAssert evaluates assertions
  • PexChoose generates new choices (additional inputs)
  • PexObserve logs live values to the generated tests
[PexMethod]
void StaticHelpers(Foo target) {
    PexAssume.IsNotNull(target);

    int i = PexChoose.Value<int>("i");
    string result = target.Bar(i);

    PexObserve.ValueForViewing<string>("result", result);
    PexAssert.IsNotNull(result);
}

Got feedback?

Post your ideas and feature requests on UserVoice.

Tell us what you think with Send-a-Smile Send-a-Smile on the title bar.

Go back Back to the index