Test the Rulesheet with database access disabled
- Last Updated: May 1, 2021
- 2 minute read
- Corticon
- Version 7.2
- Documentation
Testing this Rulesheet without database access is a simple matter of building an
Input Ruletest with all necessary data. An example of this is a Ruletest that was created
against the Cargo.ecore named CargoLoad.ert. Its input data is as shown:
Looking at this Input Ruletest, there is a single FlightPlan with its collection of Cargo. This
collection is what is represented with the alias load in
our Rulesheet’s Scope section. Each Cargo has a
weight value entered.
The four root-level Aircraft entities are
also shown. Each one has a maxCargoWeight, which will be
compared to the sum of load.weight during rule execution.
Given what is known about rule scope, you can confidently predict that the test data provided in this Input Ruletest will be processed by the Rulesheet because it contains the same scope!
In the following figure, we’ve executed the Test and see that it functioned as
expected. Because load.weight sums to 170000 kilograms, and the Aircraft with tailNumber
N1004 can only carry 150000 kilograms, we receive a Violation
message for that Aircraft and that Aircraft alone. All other Aircraft have
maxCargoWeight values of 200000 kilograms or more, so they fail to fire the rule.
So far, this behavior is exactly what is expected from rules: they process data of the same scope.
Save the CargoLoad.ert Ruletest.