773 lines
30 KiB
HTML
Executable File
773 lines
30 KiB
HTML
Executable File
<?xml version="1.0" encoding="utf-8"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
|
||
<head>
|
||
<!-- 2025-12-28 Sun 20:49 -->
|
||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||
<title>ise_week_4</title>
|
||
<meta name="generator" content="Org Mode" />
|
||
<style type="text/css">
|
||
#content { max-width: 60em; margin: auto; }
|
||
.title { text-align: center;
|
||
margin-bottom: .2em; }
|
||
.subtitle { text-align: center;
|
||
font-size: medium;
|
||
font-weight: bold;
|
||
margin-top:0; }
|
||
.todo { font-family: monospace; color: red; }
|
||
.done { font-family: monospace; color: green; }
|
||
.priority { font-family: monospace; color: orange; }
|
||
.tag { background-color: #eee; font-family: monospace;
|
||
padding: 2px; font-size: 80%; font-weight: normal; }
|
||
.timestamp { color: #bebebe; }
|
||
.timestamp-kwd { color: #5f9ea0; }
|
||
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
|
||
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
|
||
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
|
||
.underline { text-decoration: underline; }
|
||
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
|
||
p.verse { margin-left: 3%; }
|
||
pre {
|
||
border: 1px solid #e6e6e6;
|
||
border-radius: 3px;
|
||
background-color: #f2f2f2;
|
||
padding: 8pt;
|
||
font-family: monospace;
|
||
overflow: auto;
|
||
margin: 1.2em;
|
||
}
|
||
pre.src {
|
||
position: relative;
|
||
overflow: auto;
|
||
}
|
||
pre.src:before {
|
||
display: none;
|
||
position: absolute;
|
||
top: -8px;
|
||
right: 12px;
|
||
padding: 3px;
|
||
color: #555;
|
||
background-color: #f2f2f299;
|
||
}
|
||
pre.src:hover:before { display: inline; margin-top: 14px;}
|
||
/* Languages per Org manual */
|
||
pre.src-asymptote:before { content: 'Asymptote'; }
|
||
pre.src-awk:before { content: 'Awk'; }
|
||
pre.src-authinfo::before { content: 'Authinfo'; }
|
||
pre.src-C:before { content: 'C'; }
|
||
/* pre.src-C++ doesn't work in CSS */
|
||
pre.src-clojure:before { content: 'Clojure'; }
|
||
pre.src-css:before { content: 'CSS'; }
|
||
pre.src-D:before { content: 'D'; }
|
||
pre.src-ditaa:before { content: 'ditaa'; }
|
||
pre.src-dot:before { content: 'Graphviz'; }
|
||
pre.src-calc:before { content: 'Emacs Calc'; }
|
||
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
|
||
pre.src-fortran:before { content: 'Fortran'; }
|
||
pre.src-gnuplot:before { content: 'gnuplot'; }
|
||
pre.src-haskell:before { content: 'Haskell'; }
|
||
pre.src-hledger:before { content: 'hledger'; }
|
||
pre.src-java:before { content: 'Java'; }
|
||
pre.src-js:before { content: 'Javascript'; }
|
||
pre.src-latex:before { content: 'LaTeX'; }
|
||
pre.src-ledger:before { content: 'Ledger'; }
|
||
pre.src-lisp:before { content: 'Lisp'; }
|
||
pre.src-lilypond:before { content: 'Lilypond'; }
|
||
pre.src-lua:before { content: 'Lua'; }
|
||
pre.src-matlab:before { content: 'MATLAB'; }
|
||
pre.src-mscgen:before { content: 'Mscgen'; }
|
||
pre.src-ocaml:before { content: 'Objective Caml'; }
|
||
pre.src-octave:before { content: 'Octave'; }
|
||
pre.src-org:before { content: 'Org mode'; }
|
||
pre.src-oz:before { content: 'OZ'; }
|
||
pre.src-plantuml:before { content: 'Plantuml'; }
|
||
pre.src-processing:before { content: 'Processing.js'; }
|
||
pre.src-python:before { content: 'Python'; }
|
||
pre.src-R:before { content: 'R'; }
|
||
pre.src-ruby:before { content: 'Ruby'; }
|
||
pre.src-sass:before { content: 'Sass'; }
|
||
pre.src-scheme:before { content: 'Scheme'; }
|
||
pre.src-screen:before { content: 'Gnu Screen'; }
|
||
pre.src-sed:before { content: 'Sed'; }
|
||
pre.src-sh:before { content: 'shell'; }
|
||
pre.src-sql:before { content: 'SQL'; }
|
||
pre.src-sqlite:before { content: 'SQLite'; }
|
||
/* additional languages in org.el's org-babel-load-languages alist */
|
||
pre.src-forth:before { content: 'Forth'; }
|
||
pre.src-io:before { content: 'IO'; }
|
||
pre.src-J:before { content: 'J'; }
|
||
pre.src-makefile:before { content: 'Makefile'; }
|
||
pre.src-maxima:before { content: 'Maxima'; }
|
||
pre.src-perl:before { content: 'Perl'; }
|
||
pre.src-picolisp:before { content: 'Pico Lisp'; }
|
||
pre.src-scala:before { content: 'Scala'; }
|
||
pre.src-shell:before { content: 'Shell Script'; }
|
||
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
|
||
/* additional language identifiers per "defun org-babel-execute"
|
||
in ob-*.el */
|
||
pre.src-cpp:before { content: 'C++'; }
|
||
pre.src-abc:before { content: 'ABC'; }
|
||
pre.src-coq:before { content: 'Coq'; }
|
||
pre.src-groovy:before { content: 'Groovy'; }
|
||
/* additional language identifiers from org-babel-shell-names in
|
||
ob-shell.el: ob-shell is the only babel language using a lambda to put
|
||
the execution function name together. */
|
||
pre.src-bash:before { content: 'bash'; }
|
||
pre.src-csh:before { content: 'csh'; }
|
||
pre.src-ash:before { content: 'ash'; }
|
||
pre.src-dash:before { content: 'dash'; }
|
||
pre.src-ksh:before { content: 'ksh'; }
|
||
pre.src-mksh:before { content: 'mksh'; }
|
||
pre.src-posh:before { content: 'posh'; }
|
||
/* Additional Emacs modes also supported by the LaTeX listings package */
|
||
pre.src-ada:before { content: 'Ada'; }
|
||
pre.src-asm:before { content: 'Assembler'; }
|
||
pre.src-caml:before { content: 'Caml'; }
|
||
pre.src-delphi:before { content: 'Delphi'; }
|
||
pre.src-html:before { content: 'HTML'; }
|
||
pre.src-idl:before { content: 'IDL'; }
|
||
pre.src-mercury:before { content: 'Mercury'; }
|
||
pre.src-metapost:before { content: 'MetaPost'; }
|
||
pre.src-modula-2:before { content: 'Modula-2'; }
|
||
pre.src-pascal:before { content: 'Pascal'; }
|
||
pre.src-ps:before { content: 'PostScript'; }
|
||
pre.src-prolog:before { content: 'Prolog'; }
|
||
pre.src-simula:before { content: 'Simula'; }
|
||
pre.src-tcl:before { content: 'tcl'; }
|
||
pre.src-tex:before { content: 'TeX'; }
|
||
pre.src-plain-tex:before { content: 'Plain TeX'; }
|
||
pre.src-verilog:before { content: 'Verilog'; }
|
||
pre.src-vhdl:before { content: 'VHDL'; }
|
||
pre.src-xml:before { content: 'XML'; }
|
||
pre.src-nxml:before { content: 'XML'; }
|
||
/* add a generic configuration mode; LaTeX export needs an additional
|
||
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
|
||
pre.src-conf:before { content: 'Configuration File'; }
|
||
|
||
table { border-collapse:collapse; }
|
||
caption.t-above { caption-side: top; }
|
||
caption.t-bottom { caption-side: bottom; }
|
||
td, th { vertical-align:top; }
|
||
th.org-right { text-align: center; }
|
||
th.org-left { text-align: center; }
|
||
th.org-center { text-align: center; }
|
||
td.org-right { text-align: right; }
|
||
td.org-left { text-align: left; }
|
||
td.org-center { text-align: center; }
|
||
dt { font-weight: bold; }
|
||
.footpara { display: inline; }
|
||
.footdef { margin-bottom: 1em; }
|
||
.figure { padding: 1em; }
|
||
.figure p { text-align: center; }
|
||
.equation-container {
|
||
display: table;
|
||
text-align: center;
|
||
width: 100%;
|
||
}
|
||
.equation {
|
||
vertical-align: middle;
|
||
}
|
||
.equation-label {
|
||
display: table-cell;
|
||
text-align: right;
|
||
vertical-align: middle;
|
||
}
|
||
.inlinetask {
|
||
padding: 10px;
|
||
border: 2px solid gray;
|
||
margin: 10px;
|
||
background: #ffffcc;
|
||
}
|
||
#org-div-home-and-up
|
||
{ text-align: right; font-size: 70%; white-space: nowrap; }
|
||
textarea { overflow-x: auto; }
|
||
.linenr { font-size: smaller }
|
||
.code-highlighted { background-color: #ffff00; }
|
||
.org-info-js_info-navigation { border-style: none; }
|
||
#org-info-js_console-label
|
||
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
|
||
.org-info-js_search-highlight
|
||
{ background-color: #ffff00; color: #000000; font-weight: bold; }
|
||
.org-svg { }
|
||
</style>
|
||
|
||
<link rel="stylesheet" href="/assets/styles/style.css" />
|
||
<link rel="stylesheet" href="/assets/styles/bigger-picture.min.css" />
|
||
<link rel="stylesheet" href="/assets/styles/media.css" />
|
||
|
||
<script src="/assets/scripts/script.js" defer></script>
|
||
<script src="/assets/scripts/search.js" defer></script>
|
||
<script src="/assets/scripts/bigger-picture.min.js" defer></script>
|
||
<script src="/assets/scripts/svg-pan-zoom.min.js" defer></script>
|
||
<script src="/assets/scripts/gallery-init.js" defer></script>
|
||
<script>
|
||
window.MathJax = {
|
||
tex: {
|
||
ams: {
|
||
multlineWidth: '85%'
|
||
},
|
||
tags: 'ams',
|
||
tagSide: 'right',
|
||
tagIndent: '.8em'
|
||
},
|
||
chtml: {
|
||
scale: 1.0,
|
||
displayAlign: 'center',
|
||
displayIndent: '0em'
|
||
},
|
||
svg: {
|
||
scale: 1.0,
|
||
displayAlign: 'center',
|
||
displayIndent: '0em'
|
||
},
|
||
output: {
|
||
font: 'mathjax-modern',
|
||
displayOverflow: 'overflow'
|
||
}
|
||
};
|
||
</script>
|
||
|
||
<script
|
||
id="MathJax-script"
|
||
async
|
||
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
|
||
</script>
|
||
</head>
|
||
<body>
|
||
<div id="preamble" class="status">
|
||
|
||
<div class="banner-header">
|
||
<div class="banner-left">
|
||
<a href="/20241210233721-brain_moc.html"> <img src="/assets/gr.png" alt="Site Logo" class="banner-logo" /> </a>
|
||
<div id="updated">Updated: 2025-12-28 Sun 19:48</div>
|
||
</div>
|
||
|
||
<div class="banner-search">
|
||
<input id="search-box"
|
||
type="search"
|
||
placeholder="Search notes…"
|
||
aria-label="Search notes"
|
||
autocomplete="off" />
|
||
<div id="search-results"></div>
|
||
</div>
|
||
|
||
<button id="close-all">Close All</button>
|
||
</div>
|
||
</div>
|
||
<div id="stack-root">
|
||
<div class="stack-track">
|
||
<article class="stack-pane pane-root" data-url="/20250329200158-ise_week_4.html">
|
||
<div id="content" class="content">
|
||
<div class="title-section">
|
||
<div class="title-controls">
|
||
<button class="pane-fullscreen" aria-label="Fullscreen">F</button>
|
||
<button class="pane-edit" aria-label="Edit pane">E</button>
|
||
<button class="pane-close" aria-label="Close pane">×</button>
|
||
</div>
|
||
<h1 class="title">ise<sub>week</sub><sub>4</sub></h1>
|
||
<div class="title-metadata">
|
||
<span class="metadata-item">
|
||
<span class="metadata-label">planted:</span>
|
||
<span class="metadata-value">2025-03-29</span>
|
||
</span>
|
||
<span class="metadata-item">
|
||
<span class="metadata-label">last tended to:</span>
|
||
<span class="metadata-value">2025-12-28</span>
|
||
</span>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org5bbf239" class="outline-2">
|
||
<h2 id="org5bbf239"><a href="#org5bbf239"><span class="done DONE">DONE</span> Different Coverage Metrics and Branch Concepts (pages 6-12)</a></h2>
|
||
</div>
|
||
<div id="outline-container-org2bf91f0" class="outline-2">
|
||
<h2 id="org2bf91f0"><a href="#org2bf91f0"><span class="done DONE">DONE</span> Evolutionary Algorithm (pages 24-32)</a></h2>
|
||
</div>
|
||
<div id="outline-container-orgb8f62f8" class="outline-2">
|
||
<h2 id="orgb8f62f8"><a href="#orgb8f62f8"><span class="done DONE">DONE</span> Test Case Generation (EvoSuite) (pages 44-55)</a></h2>
|
||
</div>
|
||
<div id="outline-container-orge3d2f9a" class="outline-2">
|
||
<h2 id="orge3d2f9a"><a href="#orge3d2f9a"><span class="done DONE">DONE</span> Multi/Many-objective Software Testing (Sapienz) (pages 80-97)</a></h2>
|
||
<div class="outline-text-2" id="text-orge3d2f9a">
|
||
<p>
|
||
want to figure out how to translate the real world phenotype to a genotype
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orgd2bc261" class="outline-2">
|
||
<h2 id="orgd2bc261"><a href="#orgd2bc261">4.2 Evolutionary Algorithms - Intelligent Software Engineering</a></h2>
|
||
<div class="outline-text-2" id="text-orgd2bc261">
|
||
</div>
|
||
<div id="outline-container-org1d9f9cb" class="outline-3">
|
||
<h3 id="org1d9f9cb"><a href="#org1d9f9cb">1. Illustrative Optimization Problem</a></h3>
|
||
<div class="outline-text-3" id="text-org1d9f9cb">
|
||
<ul class="org-ul">
|
||
<li>Problem: Maximize the objective function \( f(x) = x^2 \)</li>
|
||
<li>Design variable: \( x \in \{-15, -14, ..., 0, 1, ..., 15\} \)</li>
|
||
<li>Search space: All integers between -15 and 15 inclusive</li>
|
||
<li>Objective function: \( f(x) = x^2 \), to be maximized</li>
|
||
<li>Constraints: None</li>
|
||
<li>This problem is simple and allows us to demonstrate the application of evolutionary algorithms without involving additional complexity from constraints.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org9c83d1b" class="outline-3">
|
||
<h3 id="org9c83d1b"><a href="#org9c83d1b">2. Representation</a></h3>
|
||
<div class="outline-text-3" id="text-org9c83d1b">
|
||
<p>
|
||
Evolutionary algorithms operate on representations of solutions called genotypes, which map to actual solutions (phenotypes). The choice of representation is crucial and problem-dependent.
|
||
</p>
|
||
</div>
|
||
<div id="outline-container-org9d728e6" class="outline-4">
|
||
<h4 id="org9d728e6"><a href="#org9d728e6">Binary Representation</a></h4>
|
||
<div class="outline-text-4" id="text-org9d728e6">
|
||
<ul class="org-ul">
|
||
<li>The solution is represented as a fixed-length binary string.</li>
|
||
<li>For the example problem (maximizing \( f(x) = x^2 \)), we use a 5-bit binary representation:
|
||
<ul class="org-ul">
|
||
<li>The first bit indicates the sign of \( x \): 0 for positive, 1 for negative.</li>
|
||
<li>The remaining bits represent the magnitude in binary.</li>
|
||
</ul></li>
|
||
<li>The genotype space is \( \{0,1\}^L \), where L is the length of the binary string.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org8e49233" class="outline-4">
|
||
<h4 id="org8e49233"><a href="#org8e49233">Other Common Representations</a></h4>
|
||
<div class="outline-text-4" id="text-org8e49233">
|
||
<ul class="org-ul">
|
||
<li><b><b>Binary</b></b>: Suitable for many simple problems.</li>
|
||
<li><b><b>Integer</b></b>: Useful for categorical or discrete variables (e.g., car brands such as Toyota, Volkswagen, etc.).</li>
|
||
<li><b><b>Floating Point</b></b>: Used for problems with continuous variables. For example, optimizing \( f(x_1, x_2) = x_1 + x_2 \), where \( x_1, x_2 \in [0,1] \).</li>
|
||
<li><b><b>Permutations</b></b>: Suitable for ordering problems like the Traveling Salesman Problem.</li>
|
||
<li><b><b>Matrices</b></b>: Employed in more complex problems such as staff allocation or scheduling.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org95faefe" class="outline-3">
|
||
<h3 id="org95faefe"><a href="#org95faefe">3. Evolutionary Algorithm Steps</a></h3>
|
||
<div class="outline-text-3" id="text-org95faefe">
|
||
<p>
|
||
The typical steps in an evolutionary algorithm include:
|
||
</p>
|
||
|
||
<ol class="org-ol">
|
||
<li><b><b>Initialization</b></b>:
|
||
<ul class="org-ul">
|
||
<li>Start with a randomly generated population of candidate solutions.</li>
|
||
<li>Ensure a diverse set of individuals to explore the search space effectively.</li>
|
||
<li>Optionally include known solutions or use heuristics to seed the initial population.</li>
|
||
</ul></li>
|
||
|
||
<li><b><b>Evaluation</b></b>:
|
||
<ul class="org-ul">
|
||
<li>Each individual is evaluated using a fitness function.</li>
|
||
<li>The fitness function quantifies how well an individual performs with respect to the problem objective.</li>
|
||
</ul></li>
|
||
|
||
<li><p>
|
||
<b><b>Main Loop</b></b> (repeats until termination condition is met):
|
||
a. <b><b>Selection</b></b>:
|
||
</p>
|
||
<ul class="org-ul">
|
||
<li>Select parent individuals based on their fitness.</li>
|
||
<li>Higher fitness individuals have a higher chance of being selected.</li>
|
||
</ul>
|
||
|
||
<p>
|
||
b. <b><b>Recombination (Crossover)</b></b>:
|
||
</p>
|
||
<ul class="org-ul">
|
||
<li>Combine selected parents to produce new offspring.</li>
|
||
<li>Occurs with probability \( P_c \) (crossover probability).</li>
|
||
</ul>
|
||
|
||
<p>
|
||
c. <b><b>Mutation</b></b>:
|
||
</p>
|
||
<ul class="org-ul">
|
||
<li>Randomly alter offspring genes to maintain diversity.</li>
|
||
<li>Occurs with probability \( P_m \) (mutation probability).</li>
|
||
</ul>
|
||
|
||
<p>
|
||
d. <b><b>Evaluation of Offspring</b></b>:
|
||
</p>
|
||
<ul class="org-ul">
|
||
<li>Assess the fitness of each newly created individual.</li>
|
||
</ul>
|
||
|
||
<p>
|
||
e. <b><b>Survivor Selection</b></b>:
|
||
</p>
|
||
<ul class="org-ul">
|
||
<li>Decide which individuals (from parents and offspring) will make up the next generation.</li>
|
||
<li>Can use various strategies like elitism or generational replacement.</li>
|
||
</ul></li>
|
||
</ol>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org80dc091" class="outline-3">
|
||
<h3 id="org80dc091"><a href="#org80dc091">4. Fitness Function</a></h3>
|
||
<div class="outline-text-3" id="text-org80dc091">
|
||
<ul class="org-ul">
|
||
<li>The fitness function is derived from the problem’s objective or quality function.</li>
|
||
<li>It assigns a single real-valued score to each individual (phenotype).</li>
|
||
<li>The function reflects the degree to which a solution meets the desired criteria.</li>
|
||
<li>Typically, the aim is to <b><b>maximize</b></b> fitness.</li>
|
||
<li>If the problem is better posed as a minimization task, it can be transformed accordingly (e.g., minimizing \( f(x) \) is equivalent to maximizing \( -f(x) \)).</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org8c5c46d" class="outline-2">
|
||
<h2 id="org8c5c46d"><a href="#org8c5c46d">4.3 Test Case Generation using EvoSuite - Intelligent Software Engineering</a></h2>
|
||
<div class="outline-text-2" id="text-org8c5c46d">
|
||
</div>
|
||
<div id="outline-container-org5856127" class="outline-3">
|
||
<h3 id="org5856127"><a href="#org5856127">1. Introduction to EvoSuite</a></h3>
|
||
<div class="outline-text-3" id="text-org5856127">
|
||
<ul class="org-ul">
|
||
<li>EvoSuite is a tool developed by Fraser and Arcuri (2011) for automated test case generation.</li>
|
||
<li>It generates whole test suites (not just individual test cases) for a given software system.</li>
|
||
<li>The tool accepts a list of input classes to be tested and produces corresponding JUnit test case code.</li>
|
||
<li>It leverages <b><b>genetic algorithms</b></b>, a form of evolutionary computation, to evolve effective test suites.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org70324c2" class="outline-3">
|
||
<h3 id="org70324c2"><a href="#org70324c2">2. Motivation and Limitations of Traditional Methods</a></h3>
|
||
<div class="outline-text-3" id="text-org70324c2">
|
||
<ul class="org-ul">
|
||
<li>Conventional test generation tools typically focus on <b><b>single coverage goals</b></b> (e.g., a single program branch).</li>
|
||
<li>Assumes:
|
||
<ul class="org-ul">
|
||
<li>All coverage goals are equally important.</li>
|
||
<li>All goals are equally difficult to reach.</li>
|
||
<li>Goals are independent of each other.</li>
|
||
</ul></li>
|
||
<li>These assumptions are problematic:
|
||
<ul class="org-ul">
|
||
<li>The sequence in which goals are selected can significantly affect the quality of the resulting test suite.</li>
|
||
<li>Interdependencies among goals are often ignored.</li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
<div id="outline-container-org038fc64" class="outline-4">
|
||
<h4 id="org038fc64"><a href="#org038fc64">Solution:</a></h4>
|
||
<div class="outline-text-4" id="text-org038fc64">
|
||
<ul class="org-ul">
|
||
<li>Generate <b><b>whole test suites</b></b> rather than isolated test cases.</li>
|
||
<li>Takes into account relationships between methods/classes.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orgd97ff99" class="outline-3">
|
||
<h3 id="orgd97ff99"><a href="#orgd97ff99">3. Architecture and Representation</a></h3>
|
||
<div class="outline-text-3" id="text-orgd97ff99">
|
||
</div>
|
||
<div id="outline-container-orgfe7b811" class="outline-4">
|
||
<h4 id="orgfe7b811"><a href="#orgfe7b811">Test Suite Representation</a></h4>
|
||
<div class="outline-text-4" id="text-orgfe7b811">
|
||
<ul class="org-ul">
|
||
<li>A test suite \( T \) consists of multiple test cases.</li>
|
||
<li>Each <b><b>test case</b></b> is a sequence of statements of varying types and lengths.</li>
|
||
<li>The total length of a test suite is the sum of the lengths of its individual test cases.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orgf6d0e5f" class="outline-4">
|
||
<h4 id="orgf6d0e5f"><a href="#orgf6d0e5f">Statement Types in Test Cases</a></h4>
|
||
<div class="outline-text-4" id="text-orgf6d0e5f">
|
||
<ol class="org-ol">
|
||
<li><b><b>Primitive statements</b></b>: Initialize basic types (e.g., `int var0 = 54`)</li>
|
||
<li><b><b>Constructor statements</b></b>: Create new instances (e.g., `Stack var1 = new Stack()`)</li>
|
||
<li><b><b>Field statements</b></b>: Access object members (e.g., `int var2 = var1.size`)</li>
|
||
<li><b><b>Method statements</b></b>: Call methods (e.g., `int var3 = var1.pop()`)</li>
|
||
</ol>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org73e80f0" class="outline-3">
|
||
<h3 id="org73e80f0"><a href="#org73e80f0">4. Fitness Function</a></h3>
|
||
<div class="outline-text-3" id="text-org73e80f0">
|
||
<ul class="org-ul">
|
||
<li>Guides the <b><b>selection of parents</b></b> in the genetic algorithm.</li>
|
||
<li>Aims to <b><b>maximize code coverage</b></b>.</li>
|
||
<li>If two test suites achieve the same coverage, the one with fewer statements is preferred (parsimony).</li>
|
||
<li>Uses <b><b>branch coverage</b></b> as the primary metric.</li>
|
||
<li>Employs the <b><b>branch distance heuristic</b></b>:
|
||
<ul class="org-ul">
|
||
<li>Measures how close an input is to flipping a predicate’s boolean outcome.</li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orgd279d84" class="outline-3">
|
||
<h3 id="orgd279d84"><a href="#orgd279d84">5. Bloat Control</a></h3>
|
||
<div class="outline-text-3" id="text-orgd279d84">
|
||
<ul class="org-ul">
|
||
<li>A known issue in Genetic Algorithms is <b><b>bloat</b></b>, where test cases grow unnecessarily large.</li>
|
||
<li>Can lead to memory exhaustion and inefficiency.</li>
|
||
</ul>
|
||
</div>
|
||
<div id="outline-container-orga1d5e2f" class="outline-4">
|
||
<h4 id="orga1d5e2f"><a href="#orga1d5e2f">Techniques Used:</a></h4>
|
||
<div class="outline-text-4" id="text-orga1d5e2f">
|
||
<ul class="org-ul">
|
||
<li>Set limits:
|
||
<ul class="org-ul">
|
||
<li>Maximum number of test cases \( N \)</li>
|
||
<li>Maximum length per test case \( L \)</li>
|
||
</ul></li>
|
||
<li>Discard offspring that do not provide improved coverage.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org489def3" class="outline-3">
|
||
<h3 id="org489def3"><a href="#org489def3">6. Search Operators</a></h3>
|
||
<div class="outline-text-3" id="text-org489def3">
|
||
</div>
|
||
<div id="outline-container-orge95a449" class="outline-4">
|
||
<h4 id="orge95a449"><a href="#orge95a449">Crossover Operator</a></h4>
|
||
<div class="outline-text-4" id="text-orge95a449">
|
||
<ul class="org-ul">
|
||
<li>Combines two parent test suites (P1 and P2) to generate two offspring (O1 and O2).</li>
|
||
<li>O1 = first \( a \cdot |P1| \) test cases from P1 + remaining from P2.</li>
|
||
<li>O2 = similar combination from P2 and P1.</li>
|
||
<li>Valid since test cases are independent.</li>
|
||
<li>Helps reduce difference in length between resulting test suites.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org406d40c" class="outline-4">
|
||
<h4 id="org406d40c"><a href="#org406d40c">Mutation Operator</a></h4>
|
||
<div class="outline-text-4" id="text-org406d40c">
|
||
<ul class="org-ul">
|
||
<li>Mutation is applied with a probability of \( 1/T \), where \( T \) is the number of test cases.</li>
|
||
<li>New test cases may be added with a probability \( p \), up to a maximum count \( N \).</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org74087b9" class="outline-4">
|
||
<h4 id="org74087b9"><a href="#org74087b9">Mutation Operations (applied with equal probability 1/3):</a></h4>
|
||
<div class="outline-text-4" id="text-org74087b9">
|
||
<ol class="org-ol">
|
||
<li><b><b>Remove</b></b>:
|
||
<ul class="org-ul">
|
||
<li>Each statement \( s_i \) is deleted with probability \( 1/n \), where \( n \) is the number of statements.</li>
|
||
<li>If needed, replace deleted statements to keep test case valid.</li>
|
||
</ul></li>
|
||
|
||
<li><b><b>Change</b></b>:
|
||
<ul class="org-ul">
|
||
<li>Each statement \( s_i \) may be altered.</li>
|
||
<li>For primitives: change numeric value randomly within ±Δ.</li>
|
||
<li>For others: change to a method/field/constructor of the same type.</li>
|
||
</ul></li>
|
||
|
||
<li><b><b>Insert</b></b>:
|
||
<ul class="org-ul">
|
||
<li>A new statement is inserted at a random position in the test case.</li>
|
||
</ul></li>
|
||
</ol>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org38987d1" class="outline-3">
|
||
<h3 id="org38987d1"><a href="#org38987d1">7. Results and Evaluation</a></h3>
|
||
<div class="outline-text-3" id="text-org38987d1">
|
||
<ul class="org-ul">
|
||
<li>Key takeaway: <b><b>EvoSuite outperforms traditional single-goal test generation tools</b></b>.</li>
|
||
<li>Reported improvement: Up to <b><b>18x better branch coverage</b></b> than single-branch strategies.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org4d8ac43" class="outline-2">
|
||
<h2 id="org4d8ac43"><a href="#org4d8ac43">4.4 Multi/Many-objective Software Testing with Sapienz - Intelligent Software Engineering</a></h2>
|
||
<div class="outline-text-2" id="text-org4d8ac43">
|
||
</div>
|
||
<div id="outline-container-org2ed8809" class="outline-3">
|
||
<h3 id="org2ed8809"><a href="#org2ed8809">1. Introduction to Sapienz</a></h3>
|
||
<div class="outline-text-3" id="text-org2ed8809">
|
||
<ul class="org-ul">
|
||
<li>Sapienz is an automated software testing tool developed by Mao et al. (2016).</li>
|
||
<li>It uses evolutionary algorithms to generate test cases for Android apps.</li>
|
||
<li>Notable Achievements:
|
||
<ul class="org-ul">
|
||
<li>Tested the top 1000 most popular Google Play apps.</li>
|
||
<li>Discovered 558 unique and previously unknown app crashes.</li>
|
||
<li>Led to a commercial spinout company named <b><b>MaJiCkE</b></b>.</li>
|
||
<li>Acquired by <b><b>Facebook/Meta</b></b>.</li>
|
||
</ul></li>
|
||
|
||
<li>Sapienz customizes the <b><b>NSGA-II</b></b> algorithm (a multi-objective genetic algorithm) for test case generation.</li>
|
||
</ul>
|
||
|
||
<p>
|
||
Reference: Mao, Ke, Mark Harman, and Yue Jia. <b>“Sapienz: Multi-objective automated testing for android applications.”</b> ISSTA 2016.
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org9fde7af" class="outline-3">
|
||
<h3 id="org9fde7af"><a href="#org9fde7af">2. NSGA-II: An Overview</a></h3>
|
||
<div class="outline-text-3" id="text-org9fde7af">
|
||
<ul class="org-ul">
|
||
<li>NSGA-II is a Genetic Algorithm (GA) adapted for <b><b>multi-objective optimization</b></b>.</li>
|
||
<li>Key Differences from standard GA:
|
||
<ul class="org-ul">
|
||
<li>Uses <b><b>Pareto dominance</b></b> for survival selection.</li>
|
||
<li>A solution <b><b>a dominates</b></b> solution <b><b>b</b></b> if:
|
||
<ul class="org-ul">
|
||
<li>\( a_i \leq b_i \) for all objectives, and</li>
|
||
<li>\( \exists j \) such that \( a_j < b_j \)</li>
|
||
</ul></li>
|
||
<li>A <b><b>Pareto optimal</b></b> solution is one that is not dominated by any other in the population.</li>
|
||
</ul></li>
|
||
|
||
<li>NSGA-II also uses:
|
||
<ul class="org-ul">
|
||
<li><b><b>Non-dominated sorting</b></b>: Separates population into Pareto fronts.</li>
|
||
<li><b><b>Crowding distance</b></b>: Prefers diverse solutions within the same front.</li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orge5fcd37" class="outline-3">
|
||
<h3 id="orge5fcd37"><a href="#orge5fcd37">3. Representation</a></h3>
|
||
<div class="outline-text-3" id="text-orge5fcd37">
|
||
<ul class="org-ul">
|
||
<li>Specific representation details were not included in the slides but are tailored to represent Android GUI interaction sequences.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org74c5378" class="outline-3">
|
||
<h3 id="org74c5378"><a href="#org74c5378">4. Objective Functions in Sapienz</a></h3>
|
||
<div class="outline-text-3" id="text-org74c5378">
|
||
<p>
|
||
Sapienz optimizes multiple objectives simultaneously:
|
||
</p>
|
||
</div>
|
||
<div id="outline-container-org3ca1c7d" class="outline-4">
|
||
<h4 id="org3ca1c7d"><a href="#org3ca1c7d">a. Code Coverage</a></h4>
|
||
<div class="outline-text-4" id="text-org3ca1c7d">
|
||
<ul class="org-ul">
|
||
<li>Types of coverage used:
|
||
<ul class="org-ul">
|
||
<li><b><b>Statement Coverage</b></b>: Measures how many individual code statements are executed.</li>
|
||
<li><b><b>Method Coverage</b></b>: Measures the number of methods invoked.</li>
|
||
<li><b><b>Android Activity Coverage</b></b>: Tracks which screens (activities) of the app are accessed.
|
||
<ul class="org-ul">
|
||
<li>Example: A dialer app may include separate activities for contacts, keypad, call history, etc.</li>
|
||
</ul></li>
|
||
</ul></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org7ec352d" class="outline-4">
|
||
<h4 id="org7ec352d"><a href="#org7ec352d">b. Test Case Length</a></h4>
|
||
<div class="outline-text-4" id="text-org7ec352d">
|
||
<ul class="org-ul">
|
||
<li>Shorter test cases are generally preferred to improve efficiency and reduce overhead.</li>
|
||
<li>Multiple slides (86–89) emphasize the importance of minimizing test length.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orga0794d3" class="outline-4">
|
||
<h4 id="orga0794d3"><a href="#orga0794d3">c. Crash Discovery</a></h4>
|
||
<div class="outline-text-4" id="text-orga0794d3">
|
||
<ul class="org-ul">
|
||
<li>The number of test cases that lead to app crashes is also a key metric.</li>
|
||
<li>Objective: Maximize the number of crash-inducing test cases.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-org4f9c987" class="outline-3">
|
||
<h3 id="org4f9c987"><a href="#org4f9c987">5. Search Operators</a></h3>
|
||
<div class="outline-text-3" id="text-org4f9c987">
|
||
</div>
|
||
<div id="outline-container-org8b46a41" class="outline-4">
|
||
<h4 id="org8b46a41"><a href="#org8b46a41">a. Crossover</a></h4>
|
||
<div class="outline-text-4" id="text-org8b46a41">
|
||
<ul class="org-ul">
|
||
<li>Combines parts of two parent test sequences to form new offspring.</li>
|
||
<li>Details of the crossover structure are tool-specific but follow the typical GA-style recombination.</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orge31bd90" class="outline-4">
|
||
<h4 id="orge31bd90"><a href="#orge31bd90">b. Mutation</a></h4>
|
||
<div class="outline-text-4" id="text-orge31bd90">
|
||
<ul class="org-ul">
|
||
<li>Mutations are applied to test cases to explore new behaviors.</li>
|
||
<li>Types of Mutation:
|
||
|
||
<ol class="org-ol">
|
||
<li><b><b>High-Level Mutation</b></b>:
|
||
<ul class="org-ul">
|
||
<li>Alters the structure or intent of test sequences.</li>
|
||
</ul></li>
|
||
|
||
<li><b><b>Low-Level Mutation (Same Size)</b></b>:
|
||
<ul class="org-ul">
|
||
<li>Changes test actions without altering the sequence length.</li>
|
||
</ul></li>
|
||
|
||
<li><b><b>Low-Level Mutation (Different Size)</b></b>:
|
||
<ul class="org-ul">
|
||
<li>Adds or removes actions to vary the length of test cases.</li>
|
||
</ul></li>
|
||
|
||
<li><b><b>Low-Level Mutation (Shuffling)</b></b>:
|
||
<ul class="org-ul">
|
||
<li>Reorders existing actions in the test case.</li>
|
||
</ul></li>
|
||
</ol></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="outline-container-orgd727132" class="outline-3">
|
||
<h3 id="orgd727132"><a href="#orgd727132">6. Results and Observations</a></h3>
|
||
<div class="outline-text-3" id="text-orgd727132">
|
||
<ul class="org-ul">
|
||
<li>Sapienz significantly <b><b>outperforms other automated testing tools</b></b> in terms of:
|
||
<ul class="org-ul">
|
||
<li>Number of crashes detected.</li>
|
||
<li>Coverage achieved.</li>
|
||
<li>Efficiency in test generation.</li>
|
||
</ul></li>
|
||
</ul>
|
||
|
||
|
||
|
||
<p class="backlinks-section" id="backlinks">
|
||
Backlinks
|
||
</p>
|
||
<ul class="org-ul backlinks-list">
|
||
<li><a href="20250329114733-ise.html#ID-c69e4c4d-2fb4-4cf1-a835-a235cf6db8e9">ise</a></li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div></article></div></div>
|
||
<div id="postamble" class="status">
|
||
<footer>
|
||
<div class="copyright-container">
|
||
<div class="copyright">
|
||
Copyright © 2022-2025 Zaine Qayyum. All rights reserved unless otherwise noted.</div></div>
|
||
<div class="generated">
|
||
Created with <a href="https://www.gnu.org/software/emacs/">Emacs</a> 30.2 (<a href="https://orgmode.org">Org</a> mode 9.7.11) on <a href="https://www.archlinux.org/">Arch</a> <a href="https://www.gnu.org">GNU</a>/<a href="https://www.kernel.org/">Linux</a>
|
||
</div>
|
||
</footer>
|
||
</div>
|
||
</body>
|
||
</html>
|