Samples > Rule Scenario Manager Demonstration > How to Test Rules in Rule Scenario Manager using XML Binding

This sample shows how to test rules in Rule Scenario Manager using XML data binding.

Scenarios can be grouped together into scenario suites. A scenario suite is a list of scenarios with a KPI that is calculated over the scenario results. See Scenario Suites for a more detailed description.

A simulation is a list of scenario suites together with a KPI, which provides global feedback on the executed scenarios. See Simulations for a more detailed description.

Scenario, scenario suite and simulation executions produce reports in different formats that you can view and store.

Note that most Rule Scenario Manager artifacts can be generated using a wizard. For more details, see Defining Rule Scenario Manager Artifacts.

Key Features

Key features include:

Installing this Sample

To install the sample:

  1. Go to the Samples Console and locate the sample scenariomanager > basics-xmlbinding.
  2. Check that the Samples Server is started.
  3. For information on how to start and stop the Samples Server, see Stopping and Restarting the Samples Server from the Samples Console.
  4. Execute the deploy.ruleapp command to deploy to the Rule Execution Server the loanvalidationruleapp RuleApp used in this sample.
  5. This operation has completed successfully when the samples trace returns the message Deploy succeeded.
  6. Execute the build command to compile the source code.

Running this Sample

This sample can only be opened and run in the Samples Console.

Scenario Suite

When executing the following scenario suite, you can view the results in Excel and HTML format.

To run a scenario suite:

  1. Double-click the run.scenariosuite target.
  2. The result on the samples trace shows that 11 tests ran and five of them failed.
  3. To view the results in Excel format, go to the directory: <InstallDir>/scenariomanager/samples/basics-xmlbinding/data/scenario/reports/excel.
  4. Open the BalXMLBindingInputReport1.xls file. This report file contains all data related to the execution:
  5. images/rsm-report-excelBALXML.png
  6. In the Samples Console, double-click the run.report target.
  7. To generate a report of the output in HTML format, go to the directory: <InstallDir>/scenariomanager/samples/basics-xmlbinding/data/scenario/reports/junit.
  8. Open the index.html file in your browser.
  9. Click the MyScenarioSuiteJUnit link in the left pane. The results of the execution are displayed in the right pane:
  10. images/rsm-report-junitBALXML.png
Generate Rule Scenario Manager input data files from XML files

This sample helps you to generate the input data files from your XML files.

To generate the data input files:

  1. Double-click the run.dynamicinputparameters target.
  2. The result on the samples trace shows that two tests ran and none of them failed.
  3. Go to the directory: <InstallDir>/scenariomanager/samples/basics-xmlbinding/data. You will see that an XML input data file dynio.xml has been generated.

Note that if you have installed Rule Studio, you can import this sample as a Java project.

To import the sample as a Java project:

  1. Select the following directory as the root project directory: <InstallDir>/scenariomanager/samples/basics-xmlbinding.
  2. Leave the Copy project into workspace directory check box empty.
  3. Once imported, use the build.xml file to run the tests.

Source Files

This sample is located in the directory: <InstallDir>/scenariomanager/samples/basics-xmlbinding.

Highlights

Highlights of this sample are as follows.

Deployment

As the rules are executed against a dynamic XOM, there is no need to deploy the SSP WAR file.

Configuration

Environment configuration data, which can be applied to scenarios, scenario suites, and simulations, are contained in XML files. See Databinding for an explanation of how scenarios are controlled by their configuration.

You use this XML data configuration to define the following:

In this sample, the configuration is specified by the loanValidationConfigurationXML.xml file or the loanValidationConfigurationExcel.xml file. These files specify the properties required to execute the scenarios, such as the executor class and the input and output databinding classes.

Note that all requests for executions are sent to a remote Scenario Service Provider through the IlrHTTPExecutorImpl executor. This class allows you to execute rulesets remotely using the HTTP protocol.

The configuration also defines the method by which the input data is read. To read XML data, the configuration specifies IlrXMLInOutParametersImpl as the input binding class. To read Excel data, the configuration specifies IlrExcelInOutParametersImpl as the input binding class.

Definitions

The Rule Scenario Manager testing artifacts, scenarios, suites and simulations, are defined in XML files.

Scenario definition

You use this XML file to define scenarios using the following data:

Input data is the source data on which a ruleset (defined by the ruleset path) is executed.

After the ruleset is executed, an execution response is generated. The response includes such information as the time taken to complete the ruleset execution, the rules fired, the tasks executed, the number of rules fired, the number of tasks executed, and so on. You can use filters to determine how much information you retrieve from the ruleset execution. See Filters for further information.

A scenario report represents the results of a scenario execution. It contains the name and description of the scenario, the tests that were performed over the ruleset execution results and the test results. Output data is the data returned by the rule engine on the execution of the ruleset; they are the results of firing the rules.

Scenario suite definition

You use this XML file to define scenario suites using the following data:

To generate the input files from the XML files:

Summary

Rebuilding this Sample

To rebuild the sample:

  1. In the Samples Console, double-click the build target to compile the code.
  2. To run all samples, simply double-click the run target.
  3. To run the JUnit report, double-click the run.report target.
  4. To deploy the RuleApp, double-click the deploy.ruleapp target.

Related Concepts

Scenarios
Scenario Suites
Simulations
Configurations
Scenario Service Provider
Scenario Report
Scenario Suite Report
Simulation Report
Data and Datasets
Execution Trace
Databinding
Executor
Tests
Extractor
Scenario Suite KPI
Simulation KPI
RSM Archives

Related Tasks

Rule Scenario Manager XML and Java Artifacts
Executing Scenarios, Scenario Suites, Simulations, and RSM Archives

Related Reference

Test Extractors and Operators

Related Samples and Tutorials

How to Test Rules in Rule Scenario Manager Using Java Binding