Wednesday, 24 May 2017

How To Unit Test A Data Transform

The Run Rule feature allows you to test a data change independently, before testing it in the perspective of the application you are developing.
Preparation
1. Inspect the rule. Evaluate the Applies To key part, the Definition, Parameters, and Pages & Classes tabs of the rule to recognize the classes of the pages it uses and the pages and properties concerned in the data transform.
2. The Run Rule feature can generate or copy a page to use as the test page, as suitable for the rule you are testing. The page class of the test page is the Applies To class of the rule. If required, you can produce a data transform to set original values for the test page.
3.  If the rule needs input from numerous pages, decide how to imitate the processing that generate them so the clipboard has the initial context required for the data transform.
4.  For more inclusive testing, produce one or more additional data transforms that load a variety sets of input values into the clipboard.
Pega CSSA - unit testing data transform

Test approach
1.  Save the Data Transform form.
2.  Click the Run toolbar button (Run) or the alike keyboard shortcut CTRL + R to open the Run Rule window. The Run Rule window opens.
3.  In the Test Page section, state whether to pre-populate the main test page with values from a different data transform before call upon the to-be-tested rule:
  • ·         Choose Create or reset Test Page and make use of the Apply Data Transform field to pick a data transform to utilize to pre-populate the test page. If you do not make a selection, the system pertains the default data transform of the tested rule's Applies To class.
  • ·         Leave the default choice to skip pre-populating the main test page with values.

4. If the rule being tested is circumstance-qualified, choose Set circumstance properties to run exact version of rule. Otherwise, the base version or a different circumstance-qualified version might be invoked other than the rule form from which you opened the Run Rule window.
5. If Empty Test Page is chosen, click Reset to make sure the test page on the clipboard is appropriately reset. If Create or reset Test Page is selected, the displayed button has one of the following labels:
  • ·         Create Page (if this is the first test run and the test page does not already exist on the clipboard).
  • ·         Reset Page (if the test page was created in a former test run and exists on the clipboard).
  • ·         Hit the displayed button to ensure the test page is pre-populated according to the data transform specified in step 3.

6. In the bottom section of the Run Rule window, enter any test data required by the tested rule, and click Execute to run the test.
Repeat as desired, choosing different data transforms to pre-populate the test page, or providing other input values.

1 comment: