![Page 1: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/1.jpg)
White-Box Software Testing using Evolutionary Algorithms
Yaser Sulaiman
1
![Page 2: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/2.jpg)
Time for a break!
2
![Page 4: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/4.jpg)
White-box testing
4
![Page 6: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/6.jpg)
Test adequacy criteria
6
![Page 7: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/7.jpg)
Statement
8
Branch
Condition Path
Weakest
Strongest
![Page 8: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/8.jpg)
Coming up with test cases/data isn’t as easy as it sounds
9
![Page 10: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/10.jpg)
Cover as much as you can!
11
![Page 12: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/12.jpg)
Looks like an optimization problem.. sort of
13
![Page 13: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/13.jpg)
So how about automating it?
14
![Page 14: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/14.jpg)
Evolutionary algorithms
15
![Page 15: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/15.jpg)
16 photo by ][\/][
![Page 16: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/16.jpg)
Evolutionary Algorithms
Genetic Algorithms
(GA)
Genetic Programming
(GP)
17
![Page 17: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/17.jpg)
GA
18
![Page 18: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/18.jpg)
Chromosomes
19
Selection Fitness
Function
Crossover Mutation
![Page 19: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/19.jpg)
GP
20
![Page 20: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/20.jpg)
Specialization of GA
21
![Page 21: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/21.jpg)
Where individuals represent computer programs
22
![Page 22: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/22.jpg)
GP evolves programs!
23
![Page 24: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/24.jpg)
Mathematically speaking
25
![Page 25: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/25.jpg)
Given a set of inputs 𝑋 and outputs 𝑌, a program 𝑝 is sought which
satisfies
𝑌 = 𝑝(𝑋)
26
![Page 26: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/26.jpg)
Fitness of a candidate program?
27
![Page 27: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/27.jpg)
𝑌𝑒𝑥𝑝 Expected output
vs.
𝑌𝑝 = 𝑝(𝑋) Actual output
28
![Page 28: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/28.jpg)
𝑓 𝑝 = 𝑝 𝑥𝑖 − 𝑦𝑒𝑥𝑝𝑖2
𝑋
𝑖=1
where 𝑥 ∈ 𝑋 and 𝑦𝑒𝑥𝑝 ∈ 𝑌𝑒𝑥𝑝
29
![Page 29: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/29.jpg)
Moving on to the surveyed papers
30
![Page 30: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/30.jpg)
Brendt* 2002
Tonella 2004
Wappler* 2006
Ahmed* 2008
31 * et al.
![Page 31: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/31.jpg)
Brendt* 2002
Tonella 2004
Wappler* 2006
Ahmed* 2008
32 * et al.
![Page 32: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/32.jpg)
“Breeding software test cases with genetic algorithms”
33
![Page 33: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/33.jpg)
“Breeding software test cases with genetic algorithms”
34
![Page 34: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/34.jpg)
Fossil record
35
![Page 35: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/35.jpg)
Relative fitness function
36
![Page 36: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/36.jpg)
37 Berndt et al. (2002)
![Page 37: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/37.jpg)
3 factors affect the fitness function
38
![Page 38: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/38.jpg)
1. Novelty
measure of uniqueness
39
![Page 39: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/39.jpg)
2. Proximity
measure of closeness
40
![Page 40: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/40.jpg)
3. Severity
measure of seriousness
41
![Page 41: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/41.jpg)
“simple rules, complex behavior”
42
![Page 42: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/42.jpg)
Explorers, prospectors, and miners
43
![Page 43: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/43.jpg)
Brendt* 2002
Tonella 2004
Wappler* 2006
Ahmed* 2008
44 * et al.
![Page 44: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/44.jpg)
“Evolutionary testing of classes”
45
![Page 45: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/45.jpg)
“Evolutionary testing of classes”
46
![Page 46: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/46.jpg)
Object-oriented testing
47
![Page 47: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/47.jpg)
Class Under Test (CUT) &
Method Under Test (MUT)
48
![Page 48: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/48.jpg)
Sequence of object constructions & method calls
49
![Page 49: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/49.jpg)
Tonella (2004) focuses on representation and operators
50
![Page 50: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/50.jpg)
A chromosome isn’t just a sequence of input values anymore
51
![Page 51: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/51.jpg)
$a=A():$b=B():$a.m(int, $b) @ 3
52
![Page 52: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/52.jpg)
Brendt* 2002
Tonella 2004
Wappler* 2006
Ahmed* 2008
53 * et al.
![Page 53: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/53.jpg)
“Evolutionary unit testing of object-oriented software using strongly-
typed genetic programming”
54
![Page 54: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/54.jpg)
“Evolutionary unit testing of object-oriented software using strongly-
typed genetic programming”
55
![Page 55: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/55.jpg)
GP that is type-aware
56
![Page 56: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/56.jpg)
Wappler & Wegener (2006) focus on call sequence feasibility
57
![Page 57: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/57.jpg)
58 Wappler & Wegener (2006)
![Page 58: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/58.jpg)
Method Call Dependence Graph (MCDG)
59
![Page 59: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/59.jpg)
60 Wappler & Wegener (2006)
![Page 60: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/60.jpg)
A sequence is feasible if it corresponds to an acyclic subgraph
of the MCDG
61
![Page 61: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/61.jpg)
62 Wappler & Wegener (2006)
![Page 62: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/62.jpg)
Brendt* 2002
Tonella 2004
Wappler* 2006
Ahmed* 2008
63 * et al.
![Page 63: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/63.jpg)
“GA-based multiple paths test data generator”
64
![Page 64: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/64.jpg)
“GA-based multiple paths test data generator”
65
![Page 65: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/65.jpg)
Ahmed & Hermadi (2008) focus on the efficiency of test data generation
66
![Page 66: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/66.jpg)
Generating multiple test data to cover multiple target paths in one
GA run
67
![Page 67: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/67.jpg)
Requires incorporating the paths within the fitness calculation
68
![Page 68: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/68.jpg)
// TODO: Redigest the paper.
69
![Page 69: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/69.jpg)
Let’s compare the surveyed papers
70
![Page 70: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/70.jpg)
71
Paper Evolutionary
Algorithm Object-
Oriented Coverage Criterion
Berndt et al. (2002)
GA Branch
Tonella (2004)
GA Branch
Wappler & Wegener (2006)
Strongly-Typed GP Branch
Ahmed & Hermadi (2008)
GA Path
![Page 71: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/71.jpg)
A direction for future work
72
![Page 72: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/72.jpg)
The reverse direction
73
![Page 73: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/73.jpg)
74
Program Evolutionary
Algorithm Test Cases
![Page 74: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/74.jpg)
75
Program Evolutionary
Algorithm Test Cases
![Page 75: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/75.jpg)
Writing test cases first?
76
![Page 76: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/76.jpg)
It’s called TDD
77
![Page 79: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/79.jpg)
TDD + GP isn’t a new idea
80
![Page 81: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/81.jpg)
Take-home messages
82
![Page 82: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/82.jpg)
Generating test cases can be challenging
83
![Page 83: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/83.jpg)
Testing object-oriented software provides even more challenges
84
![Page 84: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/84.jpg)
Evolutionary algorithms can be used to solve [some of] these
problems
85
![Page 85: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/85.jpg)
Even software developers turn to Mother Nature for inspiration
86
![Page 86: White-Box Software Testing using Evolutionary Algorithms](https://reader033.vdocuments.site/reader033/viewer/2022052820/5481bf43b47959fb0c8b45f1/html5/thumbnails/86.jpg)
…</presentation> <questions>…
88