-
Notifications
You must be signed in to change notification settings - Fork 0
/
todo.txt
78 lines (60 loc) · 4.43 KB
/
todo.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
(prio 2, complexity 3) Mind Maps are translated into Iteration Rules and Default Rules organized in Rule Stacks.
(prio 1, complexity 10) Rule Engine generates property combinations based on current Rule Stacks.
(prio 4, complexity 3) (Optional) test coverage increment is evaluated. If it is zero the combination may be ignored.
(prio 3, complexity 5) Script Producer translates each property combination into a test script containing one test case.
Each Rule contains
* a Targeted Property name,
* (Iteration Rules only) a set of Triggering Properties,
* a precondition as a boolean expression using other property values, true by default,
* an option indicating whether the values should be assigned in a given or a random (shuffled) order,
* an option indicating whether all values must be used (mandatory complete iteration),
* a Rule Action.
Rule Action assigns a set of property values to its Targeted Property
It can use values of other properties for calculations
It can add another Rules to Rule Stacks
The Rules added by a particular Rule remain in the Rule Stacks until iteration over its Target Property values is finished.
It can add to Rule Stacks for a subset of targeted property values
The Rules added by a particular Rule remain in the Rule Stacks until iteration over the subset values is finished.
Execution of a Iteration Rule is triggered by assigning of a value to a triggering property (forward chaining),
if there no triggering properties the rule is executed when the Rule Engine starts.
Iteration Rules containing the same Targeted Property and set of Triggering Properties belong to the same Rule Stack
Default Rules containing the same Targeted Property belong to the same Rule Stack.
Execution of a Default Rule is triggered by requesting a value of a not already assigned property (backward chaining)
Rule Engine iterates over all rules in a stack starting with the last added rule.
The first rule which has no precondition or a satisfied precondition is executed, all other rules on the stack are ignored.
If a Targeted Property of a Iteration Rule is already assigned by another Rule and should be assigned again
there is contradiction in the Rule Set and the generation is canceled.
When the Rule Engine starts there are no properties already assigned a value sets.
Therefore it starts by executing all Iteration Rules without dedicated triggering properties
and with satisfied preconditions so that their targeted properties are assigned a set of values.
Than it assigns to the targeted property a first value in the set.
This assignment can trigger execution of another Iteration rules.
When a set of values is assigned its order can be randomized if it is required by the rule definition.
In the following steps the Rule Engine iterates over the assigned property values until all mandatory iterations are finished.
Each property can be assigned the next value from its value set
if and only if all mandatory iterations over all directly or indirectly depending properties are finished.
Property B depends on property A directly if
* property A is a triggering property of the iteration rule which action defined the set of values of property B,
* calculation of set of values by the applied rule for B uses value of A,
* calculation of the checked preconditions of the applied rule or for the other rules on the same rule stack uses value of A.
Property C depends on property A indirectly if there is a property B so that C depends on B and B depends on A directly or indirectly.
At each iteration after all possible rules are executed and all properties assigned it calls the script producer.
The last can process the generated property values and also request execution of default rules for unassigned properties.
If there is another rule which has the same triggering property and which mandatory iteration is not complete yet,
iteration over property value set is restarted after it finishes.
In this case it is not needed to iterate over all values again.
If no triggering properties of some rule are iterating mandatory, iteration of its targeted property does not have to be complete too.
==Rule Engine Output==
private Map<String, Object> properties
RuleEngine Object getProperty(String name)
class RuleEngine
{
void run()
{
do {
generateNextPropertyCombination();
scriptProducer.makeScriptFor(this);
cleanUp();
} while (hasNextPropertyCombination());
}
}