| ILOG JRules User Guide > Testing Rules with Rule Scenario Manager > Concepts > Scenarios |
Scenarios |
PREVIOUS NEXT |
Rule Scenario Manager tests rules using defined test cases called scenarios. A scenario definition includes a set of tests on the results of the ruleset execution. Each test consists of an extractor that uses a logical operator to compare a specified test value (or a baseline report value) with a calculated value extracted from the ruleset execution trace. Tests can indicate if rules have performed as expected.
A scenario is an executable Java class representing a test case of a single, deployed ruleset. A scenario definition includes:
Scenarios can be defined in XML files governed by an XML schema (XSD), or within the Rule Scenario Manager Console. Scenario XML files can also be generated in Rule Studio using a wizard. Scenario definitions can be imported into and downloaded from the Console as part of an RSM archive.
Scenario execution is controlled by a configuration file. A configuration, defined at the scenario, scenario suite, or simulation level, specifies the Java classes required to execute the scenarios, such as the executor class and input and output databinding classes. A scenario definition can point to the configuration file it will use, but configurations are otherwise independent of scenario definitions.
If a scenario does not explicitly specify a configuration, the configuration used by its owning scenario suite is applied.
When a scenario is executed, Rule Scenario Manager creates an execution trace that is sent to the Scenario Service Provider with the information needed to execute the scenario's ruleset. The results of this execution are then appended to the execution trace. The complete execution trace supplies the data over which the tests defined in the scenario are performed, and the collected results comprise the scenario report.
The results of a scenario execution are contained in a structured scenario report in a specified format, such as XML or Excel, using the required databinding class. Scenario reports produced in the Rule Scenario Manager Console can be viewed graphically in the Console and can be exported in several formats.
Scenario reports can be used in regression testing of rules, by specifying that a report's execution trace provides the data for the test values in the tests of other scenarios.
Input data is the source data on which a ruleset is executed. It is defined in a scenario definition as XML data or as an Excel file. A databinding mechanism must be specified in the scenario's configuration to transform the source data into a form readable by the rule engine.
Output data is the data returned by the rule engine on the execution of the ruleset; it is the results of firing the rules. A databinding mechanism must be specified to transform the execution data into a human-readable format, such as XML or Excel.
A dataset contains the values of parameters passed to the ruleset or returned by the ruleset. A dataset for Rule Scenario Manager can thus be an input dataset or an output dataset.
An input dataset depends on the ruleset parameters (the list of IN and IN/OUT parameters) and either the XOM or the BOM, depending on the dataset type. The XOM or BOM gives the contents of each class of parameter (list of attributes and relationships).
An output dataset has the same dependencies, but on the list of OUT and IN/OUT parameters of the ruleset parameters.
The execution trace is a dynamic body of information that spans the process of supplying data to the rule engine for execution and reporting these execution results.
An execution trace is created as a definition of an execution request, in which role it provides data to the rule engine for execution. After the ruleset is executed, the execution results are included in the execution request to form an execution response. The execution trace is accumulative, that is, all data is retained during the process of ruleset execution.
The execution trace contains the following information:
The information contained in the execution trace is the raw data over which tests are applied during a scenario execution. Test data is extracted from the execution trace according to defined extractors.
You can customize the scenario report with filters to determine how much information you retrieve from the ruleset execution. The filters can reduce the information returned by the SSP to the execution trace, improving system performance.
Examples of filters are:
<filter name="INFO_RULES_FIRED" value="true"/> <filter name="INFO_TASKS_EXECUTED" value="true"/>
A scenario report is a Java object containing the results of a scenario execution:
A scenario report can be produced in a number of formats, depending on the databinding class implemented. Reports are commonly stored as structured XML files or as an Excel workbook.
Several formats of reports, such as XML and HTML, can be customized using a BIRT project in Eclipse. Scenario reports produced by executing scenarios in the Rule Scenario Manager Console can be viewed graphically within the Console and exported as XML, Excel, and HTML.
An important use of scenario reports is in regression testing of rules. A scenario report can be saved and used as a baseline report in tests in a subsequent scenario execution. This allows for a scenario report to be used as a template for subsequent scenarios, so that the evolution of a ruleset can be easily audited.
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |