Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PexClassAttribute Class

 

Attribute that marks a class that contains 'explorations'. It is the equivalent of MSTest's TestClassAttribute (or NUnit's TestFixtureAttribute). This attribute is optional.

Namespace:   Microsoft.Pex.Framework
Assembly:  Microsoft.Pex.Framework (in Microsoft.Pex.Framework.dll)


[AttributeUsageAttribute(AttributeTargets::Class, AllowMultiple = false, 
	Inherited = true)]
public ref class PexClassAttribute sealed : PexSettingsAttributeBase

NameDescription
System_CAPS_pubpropertyActiveSettings

Gets the list of settings name that have been set(Inherited from PexSettingsStoreAttributeBase.)

System_CAPS_pubpropertyCategories

A named parameter that specifies the fixture categories.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyContainsSettings

Gets a value indicating whether this instance has settings that have been set.(Inherited from PexSettingsStoreAttributeBase.)

System_CAPS_pubpropertyDisableObservableAssertions

A named parameter that specifies whether observed values should not be asserted(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyDisablePostAnalysis

A named parameter that specifies whether to disable the post analysis.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyIncludeNonFinalSegmentCoverage

A named parameter that specifies whether Pex should include non-final segment coverage in coverage reports and when deciding whether to emit tests.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyMaxBranches

A named parameter that specifies the maximum number of branches that can be taken along a single execution path.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyMaxCalls

A named parameter that specifies the maximum number of method calls during an exploration.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyMaxConditions

A named parameter that specifies the maximum number of conditions over the inputs that can be checked during a single execution path.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyMaxConstraintSolverMemory

A named parameter that specifies the constraint solver's memory limit.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyMaxConstraintSolverTime

A named parameter that specifies the constraint solver's time out value.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyMaxExceptions

A named parameter that specifies the maximum number of new exceptions before stopping.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyMaxExecutionTreeNodes

A named parameter that specifies the maximum number of execution tree nodes.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyMaxRuns

A named parameter that specifies maximum number of runs that will be tried during an exploration.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyMaxRunsWithoutNewTests

A named parameter that specifies the maximum number of .(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyMaxRunsWithUniquePaths

A named parameter that specifies the maximum number of runs that Pex will attempt which result in distinct execution paths.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyMaxSequenceLength

A named parameter that specifies maximum number of method calls that can be performed to construct an object of a given type.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyMaxStack

A named parameter that specifies the maximum stack size during an exploration(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyMaxWorkingSet

A named parameter that specifies the maximum working set.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyNoSoftSubstitutions

Experimental.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyNotReproducible

A named parameter that specifies whether generated tests are not reproducible(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyObserveChoices

A value that indicates whether choices should be observed in the parameter table.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyOwner

Owners for the generated tests if any and if supported by the test framework.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyPriority

The priority of the generated tests if supported by the test framework(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertySuite

System_CAPS_pubpropertyTestClassName

A named parameter that specifies the format string for the the test class name.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyTestEmissionBranchHits

A named parameter that specifies whether Pex can emit a new test case if the branch coverage increases, considering how often branches have been hit, capped by this option.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyTestEmissionFilter

A named parameter that specifies grounds on which Pex should generate test cases.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyTestExcludePathBoundsExceeded

A named parameter that specifies whether to ignore execution paths that exceed MaxCalls, MaxBranches or MaxConditions.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyThreadApartmentState

A named parameter that specifies in which apartment state the test thread should be.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyTimeout

A named parameter that specifies the exploration time out value.(Inherited from PexSettingsAttributeBase.)

System_CAPS_pubpropertyTypeId

(Inherited from Attribute.)

System_CAPS_pubpropertyTypeUnderTest

NameDescription
System_CAPS_pubmethodCreateFixtures(PexAssembly^, TypeEx^)

System_CAPS_pubmethodEquals(Object^)

(Inherited from Attribute.)

System_CAPS_pubmethodGetHashCode()

(Inherited from Attribute.)

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodIntegrateSettings(PexSettingsStoreAttributeBase^)

Integrates settings from attribute that have not been set in the current store yet(Inherited from PexSettingsStoreAttributeBase.)

System_CAPS_pubmethodIsDefaultAttribute()

(Inherited from Attribute.)

System_CAPS_pubmethodLock()

Locks all properties of this instance.(Inherited from PexSettingsStoreAttributeBase.)

System_CAPS_pubmethodMatch(Object^)

(Inherited from Attribute.)

System_CAPS_pubmethodOverrideSettings(PexSettingsStoreAttributeBase^)

Overrides the settings.(Inherited from PexSettingsStoreAttributeBase.)

System_CAPS_pubmethodToCustomAttribute()

Creates a custom attribute(Inherited from PexSettingsStoreAttributeBase.)

System_CAPS_pubmethodToString()

(Inherited from Object.)

System_CAPS_pubmethodTryGetValue(String^, Object^)

Tries to query the value.(Inherited from PexSettingsStoreAttributeBase.)

System_CAPS_pubmethodWriteXml(SafeSimpleXmlWriter^)

Writes the settings as XML attributes(Inherited from PexSettingsStoreAttributeBase.)

The classes marked with PexClass must be 'default constructible':

  • publicly exported type,

  • default constructor

  • not abstract

If the class does not meet those requirements, an error will be proceed in the report and the exploration will fail.

It is also strongly advised to make those classes ‘partial’ so that Pex can generate new tests that are part of the class, but in a separate file. This approach solves a lot of problems due to visibility and fits naturally into C#.

This attribute inherits from the PexSettingsAttributeBase and contains a lot of customization parameters.

  • additional suite and categories,

[TestClass] // VSTS test fixture attribute
[PexClass(Suite = "checkin")] // Pex fixture attribute
public partial class MyTests { ... }
  • specifying the type under test,

[PexClass(typeof(Foo))] // this is a test for Foo
public partial class FooTest { ... }

The class may contain methods annotated with the PexMethod. Pex also understands SetUp and TearDown methods.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: