Pex - Automated Whitebox Testing for .NET : Exploration Packages

Exploration Packages

Packages may customize the components that comprise Pex.

An exploration packages is only active during particular explorations. Packages are installed by special attributes that decorate test generators. They are designed to execute some code when Pex' exploration components are loaded, and before and after each test case Pex generates.

For example, such a package may check the resulting coverage.

By interacting with Pex' exception validator component, an exploration package may implement an effect similar to the ExpectedExceptionAttribute in other test frameworks.



  • monitoring coverage,

// we'd like all explorations in the assembly to reach at least 70% coverage
[assembly: PexExpectedCoverage(70)] 

  • monitoring test creation,

[PexExpectedTests(NewCount = 0)] // notify my if any new test gets created
public class MyTest
{ ... }

  • Extensibility

You can implement your own exploration package by creating a custom attribute that inherits from PexExplorationPackageAttributeBase.

See Also

PexExpectedCoverageAttribute, PexExpectedTestsAttribute, PexClassAttribute, DySy
(c) Microsoft Corporation. All rights reserved. pex Wiki Documentation 0.93.50813.0