Validation actions

A validation action is a mechanism for validating the data contained in a variable. Validation actions verify whether the actual value of a variable at execution time corresponds to the expected value of that variable. The expected value is defined in the test data table (TDT) or can be entered directly into the test behavior source file using an API call.

You can create and name validation actions in both the TDT and the source code but the validation values are always defined in the TDT. Selecting a variable for validation is similar to selecting a value for an initialization point. The only difference is that, with the validation action, you cannot define a new variable, and the values you define are expected output values rather than input values.

 

Implicit and explicit validation actions

Validation actions can be either implicit or explicit.

Implicit validation actions are created automatically when you enter an expected value for a return variable, output parameter, or expected exception to a cell in a test data table. Implicit validation actions check to see whether the system-under-test (SUT) has set the output parameters or return parameters to the values that were specified in the test data table. Data for expected exceptions is used to validate that the actual exception thrown by the SUT is an instance of the class name that you specified in the test data table.

Explicit validation actions can be used to verify any variable. You can add explicit validation actions by adding a row to the test data table or by editing the source code for the test.

 

Adding explicit validation actions to a test

You can add explicit validation actions to a test in one of two ways:

 

Related tasks

Inserting validation actions