Repairing GUI Test Suites Using a Genetic Algorithm
Si Huang, Myra B. Cohen and Atif M. Memon.
In ICST '10: International Conference on Software Testing, Verification and Validation, April, 2010, Paris, France.
Abstract

Recent advances in automated functional testing of Graphical User Interfaces (GUIs) rely on deriving graph models that approximate all possible sequences of events that may be executed on the GUI, and then use the graphs to generate test cases (event sequences) that achieve a specified coverage goal. However, because these models are only approximations of the actual events flows, the generated test cases may suffer from problems of infeasibility, i.e., some events may not be available for execution causing the test case to terminate prematurely. In this paper we develop a method to automatically repair GUI test suites, generating new test cases that are feasible. We use a genetic algorithm to evolve new test cases that increase our test suite's coverage while avoiding infeasible sequences. We experiment with this algorithm on a set of synthetic programs containing different types of constraints and for test sequences of varying lengths. Our results suggest that we can generate new test cases to cover most of the feasible coverage and that the genetic algorithm outperforms a random algorithm trying to achieve the same goal in almost all cases.

Experiment Settings
  • CPU: AMD 2.4GHz dual-core 64-bit processors
  • Memory: 16GB
  • Operating System: Linux 2.6.18
  • Java Runtime: Java 1.6 update 16
  • GUI Environment: Xvfb
Subjects

We designed seven synthetic programs to mimic the types of constraints found in real software. These programs have no real functionality other than to implement the constraints. The following table provides detailed descriptions for each. These benchmarks are also included on the COMET Benchmarking website along with information about the tools necessary to run and execute the experiments.

The events in each program are labeled Event1, Event2, etc. The presence of "..." indicates 0 or more other events). Click the program numbers to download the source code of the programs, and click the constraint full names to download the constraint files. View format of the constraint files.

We have also provided a simple tool for the conversion from the constraint file in our format to that in the format presented on http://www.cse.unl.edu/citportal/tools/casa/. Download the tool here.

Program Full Name Abbreviated Number of Events Constraint Description
1 Disabled Event Constraint Disb 3 Event1 is always disabled.
2 Requires Constraint Reqs 3 Event3 requires Event2 to occur before it.
3 Event Consecutive Constraint (2-way) 2Cons 3 A pair of events, (Event1, Event2), is infeasible when executed sequentially.
4 Excludes Constraint (2-way) 2Excl 3 A pair of events, (Event1, ..., Event2), is infeasible if they occur (possibly non-consecutively) in sequences.
5 Event Consecutive Constraint (3-way) 3Cons 4 A sequence of three events, (Event1, Event2, Event3), is infeasible when executed.
6 Excludes Constraint (3-way) 3Excl 5 A (possibly non-consecutive) sequence of three events, (Event1, ..., Event2, ..., Event3), is infeasible.
7 Compound Constraints Cmpd 5 Includes constraints found in Subject 2, 3 and 5: sequences (Event1, Event2) and (Event2, Event3, Event4) are infeasible; Event5 requires Event3 to occur before it.
Results

We provide results for our experiments on the seven subjects. In the paper, we run each experiment five times and show the average. We have included all of the he results for each of the five runs here. We represent events using integers in the test cases. These are zero based (but the programs are one-based) so integer i means Event(i+1). The parameters used can be found in the paper. View format for the covering array models(the specific models can be found by clicking the links in the "Length" column),format for the infeasible t-sets and format for the test suite files.

Repaired test suites for 2-way criteria by genetic algorithm
Subject Length All
t-sets
Infeasible
t-sets
Feasible
t-sets
Run 1 Run 2 Run 3 Run 4 Run 5
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Disb 5 90 50 40 040 2040 2040 1040 1040
10 405 225 180 45180 0180 0180 0180 0180
15 945 525 420 0420 0420 0420 0420 0420
20 1710 950 760 0760 0760 0760 0760 0760
Reqs 5 90 13 77 6177 5377 6177 5577 4477
10 405 28 377 270377 278377 252377 277377 300377
15 945 43 902 634902 684902 592902 741902 652902
20 1710 58 1652 12881652 12001652 12041652 11531652 12191652
2Cons 5 90 4 86 6486 5686 4786 2986 4686
10 405 9 396 195396 229396 197396 164396 230396
15 945 14 931 105931 200931 200931 284931 200931
20 1710 19 1691 1901691 3651691 3591691 3591691 1901691
2Excl 5 90 10 80 4680 4580 5480 4680 4880
10 405 45 360 45360 45360 80360 45360 162360
15 945 105 840 0835 0838 105838 0838 105836
20 1710 190 1520 01516 01508 01511 01511 01509
3Cons 5 160 0 160 150160 160160 150160 150160 150160
10 720 0 720 641720 655720 674720 660720 678720
15 1680 0 1680 15131680 14821680 14481680 15071680 14641680
20 3040 0 3040 28323040 27173040 23633040 28503040 27263040
Cmpd 5 250 27 223 100223 113223 110223 90223 120223
10 1125 57 1068 5371068 4621068 4081068 3221068 5181068
15 2625 87 2538 9222538 8442538 7632538 8542538 7652538
20 4750 117 4633 16674633 12104633 12024633 8874633 10354633
Repaired test suites for 2-way criteria by random algorithm
Subject Length All
t-sets
Infeasible
t-sets
Feasible
t-sets
Run 1 Run 2 Run 3 Run 4 Run 5
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Disb 5 90 50 40 2040 2040 2040 2040 2040
10 405 225 180 0123 0129 0142 0127 0113
Reqs 5 90 13 77 4676 3774 4670 4670 4670
10 405 28 377 251355 251357 251357 251354 251358
2Cons 5 90 4 86 7286 7286 7286 6486 7286
10 405 9 396 163343 163365 163357 163349 163351
2Excl 5 90 10 80 5675 5679 5679 5679 5679
10 405 45 360 45276 45276 45268 45272 45281
3Cons 5 160 0 160 150158 150159 150159 150160 150159
10 720 0 720 670715 670712 670717 670710 670711
Cmpd 5 250 27 223 110185 110170 110173 110177 110178
10 1125 57 1068 437862 437872 437852 437855 437851
Repaired test suites for 3-way criteria by genetic algorithm
Subject Length All
t-sets
Infeasible
t-sets
Feasible
t-sets
Run 1 Run 2 Run 3 Run 4 Run 5
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Reqs 5 270 64 206 156206 156206 156206 148206 156206
10 3240 349 2891 22032891 22032891 22032891 22032891 22032891
2Cons 5 270 36 234 169234 169234 169234 169234 169234
10 3240 216 3024 16273024 16963024 16963024 16963024 16963024
2Excl 5 270 70 200 126200 126200 126200 126200 126200
10 3240 840 2400 6402400 6402400 6402400 6402400 6402400
3Cons 5 640 3 637 610637 610637 610637 610637 610637
10 7680 8 7672 73307672 73307672 73307672 73067672 73307672
3Excl 5 1250 10 1240 11921240 11921240 11921240 11921240 11921240
10 15000 120 14880 1238614879 1241914880 1241914880 1241914880 1241914879
Cmpd 5 1250 263 987 598985 598985 598985 598985 598985
10 15000 1388 13612 719013610 719013610 719013610 713013610 711513612
Repaired test suites for 3-way criteria by random algorithm
Subject Length All
t-sets
Infeasible
t-sets
Feasible
t-sets
Run 1 Run 2 Run 3 Run 4 Run 5
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Initial
Cov.
Final
Cov.
Reqs 5 270 64 206 156192 156196 156195 156197 156193
10 3240 349 2891 22032712 22032693 22032728 22032703 22032716
2Cons 5 270 36 234 169202 169204 169203 161217 169218
10 3240 216 3024 16352576 16962592 16962570 16962629 16962608
2Excl 5 270 70 200 126167 126174 126174 126188 126190
10 3240 840 2400 6401751 6401747 6401708 6401781 6401891
3Cons 5 640 3 637 610624 610625 610624 610632 600633
10 7680 8 7672 73307565 73047551 73167552 73307556 73307559
3Excl 5 1250 10 1240 11921219 11921217 11921219 11851221 11921225
10 15000 120 14880 1241913992 1241913967 1241913967 1241913996 1241913978
Cmpd 5 1250 263 987 598784 598775 598781 598783 598784
Acknowledgments

We would like to thank Scott McMaster for providing us with the replayer modified for our experiments, and Mary Lou Soffa for early discussions on this work. This work was partially supported by the US National Science Foundation under grants CCF-0747009, CCF-0447864, CNS-0855139 and CNS-0855055, the Air Force Office of Scientific Research through award FA9550-09-1-0129, the Office of Naval Research grant N00014-05-1-0421 and by the Defense Advanced Research Projects Agency.