9.3. Additional Test Scenario Features
In addition to the previous Test Scenario features, which encompassed the GIVEN and EXPECT input facts, Red Hat JBoss BRMS Test Scenarios include various other features.
Procedure: Calling Methods
Call Method- allows you to call a method on an existing fact in the beginning of the rule execution. This feature is accessed by clicking on the green plus sign
next to the CALL METHOD feature. This opens up a new input box like the following:
Figure 9.2. Call Method

After selecting an existing fact from the drop-down list, click the Add button. The green arrow button
allows you to call a method on the fact.
Figure 9.3. Invoke a Method

Procedure: Adding Globals
globals- validate the global field values. Globals are named objects that are visible to the rule engine but are different from the objects for facts. Accordingly, the changes in the object of a global do not trigger the reevaluation of rules. This feature is accessed by clicking on the green plus sign
next to the (globals) feature.
Figure 9.4. New Global

After selecting an existing global from the drop-down list, click the Add button. Clicking on the newly selected global allows you to assign values to fields of the global variable.
Figure 9.5. Apply Field

After selecting an existing field from the drop-down list, click the OK button. Once you have selected the field, you will be able to set its value.
By clicking on this icon, you will be able to edit the field values.
Figure 9.6. Field Values

Procedure: Configuring Rules
Configuring rules- allows the user to determine additional constraints on the firing of rules by providing the following options:-
Allow these rules to fire:- allows you to select which rules are allowed to fire. -
Prevent these rules from firing:- allows you to prevent certain rules from firing for the test scenario. -
All rules may fire- will allow all the rules to fire for the given test.
Figure 9.7. Configuration

-
If you select
Allow these rules to fire:orPrevent these rules from firing:, you will be supplied with an empty field where you can select the rules which pertain to the configuration by clicking the green plus sign
next to the empty field. This will open a dialog to select which rules are affected by the condition.
Figure 9.8. Selecting rules

- Choose a rule from the drop-down list and click the OK button. The selected rules will appear in the field next to the rules configuration option. You can add as many rules as you like to this field.
Procedure: Date and Time Configuration
Use real date and time- the real time is used when running the test scenario.Figure 9.9. Real Date and Time

Use a simulated date and time- this option allows you to specify the year, month, day, hour, and minute associated with the test scenario run.Figure 9.10. Title

Procedure: Advanced Fact Data
After providing values to editable properties as part of your created fact, the Field value dialog box will appear where you can edit literal values or provide advanced fact data.
Figure 9.11. Advanced Options

Within the Advanced Options section, you will be provided with various choices depending on the type of fact created and the model objects used for the particular Test Scenario.
Bound variable- sets the value of the field to the fact bout to the selected variable. The field must be of the right type.Figure 9.12. Bound Variable

Create new fact- allows you to create a new fact. By clicking on the Create new fact button, a new fact will appear as the value of the field. By clicking on that fact, you will be supplied with a drop down of various field values, and these values may be given further field values.Figure 9.13. Create New Fact

Procedure: Adding More Sections
-
The Test Scenario edit screen allows you to add Given, Call Method, and Expect sections to the scenario by clicking the More
button below the EXPECT section. This will open a block encompassing all three sections that can be removed by clicking the delete item
button.
Procedure: Modifying or Deleting an Existing Fact
-
Modifying an existing fact- allows the editing of a fact between knowledge base executions. Delete an existing fact- allows the removing of facts between executions.Figure 9.14. Modifying and Deleting Existing Facts


Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.