Developer

Testing Rules in the Rule Editor

Context

The rule editor, in addition to providing the interface to define and edit rule definitions, also provides tools for testing rule definitions. Within the Rule Editor, below the list of function parameters, is an expandable frame labeled “Rule Test Results.” Expanding this frame will display the return value for the rule as currently defined, with certain assumptions made about return values within the rule. Using this test frame, the developer can select a parameter and then provide a test value for that parameter. The return value of the rule will then be determined and displayed, using the new test value.

Procedure

  1. Within the Rule Editor, expand the Rule Test Results frame. Within the Structure view select the rule function term for which a parameter test value is to be specified. The function will be displayed in the middle of the screen. Select the parameter for which a test value is to be entered.

    Within the test results pane, fields are displayed for the values returned by the rule, the currently selected function term, and the currently selected parameter to that function.


  2. To change the test value for the selected parameter, click the button to the left of field Rule within the Rule Test Results frame.

    A screen is displayed allowing for the entry of a test value. When entered, the return values for the function term and the rule will be updated automatically:


  3. The Rule field displays the value the rule will return based on the test data entered. The line below it displays the value returned by the function, again based on the entered test data. Below these fields is the section where the test data can be entered. The fields displayed here include all values under the selected term which may be replaced with test data. Excluded from this list are constant values and object collection properties. Changing any of the values will automatically update the return value from the selected function term and the rule as a whole.

Results

The results of entering test data will not affect the rule definition in any way. However, proper use of the test functionality can significantly improve the stability of the rule before it is published for development and unit testing. Additionally, areas of logic for which the proper structure is unclear can be made easier when using the test data to determine if the expected values are actually returned by the logic within the structure. Note that while this functionality is a powerful development tool, it is not intended to replace the proper run-time testing that should be a part of any software development or product implementation project.