Background
Contributions
The B-method and the BETA tool
The B-method
BETA
Characteristic | Example | Blocks/values | |||||
---|---|---|---|---|---|---|---|
Equals to (ECS) |
E
a
=E
b
|
E
a
=E
b
|
E
a
/= E
b
| – | – | – | – |
Is boolean (ECS/BVS) |
v∈BOOL |
v∈BOOL | – | – | – | – | – |
Is natural number (BVS) |
v∈N
A
T
|
v=−1 |
v=0 |
v=1 |
v=MAX−1 |
v=MAX |
v=MAX+1 |
-
Each choice (EC): one value from each block for each characteristic must be present in at least one test case. This criterion is based on the classical concept of equivalence classes partitioning, which requires that every block must be used at least once in a test set
-
Pairwise (PW): one value of each block for each characteristic must be combined to one value of all other blocks for each other characteristic. The algorithm used by BETA for this criterion is the in-parameter-order pairwise presented in [27]
-
All Combinations (AC): all combinations of blocks from all characteristics must be tested
-
Predicate coverage (PC): for each predicate p in the set of predicates to cover, the set of test requirements contains two requirements: p evaluates to true, and p evaluates to false
-
Clause coverage (CC): For each clause4 c in the set of clauses to cover, the set of test requirements contains two requirements: c evaluates to true, and c evaluates to false
-
Active clause coverage (ACC): for each predicate p and each major clause c i which belongs to the clauses of p, choose minor clauses c j so that c i determines p. Then, the set of test requirements has two requirements for each c i : c i evaluates to true, and c i evaluates to false
-
Combinatorial clause coverage (CoC): the complete truth table of each predicate p in the set of predicates to cover must be tested.
Related work
-
Uses a state-based or pre/post modeling notation
-
Generates test cases based on artifacts that model functional behavior
-
Relies on data coverage or structural model coverage test selection criteria
-
Uses constraint solving and a set of specific algorithms as test generation method
-
Uses offline test cases
-
Provides abstract and executable test cases
Methods
General behavior evaluation
Code coverage
Mutation score
-
Question 1—General evaluation of BETA: What are the difficulties encountered during the application of the BETA approach in its entirety, and what are the limitations of the BETA tool?
-
Question 2—Input space partitioning in BETA: How do the BETA implementation of the partitioning strategies and combination criteria differ in quantity (size of the test suites) and quality (code coverage and mutation analysis) of the results, and how recent improvements influence these results?
-
Question 3—Logical coverage in BETA: How do the BETA implementation of the logical coverage criteria differ in quantity (size of the test suites) and quality (code coverage and mutation analysis) of the results?
-
Question 4—Comparing logical coverage and input space partitioning in BETA: How do the BETA implementation of the input space partitioning and logical coverage criteria differ from each other? Which criteria provide better coverage and are more capable of detecting faults?
Improved experiment
Randomization experiment
Case Studies: presentation and results
Lua API
Test case generation
Test case implementation
Test case execution
b2llvm and C4B
Test case generation
Test case implementation
Test case execution
Modules | Experiment | Percentage of mutants killed—mutation score % | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Equivalent classes | Boundary value analysis | Logical | |||||||||||
Name | Op. | Mutants | EC | PW | AC | EC | PW | AC | PC | CC | ACC | CoC | |
ATM
| 3 | 11 | Original | 81.8 | 81.8 | 81.8 | 81.8 | 81.8 | 81.8 | – | – | – | – |
Improved | 81.8 | 81.8 | 81.8 | 81.8 | 81.8 | 81.8 | 81.8 | 81.8 | 81.8 | 81.8 | |||
Randomization | 92.7 | 90.9 | 87.3 | 92.7 | 90.9 | 87.3 | 94.5 | 90.9 | 96.4 | 90.9 | |||
Sort
| 1 | 123 | Original | 89.4 | 89.4 | 89.4 | 89.4 | 89.4 | 89.4 | – | – | – | – |
Improved | 89.4 | 89.4 | 89.4 | 89.4 | 89.4 | 89.4 | 91.1 | 91.1 | 91.1 | 91.1 | |||
Randomization | 90.7 | 90.7 | 91.1 | 90.7 | 90.7 | 91.1 | 91.1 | 91.1 | 91.1 | 91.1 | |||
Calculator
| 6 | 120 | Original | 47.5 | 47.5 | 47.5 | 74.2 | 74.2 | 74.2 | – | – | – | – |
Improved | 46.5 | 46.6 | 46.6 | 71.6 | 71.6 | 71.6 | 46.6 | 46.6 | 46.6 | 46.6 | |||
Randomization | 58.7 | 50.8 | 56.8 | 78 | 75 | 76.2 | 55.3 | 59.5 | 56 | 51.8 | |||
Calendar
| 1 | 67 | Original | 9 | 19.4 | 19.4 | 25.4 | 35.8 | 35.8 | – | – | – | – |
Improved | 80.6 | 94 | 94 | 0 | 35.8 | 35.8 | 94 | 94 | 94 | 94 | |||
Randomization | 80.6 | 94 | 94 | 0 | 35.8 | 35.8 | 94 | 94 | 94 | 94 | |||
Counter
| 4 | 87 | Original | 41.4 | 85.1 | 85.1 | 41.4 | 94.2 | 94.2 | – | – | – | – |
Improved | 41.4 | 85.1 | 85.1 | 41.4 | 94.2 | 94.2 | 85.1 | 85.1 | 85.1 | 85.1 | |||
Randomization | 45.5 | 86.8 | 87.1 | 43.2 | 95.2 | 97.5 | 71.9 | 80.7 | 75.4 | 78.4 | |||
Division
| 1 | 29 | Original | 31 | 31 | 31 | – | – | – | – | – | – | – |
Improved | 31 | 31 | 31 | 89.6 | 96.5 | 96.5 | 34.5 | 34.5 | 34.5 | 34.5 | |||
Randomization | 59.3 | 73.8 | 68.3 | 89.6 | 96.5 | 96.5 | 53.8 | 54.5 | 43.4 | 74.5 | |||
Fifo
| 2 | 40 | Original | 90 | 90 | 90 | 90 | 90 | 90 | – | – | – | – |
Improved | 90 | 90 | 90 | 90 | 90 | 90 | 90 | 90 | 90 | 90 | |||
Randomization | 90 | 90 | 90 | 90 | 90 | 90 | 90 | 90 | 90 | 90 | |||
Prime
| 1 | 66 | Original | 34.8 | 34.8 | 53 | – | – | – | – | – | – | – |
Improved | 34.8 | 34.8 | 53 | 0 | 43.9 | 43.9 | 62.1 | 62.1 | 62.1 | 62.1 | |||
Randomization | 39.1 | 40.6 | 75.4 | 0 | 43.9 | 43.9 | 71.5 | 71.5 | 72.4 | 78.5 | |||
Swap
| 3 | 8 | Original | 100 | 100 | 100 | 100 | 100 | 100 | – | – | – | – |
Improved | 100 | 100 | 100 | 100 | 100 | 100 | 37.5 | 37.5 | 37.5 | 37.5 | |||
Randomization | 90 | 85 | 87.5 | 90 | 85 | 87.5 | 97.5 | 80 | 87.5 | 95 | |||
Team
| 2 | 89 | Original | 68.5 | 68.5 | 68.5 | 68.5 | 68.5 | 68.5 | – | – | – | – |
Improved | 68.5 | 68.5 | 68.5 | 68.5 | 68.5 | 68.5 | 68.5 | 68.5 | 68.5 | 68.5 | |||
Randomization | 68.8 | 69 | 69 | 68.8 | 69 | 69 | 67.9 | 73.3 | 82.7 | 80.2 | |||
TicTacToe
| 3 | 764 | Original | 0 | 21.9 | 40.3 | 0 | 20.4 | 40.3 | – | – | – | – |
Improved | 0 | 21.9 | 40.3 | 0 | 20.4 | 40.3 | 3.1 | 23.3 | 36.8 | 40 | |||
Randomization | 0 | 20.5 | 40.5 | 0 | 18.1 | 41.3 | 3.1 | 23.4 | 36.3 | 40.9 | |||
Wd
| 3 | 68 | Original | 91.2 | 91.2 | 91.2 | 91.2 | 91.2 | 91.2 | – | – | – | – |
Improved | 91.2 | 91.2 | 91.2 | 91.2 | 91.2 | 91.2 | 91.2 | 91.2 | 91.2 | 91.2 | |||
Randomization | 90 | 88.8 | 86.5 | 90 | 88.8 | 86.8 | 86.5 | 87.6 | 88.8 | 86.5 | |||
Average | 30 | 1472 | Original | 61.9 | 69.5 | 71.3 | 66.2 | 74.5 | 76.5 | – | – | – | – |
Improved | 63 | 69.5 | 72.6 | 60.3 | 73.6 | 75.3 | 65.5 | 67.1 | 68.3 | 68.5 | |||
Randomization | 67.1 | 72.6 | 77.8 | 61.1 | 72.5 | 75.2 | 73.1 | 74.7 | 76.2 | 79.1 |
Discussions
Question 1: General evaluation of BETA—scope and tool support
Question 2: Input space partitioning in BETA—quantitative and qualitative aspects
Question 3: Logical coverage in BETA—quantitative and qualitative aspects
Question 4: Comparing logical coverage and input space partitioning in BETA
Threats to validity
Conclusions
-
Fixing infeasible test cases: the current experiments showed that, during the test case generation process, test cases are lost due to infeasibility. Some of the test formulas contain contradictions that make it impossible to generate test data that satisfy them. In some cases, it is possible to turn these infeasible test formulas into feasible ones with smarter combination algorithms. An important point of improvement is then to enhance BETA’s combination algorithms to avoid contradictory clauses, resulting in fewer infeasible test cases
-
Generate test cases from B implementation modules: since B implementations represent more closely the tested code, the ability to also generate test cases from them would reduce the abstraction gap and make the process of refinement of the test cases easier. This improvement could result in less time required to adapt and code the concrete test cases and should also increase coverage results in cases such as the TicTacToe problem where concretization leads to a more complex control structure
-
New improvements to the partition strategies: some improvements in the way partitions are created during the test generation process have already been made. We can still improve the partitioning process using knowledge acquired during the latest experiments and using techniques proposed in related work, such as [43], which enumerates a number of partitioning strategies for different constructs used in formal models. In another line of work, some extra flexibility may be provided (with the cost of greater user interaction), allowing for user-defined partition schemas.