Compartir a través de


Test Code Generation Switches

The following switches control the test code generation (TCG) process. They are not used during on-the-fly (OTF) testing.

Test Code Generation Switches

These switches control the generation of test cases in TCG.

Switch Possible Values (Default Value Bolded) Description

DynamicTestStrategy

RandomCoverageDynamicTraversal, string

Specifies the fully qualified name of the class that defines the dynamic test strategy, or RandomCoverageDynamicTraversal to use the default transition coverage traversal. The class that defines the dynamic test strategy must implement the IDynamicTraversal interface. Spec Explorer uses the default transition coverage traversal if the GenerateDynamicTest switch is false.

GenerateDynamicTest

false, true

Specifies whether Spec Explorer generates dynamic or static tests. true to have Spec Explorer generate an object model of the state machine and necessary methods and events, using the class provided by the DynamicTestStrategy switch for traversing the model; false to have Spec Explorer generate test code using the default transition coverage traversal.

GenerateEventHandlers

false, true

Specifies whether to generate event handler methods in generated test code.

GenerateStaticTestMethods

false, true

Specifies whether Spec Explorer generates static test methods used by different targeted test frameworks.

GeneratedTestClass

"", string

Name of the class to contain the generated tests. If the default (null string) is specified, the machine name will be used.

GeneratedTestFile

"", string

Name of the file containing generated test code. If the default (null string) is specified, a file name of <machineName>.cs will be generated. If a file of this name already exists, it will be overwritten when test code is generated.

GeneratedTestNamespace

GeneratedTests, string

Namespace for the generated test class, relative to the path of the project containing the script.

GeneratedTestPath

TestSuite, string

Path where generated test code is stored, relative to the location of the project that contains the script.

TestCaseName

none, string

Attribute controlling the generation of the test case name. The name of all test cases in the configuration will have the string value of this switch with an auto-incremented suffix appended.

TestEnabled

true, false

Specifies whether the associated machine is test-enabled.

TestFailedExceptionType

System.Exception, string

The exception base type that indicates a test failure. Exceptions of this type are caught and indicate a test failure. Other exceptions are thrown to the test harness.

This switch is active only when the TestMethodReturnType, TestPassedReturnValue, and TestFailedReturnValue switches contain valid, nondefault values.

TestFailedReturnValue

none, string

The value to be returned for the test method when a conformance error is detected (the test has failed).

TestMethodReturnType

none, string

The return type of the test method. If the default value (none) is specified, the test method will be generated with a void return type.

TestPassedReturnValue

none, string

The value to be returned for the test method when no conformance error is detected (the test has passed).

See Also

Reference

SwitchClause

Concepts

Cord Syntax Definition