ILOG JRules User Guide > Testing Rules with Rule Scenario Manager > Tasks > Executing Scenarios, Scenario Suites, Simulations, and RSM Archives > Executing a Scenario, Scenario Suite, or Simulation

After you have defined test cases for rules, by way of scenarios, scenario suites, simulations, or RSM archives containing a combination of these, you need to execute them to obtain the test results. The execution of scenarios, suites, and simulations is done in a similar way, but RSM archives are treated differently.

The objective of a scenario execution is to execute a ruleset on selected input data and apply tests on the ruleset execution results. To perform a scenario execution, you must first create or modify a scenario definition and a configuration relating to the scenario.

Scenarios can be executed individually, as part of a scenario suite or from within a simulation (a collection of scenario suites). Suites and simulations contain at least one and up to an unlimited number of scenarios. Scenarios can be executed in command-line, in JUnit, or in the Rule Scenario Manager Console (see the Rule Scenario Manager Console Online Help for details).

Note
To get the lists of rules fired and tasks executed you need to modify the properties.txt file of your RuleApp to add the following properties:

ruleset.sequential.trace.enabled=true

ruleset.trace.enabled=true

Executing through Command-Line

Scenarios, scenario suites, and simulations can be executed from the command line using Ant tasks. Examples of Ant scripts are provided in the build.xml files in the <InstallDir>/scenariomanager/samples/basics-javabinding and /basics-xmlbinding directories.

To execute through command-line:

  1. Set the run.text target to use the JUnit class junit.textui.TestRunner:
<java classname="junit.textui.TestRunner">
   <arg line="loan.MySimulationJUnit"/>
   ...
      [classpath to set]
where MySimulationJUnit is the class of the executable element to execute.
  1. Set the run.swing target to use the JUnit class junit.swingui.TestRunner:
<java classname="junit.swingui.TestRunner" fork="true" >
   <arg line="myPackage.MyScenarioSuiteJUnit"/>
   <arg line="-noloading"/>
   ...
      [classpath to set]
where MyScenarioSuiteJUnit is the class of the executable element to execute. An example of using run.swing can be seen in the in the build.xml file of the basics-xmlbinding sample.

For more detailed information, see Ant Commands for Scenario Execution.

Executing through JUnit

Examples of Eclipse projects executing Rule Scenario Manager artifacts are provided in the <InstallDir>/scenariomanager/samples/basics-javabinding and /basics-xmlbinding directories. You can copy one of these projects and modify it for your own applications.

To execute a scenario, scenario suite, or simulation through JUnit in Eclipse:

  1. Import the scenario project into Eclipse.
  2. Ensure that the following Eclipse environment variables are set to the correct paths: ILOG_RSM_HOME, ILOG_EXECUTION_SERVER_HOME, and JRULES_HOME. These variables are normally created on installation of JRules.
  3. Right-click on the name of the scenario, suite, or simulation in Eclipse, and run JUnit.

Related Concepts

Scenarios
Scenario Suites
Simulations

Related Tasks

Ant Commands for Scenario Execution
RSM Archives Execution with Ant Commands
RSM Archive Execution from an HTTP Client

Related Reference

Scenario XML Definition
Scenario Suite XML Definition
Simulation XML Definition

Related Samples

How to Test Rules in Rule Scenario Manager Using Java Binding
How to Test Rules in Rule Scenario Manager using XML Binding