Red Hat Training

A Red Hat training course is available for Red Hat Process Automation Manager

第5章 Test scenarios

Test scenarios in Red Hat Process Automation Manager enable you to validate the functionality of rules, models, and events before deploying them into production. A test scenario uses data for conditions that resemble an instance of your fact or project model. This data is matched against a given set of rules and if the expected results match the actual results, the test is successful. If the expected results do not match the actual results, then the test fails.

After you run all test scenarios, the status of the scenarios is reported in a Reporting panel.

Test scenarios can be executed one at a time or as a group. The group execution contains all the scenarios from one package. Test scenarios are independent, so that one scenario cannot affect or modify the other.

5.1. Testing the loan application scenario

Test the loan application scenario using the data that you specified when you created the mortgage guided decision table. For this test, you will input data for a property in an urban location with a sales price of less than $300000.00 that is under five years old.

Prerequisites

  • The Mortgage Process project has been created
  • The following data objects have been created:

    • Applicant
    • Property
    • ValidationErrorDo
    • Application
  • The mortgage guided decision table has been created

5.1.1. Create the Qualify Test Scenario asset

Before you input the fact and test data values, you must create a new Test Scenario asset.

Procedure

  1. Log in to Business Central. Click MenuDesignProjects, then Mortgage Process.
  2. Click ProjectsAdd AssetTest Scenario.
  3. In the Create new Test Scenario window wizard, enter the following values:

    1. Test Scenario: Qualify
    2. Package: select com.myspace.mortgage_app
  4. Click Ok.

5.1.2. Input the Applicant facts and values

Input the Applicant test data based on the guided decision table values.

Procedure

  1. Click +GIVEN to open the New input window.
  2. Select Applicant from the Insert a new fact pull-down menu.
  3. Enter app in the Fact name field and click Add.
  4. Click Add a field to open the Choose a field to add window and select annualincome from the Choose a field to add pull-down menu and click OK.
  5. Click 6191 next to annualincome.
  6. Click Literal value in the Field value window and enter 150000 in the annualincome field.

5.1.3. Input the Property facts and values

Input the Property test data based on the guided decision table values.

Procedure

  1. Click +GIVEN to open the New input window.
  2. Select Property from the Insert a new fact pull-down menu.
  3. Enter prop in the Fact name field and click Add.
  4. Click Add a field to open the Choose a field to add window and select saleprice from the Choose a field to add pull-down menu and click OK.
  5. Click 6191 next to saleprice.
  6. Click Literal value in the Field value window and enter 250000 in the saleprice field.
  7. Click Insert 'Property'[prop] and select age from the Choose a field to add pull-down menu in the Choose a field to add window, and click OK.
  8. Click 6191 , then click Literal value and enter 4 in the age field.
  9. Click Insert 'Property'[prop] and select locale from the Choose a field to add pull-down menu in the Choose a field to add window, and click OK.
  10. Click 6191 , then click Literal value and enter Urban in the type field.

5.1.4. Input the Application facts and values

Input the Application test data based on the guided decision table values.

Procedure

  1. Click +GIVEN to open the New input window.
  2. Select Application from the Insert a new fact pull-down menu.
  3. Enter application in the Fact name field and click Add.
  4. Click Add a field to open the Choose a field to add window and select mortgageamount from the Choose a field to add pull-down menu and click OK.
  5. Click 6191 next to mortgageamount.
  6. Click Literal value in the Field value window, then enter 250000 in the mortgageamount field.

5.1.5. Input the expected values

Input the application’s expected values.

Procedure

  1. Click +Expect to open the New expectation window.
  2. Expand the Fact value pull-down menu, select Application, and click Add.
  3. Click Application 'application has values:
  4. Select mortgageamount from the Choose a field to add pull-down menu and click OK.
  5. Enter 200000 in the mortgageamount: equals field.
  6. Click Save, then click Save to confirm your changes.
  7. Click Run scenario.

    図5.1 Application test scenario screen

    Application test Scenario screen