Unit testing a map value
You can test a map value individually, before testing it in the context of the application that you are developing. Additionally, you can convert the test run to a Pega unit test case.Testing a map value involves specifying a test page for the rule to use, providing sample values for required parameters, running the rule, and then examining the test results.
In the navigation pane of Dev Studio, click, and then click the map value that you want to test.
In the Test Page pane, select the context and test page to use for the test:
In the Data Context list, click the thread in which you want to run the rule. If a test page exists for the thread, then it is listed and is used for creating the test page.
To discard all previous test results and start from a blank test page, click Reset Page.
To apply a data transform to the values on the test page, click the data transform link, and then select the data transform you want to use.
Enter sample values to use for required parameters in the Results pane and then click Run Again.The value that you enter and the result that is returned are the values that are used for the default decision result assertion that is generated when you convert this test to a test case.
To view the pages that are generated by the unit test, click Show Clipboard.
To convert the test into a Pega unit test case, click Convert to Test. For more information, see Creating unit test cases for rules.
To view the row that produced the test result, click a Result Decision Paths link.
- About Map Values
Use a map value to create a table of number, text, or date ranges that converts one or two input values, such as latitude and longitude numbers, into a calculated result value, such as a city name. Map value rules greatly simplify decisions based on ranges of one or two inputs. Use a map value to record decisions based on one or two ranges of an input value. A map value uses a one- or two-dimensional table to derive a result.
- Unit testing individual rules
An incorrect rule configuration in an application can cause delays in case processing. To avoid configuration errors such as incorrectly routed assignments, unit test individual rules as you develop them. To expedite future rules testing, you can create reusable test cases from the unit test.
- Using the Clipboard tool
The Clipboard tool displays two panels.
- Opening a unit test case
You can view a list of the unit test cases that have been created for your application and select the one that you want to open.
- Application debugging using the Tracer tool
You can test and debug your applications by using the Tracer tool. You can test and debug activities, data transforms, decision rules, service rules, parse rules, and processes. You can select which rulesets, rules, and events to trace; set breakpoints and watch variables; trace reference properties; select which requestor session to trace; and add custom events to Tracer output. You can also troubleshoot offline-enabled applications in a browser by testing scripts that are running when the application is running.