Testing a Business Rule

Typically, after creating any business rule, it is important to test that it performs as expected.

For an overview of the decision points involved in running a business rule, see the chart in the Running a Business Rule topic here.

Important: Business rules using context-specific JavaScript binds cannot be tested using this method. Therefore, JavaScript that uses the import change info or approve context binds cannot be tested. Similarly, business actions where the Execute JavaScript function is used to create parametrized business rules cannot be tested.

Monitor Business Rules

Using the BusinessRule.Warning.Threshold configuration property in the sharedconfig.properties file, allows you to specify a threshold in milliseconds for business action execution. If it takes longer to execute or test a given business action, a warning is posted in the main STEP log file available from the STEP System Administrator button on the Start Page. For information on the log, see the Logs topic in the Administration Portal documentation here.

Test & Time Business Rule Dialog

Choose one of the following ways to display the Test & Time Business Rule dialog:

Click the Test JavaScript button to test modifications made to the JavaScript. If the modifications should be retained, click Save. If the modifications should be rolled back, click Cancel.

Perform Test & Time on a Business Rule

The Test & Time Business Rule dialog includes standard parameters for actions, conditions, and functions. In addition to the standard parameters, testing action business rules includes the 'Rollback changes after test' parameter.

In addition to the standard parameters, testing function business rules includes a Parameters section that shows each of the input parameters defined in the business function.

After displaying the dialog, supply the following information to test a business rule.

  1. For actions or conditions, in the Test Object parameter, click the ellipsis button () to display the Select Test Object dialog. Use the Browse or Search tab to identify and select the object used to test the business rule.

Note: The selected object must be of an object type that is valid for the business rule.

  1. For functions only, in the Parameters section, click the ellipsis button () to display the appropriate selection dialog required for the Input Parameters available in the function. Use the Browse or Search tab to identify and select each input object for testing.
  2. For actions only, the Rollback changes after test checkbox is available. When checked, any changes caused by the action are rolled back after the action has been executed.
  3. The Execute in Approved Workspace is unchecked by default and the test is performed in the Main Workspace. When checked, the action is performed on the selected object in the Approved Workspace.
  4. Click the Test button.

Test & Time Business Rule Results

The following parameter values are supplied when the test is complete.

Testing Outcome Examples

Testing the following business condition includes the outcome of the condition and the localized message in the Result parameter. A Logger message is displayed in the Log parameter.

The following business rule has a problem in the JavaScript code as indicated by the row number in the error details parameter.