Chapter 7 Working with Decision Tables : Testing Decision Tables

Testing Decision Tables
When you have defined one or more decision tables, you can test them.
First configure for testing, then create test data, then deploy one or more decision tables, and lastly, test as shown in the task list below.
 
Task A Configure for Testing (as needed)
You can perform testing in a limited way (the default) or you can more closely mimic the production environment. For example you can enable channels and use the BusinessEvents project’s object management options.
See Configuring Project Tester Options for details.
Task B Create or Import Test Data
You can create data in the Test Data view, and you can export data for future use, and you can import data that was exported.
To Create Test Data
1.
Open the decision project. Select Project > Test. An empty Test Data panel displays.
2.
In Project Explorer, select an entity (concept or an event) for which you want to create test data. The editor panel displays test data (instances of that entity type) if any data is already defined.
3.
Click Add Data to and enter test data for that instance. Repeat this step until you have created all the test instances of this entity you want to use for testing.
Ensure that you enter valid data for each property’s type. For example, if a property is of type Integer, enter a number and not a string.
4.
Click Save.
Test data for a concept is saved to DMProject/TestData/Concepts/ConceptName.testdata.
Test data for an event is saved to DMProject/TestData/Events/EventName.testdata.
5.
Repeat steps step 1 to step 4 until you have created all the test data you need.
To Export and Import Test Data
You export test data for each entity to separate comma-delimited files. The file format and naming convention is the same as that used by the test data Save operation: The extension .concepttestdata or .eventtestdata is appended to the name you provide.
You can then import that file into another project that can use the same test data.
To export: With the desired entity’s test data displayed in the Test Data view, click Export, browse to the desired directory and provide a filename.
To import: With the desired entity displayed in the Test Data view, click Import, browse to the file and select it. If data exists for that entity, a confirmation window asks if you are sure you want to replace the data.
You can also use the file system to copy test data to another project’s test data directory. Ensure that entity names in the target project match those you provide in the test data files.
Task C Deploy and Test Decision Tables
This task is not required if you have checked the option "Automatically deploy all tables before starting project tests option. That option is in the Preferences > Testing panel. See Setting Application Preferences.
After creating or importing the test data, deploy the tables you want to test and then run the test. The selected decision tables are deployed to a BusinessEvents engine that runs inside Decision Manager for testing purposes.
1.
2.
In Project Explorer, right click on a decision table and select Deploy. Repeat to deploy all desired decision tables.
Select Project > Deploy Tables.
Decision Manager validates the selected decision tables, compiles them, starts the BusinessEvents engine inside Decision Manager, and deploys the tables to the engine:
3.
Click OK to continue.
If any table fail to deploy, the engine stops and a dialog box lists all errors. The Console view also lists the errors.
4.
The tester shows the values changed and the new instances created in Result Viewer, for example:
5.
The Console view shows log messages. For example, statements such as "System.debugOut ("Executed Rule")" are shown in this view. Click Refresh to ensure you have the most up-to-date results, in case the rules have timer events.
6.
Click Stop Test to reset the tester rule session.
7.
Click Shutdown Engine to stop all rule sessions and stop the engine.
8.
Click Project > Undeploy Tables to remove all the decision tables from the engine so you can deploy individual tables.
Committing the Project for Approval
When your decision tables are working as desired, you can commit them for approval, and eventual deployment to the BusinessEvents application.
See Committing Decision Tables for Approval for details.