Siebel Business Rules Administration Guide > Creating and Deploying Rules >

Using the HaleyAuthority Test Harness


You can use the test harness in HaleyAuthority to test your rules in a simulation environment before deploying the rule module. This simulation does not involve the runtime database or Siebel application environment.

CAUTION:  The test harness does not support testing rule statements that involve currency.

Testing your rules in HaleyAuthority includes the following tasks:

  • Create a test case.
  • Create example instances of the entities that the rule module processes.
  • Run the test case.
  • Examine the test results.
  • Modify the data and rerun the test case. (optional)

For this topic, assume your knowledge base has the following rules module and the concepts and relations that are implied:

if a service request does not have a priority then set "Priority" of the service request to "3-Medium"

if the priority of a service request is "1-ASAP" then set "Recommendation" of the service request to "Escalate"

To create a test case

  1. In HaleyAuthority, choose View > Tabs > Tests & Cases.

    The Tests & Cases window displays.

  2. Right click the Test Cases folder and choose Add a test case.
  3. In the Edit Test Case dialog box, enter a name for the test case in the Description field; for example, SR Priority. Click OK.

Create instances of concepts that serve as simulated data on which rules act. You must create instances for each concept that the rules reference.

To create example instances of concepts

  1. Choose View > Tabs > Concepts.

    The Concepts window displays.

  2. Locate and right click a concept for which to create an instance, then choose Add > an instance or example. For this example, select the service request entity.
  3. In the instance dialog box, make the following entries, then click OK:
    • A label for the instance; for example, test_sr_1.
    • Click the This is an example for testing purposes only checkbox.

      The Instances folder under service request now contains the test_sr_1 instance.

  4. Right click on test_sr and choose Properties, then click the Facts tab.
  5. Add one or more facts to your instance. Click the New icon and select a phrasing for your fact; for example, test_sr_1 has a priority. For the priority value, enter 1-ASAP, then click OK.

    NOTE:  Only add a fact to an instance if the associated property has a value. For example, to test using a service request instance that has no priority value, do not add a has a priority fact to the instance.

  6. Associate applicable test cases with the instance. For example, right click the test_sr_1 instance and choose Test cases, click the SR Priority checkbox, then click OK.

    NOTE:  Alternatively, you can add all example instances to a test case by right clicking the test case in the Tests & Cases window and choosing Examples.

This example is intended to act on one service request at a time, so associate only one service request at a time with this test case.

To run a test case

  1. Choose View > Tabs > Tests & Cases.

    The Tests & Cases window displays.

  2. Locate and right click the applicable test case (SR Priority in this example) and choose Test case.
  3. In the HaleyAuthority Enterprise dialog box, click Yes to deploy (or redeploy) your logic.
  4. In the Deploy Configuration dialog box, make the following entries, then click OK.
    • Accept the default of the Deploy checkboxes being checked for all modules.

      NOTE:  You may uncheck other named modules that are not part of your test for performance purposes.

    • Enter or browse to choose a directory for the deployed module; for example, D:\temp.

      NOTE:  This directory has no persisting value, and does not affect the eventual runtime database to which the module is deployed.

      The test case runs.

The test case provides two types of output:

  • The Output window provides a log of the statements that were executed. These include unconditional action statements, conditional statements for which the if clause is true, and applicability statements that are true.

    NOTE:  A test case runs against all rule modules in the knowledge base for which the test case's example instances are applicable. You cannot restrict a test case to run against a specific rule module.

    NOTE:  Siebel-specific functions (imported on your initial import with Object Importer) result in a Loaded undefined function 'function name' line. However, the output indicates that the simulated test executes those functions.

  • An entry of the form <test case name> on <date and time> is added to the Test Results folder under test case name folder. Expand this folder to see the statements that were executed. For this example, one statement displays:

    1 if the priority of a service request is "1-ASAP" then set "Recommendation" of the service request to "Escalate"

    None of the other statements' conditions are satisfied.

You can test different aspects of your rule module by doing one or both of the following:

  • Modify existing example instances and rerun the test.
  • Create new example instances, disassociate the existing instances from the test case, and associate the new instances with the case. For this example, only associate one service request instance at a time with the test case.

    For this example, you could create the following service request example instances and test them one at a time after disassociating the test_sr_1 instance from the SR Priority test case.

i

For an example that illustrates use of the test harness, see Scenario for Using Rules to Validate Data at Runtime.

Siebel Business Rules Administration Guide Copyright © 2007, Oracle. All rights reserved.