Samples > Rule Scenario Manager Demonstration > How to Test Rules in Rule Scenario Manager using an Extended Excel Binding

This sample shows how to test rules in Rule Scenario Manager using an extended Excel binding.

The Rule Scenario Manager archive is provided with the sample. For testing purposes, you may want to regenerate it. A macro in an Excel file is provided to do this. Macro execution must be enabled in Excel to run it.

Key Features

Key features include:

Installing this Sample

To install the sample:

  1. In the Samples Console locate: scenariomanager > extended-suite-excel-binding.
  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 command to deploy the updated Scenario Service Provider (SSP) and Rule Scenario Manager Console.
  5. Wait for the Java EE application to start before continuing.
  6. When the Java EE application is ready, the samples trace displays the message:
Application ready.
BUILD SUCCESSFUL.

Running this Sample

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

The sample enables you to create and upload the Rule Scenario Manager archive containing a complete scenario. Once uploaded, you can run the scenario using the Rule Scenario Manager Console.

The Rule Scenario Manager archive is already created for the sample, so you do not need to create it. However, if you want to create it for testing purposes, you can do so by running the macro provided in the sample Excel file. Note that you must have Excel configured to be able to do this. If you are not able run macros, you can go straight to the upload task.

To create the Rule Scenario Manager archive:

  1. Open the sample Excel file in:
  2. <InstallDir>/scenariomanager/samples/extended-suite-excel-binding/data/sample.xls
  3. At the Security Warning prompt, click Enable Macros.
  4. If you see a Microsoft Excel window describing macros, this means that your Excel configuration does not allow you to run macros. If you want to run the macro in sample.xls, change your Excel security level to medium, restart Excel and re-open the file.
    In you choose to NOT to enable macros, you will not be able to generate the Rule Scenario Manager archive, but you will still able to run the sample.
  5. When the file opens, you will see the following sheets:
    1. Input Data Sets: defines the input data for each sample scenario. We will run the scenarios later.
    2. Bankruptcy, Borrower, Loan and SSN (Social Security Number): these sheets define the data used by the scenarios in the scenario suite.
    3. Tests: defines the assertions that will be used to validate the scenarios.
    4. Suite Definition: contains information about the scenario suite, such as its name and description.
    5. Suite Configuration: defines a configuration name and description, and the server on which the scenario will be executed. It also contains the Create RSM Archive button, which we will use to create the RSM archive.
    6. rsm_config: contains internal data that configures the data in the workbook. The rows specific to this sample are rows 6 to 9 inclusive (class keys and class names relating to Loan, Bankruptcy, SSN and Borrower). The other rows are not used in this instance, but they need to be in the file. For further details on this worksheet, please refer to The rsm_config Sheet.
  6. If macros are enabled, create the Rule Scenario Manager archive by clicking the Suite Configuration sheet, then Create RSM archive.
  7. The upload file is generated in: <InstallDir>/scenariomanager/samples/extended-suite-excel-binding/data/sample-upload.zip
    If macros are not enabled, omit this step and go straight to into Rule Scenario Manager archive upload.
  8. Once the archive has been created, close sample.xls.

To upload the Rule Scenario Manager archive to the Rule Scenario Manager Console:

  1. Open a web browser and enter the following URL: http://localhost:8080/rsm.
  2. Login to Rule Scenario Manager using the following details:
  3. Username: rsm
    Password: rsm
  4. Click the Admin tab.
  5. In the left navigation pane, click the Load RSM Archive link.
  6. Click Browse, and select the sample upload file:
  7. <InstallDir>/scenariomanager/samples/extended-suite-excel-binding/data/sample-upload.zip.
    (Make sure you do not select the sample.xls file.)
  8. Click Add.
  9. In the Administration View, expand Loan Validation Excel Sample 1 and Loan Validation Excel Sample 2.
  10. You will see that the following items are waiting to be added for each one:
    - Scenario
    - Input Datasets
    - Test sets
    - Server.
  11. Click Confirm.
  12. When the upload is complete, the following message is displayed: RSM Archive Loaded!

To explore the newly-updated Rule Scenario Manager archive:

  1. Click the Scenario Suites tab to display the two scenarios you uploaded:
  2. - Loan Validation Excel Sample 1
    - Loan Validation Excel Sample 2
  3. Under Scenario Edit, click the Loan Validation Excel Sample 1 link to display the content for this scenario. You will see the:
  4. - Path to which the ruleset will be executed: /loanvalidationruleapp/1.0/loanvalidationrules/1.0
    - Server on which it will be executed: [Executor on localhost] - My Executor
    - Selected Input Data: Loan Validation Excel Sample 1
    - Selected Test Set: Test Use Case 1
  5. Under Selected Input Data, click Loan Validation Excel Sample 1 to display the input data that will be used to execute the scenario.
  6. You will see that a borrower and a loan will be used as input values.
  7. Click Cancel to close the Input Dataset Selector and return to the main Scenario View.
  8. Under Selected Test Set, click Test Use Case 1.
  9. You will see details of the three assertions will be applied when the scenario is executed.
  10. Click Cancel to close the Test Set Selector and return to the main Scenario View.

To run the scenario suite:

  1. Click the Scenario Suites tab.
  2. Click Launch.

When execution is complete, the Report View is automatically displayed. You should see that the scenario suite completed successfully. Scroll down the Report View page to see the results of the execution.

Source Files

This sample is located in <InstallDir>/scenariomanager/samples/extended-suite-excel-binding. It contains the following files:

Highlights

The Rule Scenario Manager archive is a zip file containing:

Archive Descriptor

When the Rule Scenario Manager archive is uploaded, Rule Scenario Manager needs to identify:

All this information is held in the archive-descriptor.xml file, within xml tags.

Sample Upload File

The sample upload file contains all the data needed to describe the scenario suite, and the code to generate the Rule Scenario Manager archive.

The file is called when you do one of the following:

Note that you will be required to enter a password to have access to the macro code. The password is sample. You can keep this password, change it to something else or remove it - although we recommend that you protect your macros so that no-one else can modify them.

The sample-upload.xls file must include a data objects sheet for each class included in the input data definition. The format is the same as the default Rule Scenario Manager format. For more details, please refer to The Data Objects Sheet.

Rebuilding this Sample

To rebuild the sample:

  1. In the Samples Console, double-click the build target to compile the code and create the extension JAR file.
  2. Double-click the deploy.ruleapp target, to deploy the RuleApp.
  3. Double-click the deploy target. The deploy target:
  4. - Compiles the code and create the extension JAR file. This JAR file contains the compiled code for the source files described in the Source Files section, above.
    - Packages the SSP with the Execution Object Model (XOM) loanvalidation-xom.jar. When you launch the scenario, the SSP creates the java object instances from the Scenario Input Data before requiring an execution to the Rule Execution Server, so it needs them in its classpath.
    - Packages the Rule Scenario Manager Console with the extension jar file. When uploading the Rule Scenario Manager archive, the Console needs the class that reads the Excel file in its classpath.
    - Deploys the RuleApp to the Rule Execution Server.
    - Deploys the newly-packaged SSP and Rule Scenario Manager to the application server.

Related Concepts

Scenario Suites
Scenarios
Data and Datasets
Scenario Report
Tests
RSM Archives
Scenario Service Provider

Related Tasks

The Data Objects Sheet
Executing a Scenario, Scenario Suite, or Simulation

Related References

Test Extractors and Operators

Related Samples and Tutorials

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