Test case generation for disjunctions through the application of FLIP rules
Given the following FRET requirement with a conjunction in the condition field:
Whenever (A1 & A2) the component shall satisfy B.
The test case generation outputs reasonable test scenarios for the predicate logic in the condition field:
- One scenario where B is shown to be satisfied by the change of value in A1 ;
- One scenario where B is shown to be satisfied by the change of value in A2 ;
Negated trap formulas:
For A1: (! ((G (((! A1) | (! A2)) | (F B))) & (F (((! A1) & (! (! A2))) & (! (F B))))))
For A2: (! ((G (((! A1) | (! A2)) | (F B))) & (F (((! (! A1)) & (! A2)) & (! (F B))))))
However, when the condition field has a disjunction:
Whenever (A1 | A2) the component shall satisfy B.
The test case generation outputs a single test scenario, where only one of the two disjuncts is shown to influence the satisfaction of B. Debugging the LTL being fed to NuSMV shows that the negated trap formulas being generated for A1 and A2 respectively are identical:
(! ((G (((! A1) & (! A2)) | (F B))) & (F (((! A1) & (! A2)) & (! (F B)))))).
My expectation was that I would get 2 distinct trap formulas for A1 and A2 respectively, allowing different scenarios to be generated. Currently, NuSMV returns traces where only A1 changes, and A2 stays constant.
Hi Simon,
Thanks for your post! This may need some clarification on what the trap formulas are meant to capture.
The trap formulas we generate follow the FLIP rules from the following paper:
Charles Pecheur, Franco Raimondi, and Guillaume Brat. 2009. A formal analysis of requirements-based testing. In Proceedings of the eighteenth international symposium on Software testing and analysis (ISSTA '09). Association for Computing Machinery, New York, NY, USA, 47–56. https://doi.org/10.1145/1572272.1572279
If you follow the rules you receive the same negated trap formula for both A1 and A2 as the one that you see generated by FRET:
(! ((G (((! A1) & (! A2)) | (F B))) & (F (((! A1) & (! A2)) & (! (F B))))))
Following the definition of FLIP from the paper, this negated trap formula is meant to identify traces for which, if you were to change the value of only A1 or only A2 at some step/state (or steps), can lead to the violation of the original requirement (G ((A1 | A2) -> (F B))).
Running NuSMV on the generated trap formula, I see the following trace:
-> State: 1.1 <-
A1 = TRUE
A2 = FALSE
B = TRUE
-- Loop starts here
-> State: 1.2 <-
A1 = FALSE
B = FALSE
-- Loop starts here
-> State: 1.3 <-
-> State: 1.4 <-
This trace is an adequate test for A1 according to FLIP, because you can construct a variation of it where flipping values of A1 only, results in the violation of (G ((A1 | A2) -> (F B))). For example, flipping A1 from FALSE to TRUE in State 1.2 is one such trace variant.
The same also applies to A2, for the same test. A2 is FALSE in State 1.2, so if you only flip A2's value you end up again with a trace that violates the requirement.
Does this help?
Andreas
Thanks for the clarification, @andreaskatis.
I understand that the trace being generated is therefore a valid test case for both A1 and A2, simultaneously? (under the premise that if I were to change the value of only A1 or only A2 at any step/state, this would lead to the violation of the requirement)
My concern comes from the observation that changing the value of only A2 from FALSE to TRUE at state 1.1, while keeping its value unchanged at step 1.2, would not lead to a violation of (G ((A1 | A2) -> (F B))).
i.e.:
A1: TRUE, FALSE
A2: TRUE, FALSE
B: TRUE, FALSE
Thus the intent of FLIP does not seem to be met for A2 on that particular trace.
Hi @SimonRoy16 ,
Not every variant of the test will satisfy the constraints of the FLIP criterion. The definition of FLIP says that for a test case to be considered as adequate there exists a variant path of it that violates the requirement.
So in your example, the proposed variant path does not satisfy the FLIP criterion.
Ah, got it. Thanks for the explanation. Will close the issue. Side question, is there a plan to extend the test case generation rules to ensure at least MC/DC like coverage for predicate logic?
Glad I was able to help!
We do not have specific plans as of now, but we are definitely interested in extensions. FLIP was introduced as an MC/DC-like criterion for temporal logic formulas. In this case, it would be interesting to see whether an extension to the FLIP rules would be helpful.
In your example, we could perhaps take the trap formula that targets B
((G (((! A1) & (! A2)) | (F B))) & (F ((! ((! A1) & (! A2))) & ((F B) & (G (B -> B))))))
and further transform it into trap formulas that target B when A1 is true and B when A2 is true.
While this is redundant w.r.t. FLIP coverage, it should yield tests closer to what you were expecting.
I should also mention that an alternative way to go about this is to split the original FRETish requirement into two:
Whenever A1 component shall satisfy B
and
Whenever A2 component shall satisfy B
This should yield tests closer to what you are looking for, since you would have two trap formulas for B, where A1 and A2 are shown to contribute independently.