Testing a Rule Flow

You can test a rule flow before you publish it. If necessary, you can specify initialization or setup code that you want to run before the rule flow is run. SAS Business Rules Manager reports rule flow results and test data such as rule-fired data. SAS Business Rules Manager saves the test results from the last time a test was run.

Input Data for Rule Flow Tests

SAS Business Rules Manager expects the input data for the rule flow test to already exist and to be defined as a data table. See Managing Data Tables for information on defining data tables. Your user ID must have permission to access the data.

Create and Run a New Rule Flow Test

To test a rule flow:
  1. Open the rule flow that you want to test.
  2. Select the Tests page.
  3. Click Add to add a new test.. The Add a New Test window appears.
  4. Enter a name for the new test. Test names are limited to 30 characters.
  5. (Optional) Enter a description for the test.
  6. Select the data source that contains the input data for the test, and click Next.
  7. Map the terms in the rule flow to columns in the input data set. If you click Map terms, the application automatically maps as many terms as possible. You can also map terms by manually selecting an input column for each rule flow term.
  8. Click Next.
  9. (Optional) Enter any SAS code, such as initialization code or setup code, that you want to run before the rule flow is run. See Specify Preprocessing Code for more information.
  10. Click Run to run the test, or click Save to save it without running it.
If the test completes successfully, the status on the Tests tab changes to Completely Successfully. SAS Business Rules Manager displays the Results tab on which you can view the output of the rule flow, analyze the rule-fired data, and view the SAS code that was generated and run by SAS Business Rules Manager, in addition to other information. See View Rule Flow Test Results for more information.
Rule flow tests are associated with the rule flow version. After a test completes, the test version is displayed on the Tests page.

Run a Rule Flow Test

To run a rule flow test:
  1. Open the rule flow that you want to test.
  2. Select the Tests page.
  3. Select the test that you want to run and click submit.

Copy a Rule Flow Test

To copy a test:
  1. Open the rule flow.
  2. Select the Tests page.
  3. Select the test that you want to copy and click submit.

Edit a Rule Flow Test

To edit a rule flow test:
  1. Open the rule flow.
  2. Select the Tests page.
  3. Select the test that you want to edit and click Edit test.

Delete a Rule Flow Test

To delete a rule flow test:
  1. Open the rule flow.
  2. Select the Tests page.
  3. Select the test that you want to delete and click Delete.

Specify Preprocessing Code

To specify code that you want to run before the rule flow is executed, enter the code on the Preprocessing step in the Add a New Test window.
You can use the &BRMPrimaryTransactionDTTM macro variable to specify a value that is recorded in the TRANSACTION_DTTM field in the rule-fired data. Assigning a value to this field helps you determine the exact input record that caused a rule to execute. You can assign a term or a SAS expression to this macro variable. See Rule-Fired Table Fields for information about fields in the rule-fired data.
The &BRMPrimaryTransactionDTTM macro variable must resolve to a SAS Datetime value. If you assign a term to this macro variable, the term must be of the type Datetime. Expressions must resolve to a SAS Datetime value. For example, you can use the DATETIME function to assign the current date and time to this macro variable as follows:
%let brmPrimaryTransactionDTTM=datetime();

View Rule Flow Test Results

When you test a rule flow, SAS Business Rules Manager displays the output of the rule flow together with other information on the on the Results tab.
There are several sections to the results.
Input Table
the data table that was specified as input for the test.
Output Table
the output table produced by the rule flow and detailed information about the columns in the table. Click filter above the output table to filter the rows that are displayed.
Rules Fired Analysis
tables that enable you to determine which rules fired for specific output records. Select a record in the Output Records table, and SAS Business Rules Manager displays the rules that fired for that record in the bottom table.
Plot
a graph that shows the number of times that each rule set was executed.
Code
the SAS code that was generated and run by SAS Business Rules Manager when the test was submitted.
Log
the SAS log that was generated when the code was run.
Properties
the date the test was last run, and the location information for the output library, output table, and rule-fired table, in addition to other information.
Terms
the terms that are used in the rule flow and the input table columns that they are mapped to.
Preprocessing
the preprocessing code that was specified when the test was set up.