Create data page unit tests

 

Data page unit tests are created by first running the data page rule, and then converting that run into a test.

Preparation

Open and examine the data page. Review the Definition, Parameters, and Pages & Classes tabs of the rule to identify the classes of the pages it uses and the pages and properties involved in the data page.

Run the rule

For basics of unit testing, see Unit testing a rule with the Run toolbar button.To unit test

  1. Open the data page to be tested.
  2. From the Actions menu, click the Run button to open the Run Rule window.
  3. The Run Rule Dialog window opens. Here you'll select a run context and parameter values.

The Run Rule Dialog

The Run Rule windows displays when you run a data page. In the Run Rule window you can edit the parameters of the data page, select a run context and view the results of the data page run.

In the Run Context section, select the Thread in which to run the rule. Select Flush all instances of this data page before execution to delete any existing instances of the selected data page. The XML of the run execution displays.

Clipboard: Opens the Clipboard.

Trace: Click the Trace button to debug the data page using the Tracer tool.

Run: Runs the rule again.

Run Context: Select the thread in which you want to run the data page.

In the Parameter section, enter the value (if any) you want to specify to be passed on to the data page.

Click the Run button to open the run the data page.

Results

The Results section lists the properties and the values on the data page. Clicking the name opens the property.

Create the test

Click the Convert to Test button. A new Create Unit Test Case tab displays in the main Designer Studio window. Once you've run the rule, close the Run Rule window and return to Designer Studio. On the new Create Unit Test Case tab, you can:

Edit the unit test case details

After running the data page and converting it to a test, you need to edit the unit test case details. Click the gear icon Magnifying glass to open the test case details.

Unit test case details configuration

Field

Description

Label A short description or title for the record.

Identifier

Enter a name for this rule. Begin the name with a letter and use only letters, a dash character, and digits.

Status Select whether the test case is final or available. Final rules cannot be edited once created. Available rules may be edited. You have the option to omit the prefix for available rules.

Context

This section has two parts. Provide branch information on the left side and ruleset information on the right.

Development Branch

Select a development branch from the options provided.

Choose app layer

Select the application layer in which to create the rule.

Apply to

Select the class that this rule applies to. Typically, this is a class derived from the Work- base class.

You cannot choose Work- as the Apply to class; that class has restrictions.

The list of available class names depends on the ruleset you select. Each class can restrict applying rules to an explicit set of rulesets as specified on the Advanced tab of the class form.

Add to ruleset

Specify the ruleset and version to add the rule to.

Project management

If you application is integrated with the Project Management Framework, enter the following information.

Field

Description

Project Item Select an available item that is available in the PMF product associated with this application, as defined in > Application > Tools > Document.
Description Enter a text description for this item.
Note

Enter a note that further explains the purpose for this entry.

Edit the send parameters

Some test cases require parameters that can be specified before the test case runs.

Define the expect output

Select the check box next to the expected properties and values to be compared against in the test case. These selections will be tested when the test case is run. Properties that are not selected will not be tested.

To edit a comparator or value, click on the row. Here you can select a comparator from the list. The following comparators are available.

String: Equals, Not Equals, Starts With, Contains, Ends With, Is Empty, Is Not Empty
Numeric (Decimal, Double, Integer): Equals, Not Equals, Is Null, Is Not Null, Is Less Than, Is Greater Than, Is Less Than Or Equal To, Is Greater Than Or Equal To
Boolean: Is True, Is False
Date: Equals

Next, enter the expected value. If necessary, enter a comment.

After the expected output is defined, click the Create and close or Create and open button. The test is now available on the Test cases tab of the Data Page.

View the results

Test results appear in the Test cases tab of the data page details. Click the name of the test results you want to view to open that test. Click the View summary button to view the detailed test results. The table displays the property, comparator expected value and the actual value.

 

Related Topics IconRelated Topics