Pex - Automated Whitebox Testing for .NET : Settings Waterfall

Settings Waterfall

Many aspects of Pex can be configured. Most settings are controlled by metadata in the form of custom attributes, and some options are available through the command line. Settings which control the exploration are set through the command line, while settings infrastructure information like path and file locations are set through the command line.

Metadata settings

PexSettingsAttributeBase is the base class for custom attributes that can be used to set settings in metadata.

Settings Waterfall

The concept of the settings waterfall means that the user can specify settings at the Assembly, Fixture and Exploration level. Settings specified at the assembly level, will impact all fixtures/exploration under that assembly, and so forth for fixtures. Child setting wins, i.e. If a setting is set at the Assembly and Fixture level, the fixture setting will win.

Note that some settings are specific to the Assembly level or Fixture level and some settings are also settable from the command line.


using Microsoft.Pex.Framework;
[assembly: PexAssemblySettings(MaxBranches = 1000)] // we override the default value of maxbranches
namespace MyTests
    [PexClass(MaxBranches = 500)] // we override the 1000 value and set maxbranches to 500 
    public partial class MyTests
        [PexMethod(MaxBranches = 100)] // we override again, maxbranches = 100
        public void MyTest(...) { ... }
// command line
pex.exe ... /maxbranches:50     // command line parameter overrides again, maxbramches = 50, final!

(c) Microsoft Corporation. All rights reserved. pex Wiki Documentation 0.93.50813.0