Red Hat Training
A Red Hat training course is available for Red Hat Process Automation Manager
Chapter 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 Processproject 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
- Log in to Business Central. Click Menu → Design → Projects, then Mortgage Process.
- Click Projects → Add Asset → Test Scenario.
In the Create new Test Scenario window wizard, enter the following values:
-
Test Scenario:
Qualify -
Package: select
com.myspace.mortgage_app
-
Test Scenario:
- Click Ok.
5.1.2. Input the Applicant facts and values
Input the Applicant test data based on the guided decision table values.
Procedure
- Click +GIVEN to open the New input window.
- Select Applicant from the Insert a new fact pull-down menu.
-
Enter
appin the Fact name field and click Add. - 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.
-
Click
next to annualincome.
-
Click Literal value in the Field value window and enter
150000in 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
- Click +GIVEN to open the New input window.
- Select Property from the Insert a new fact pull-down menu.
-
Enter
propin the Fact name field and click Add. - 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.
-
Click
next to saleprice.
-
Click Literal value in the Field value window and enter
250000in the saleprice field. - 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.
-
Click
, then click Literal value and enter 4in the age field. - 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.
-
Click
, then click Literal value and enter Urbanin 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
- Click +GIVEN to open the New input window.
- Select Application from the Insert a new fact pull-down menu.
-
Enter
applicationin the Fact name field and click Add. - 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.
-
Click
next to mortgageamount.
-
Click Literal value in the Field value window, then enter
250000in the mortgageamount field.
5.1.5. Input the expected values
Input the application’s expected values.
Procedure
- Click +Expect to open the New expectation window.
- Expand the Fact value pull-down menu, select Application, and click Add.
- Click Application 'application has values:
- Select mortgageamount from the Choose a field to add pull-down menu and click OK.
-
Enter
200000in the mortgageamount: equals field. - Click Save, then click Save to confirm your changes.
Click Run scenario.
Figure 5.1. Application test scenario screen
