Added phase 05 project template

This commit is contained in:
Michael Chen 2022-07-04 13:49:43 +02:00
parent 56d0a7df53
commit 7c93ab7f20
No known key found for this signature in database
GPG Key ID: 1CBC7AA5671437BB
7 changed files with 1073 additions and 0 deletions

View File

@ -0,0 +1,306 @@
Solution_Phase*_*.pdf
Solution_Phase*_*.zip
*.result.txt
output.txt
## Core latex/pdflatex auxiliary files:
*.aux
*.lof
*.log
*.lot
*.fls
*.out
*.toc
*.fmt
*.fot
*.cb
*.cb2
.*.lb
## Intermediate documents:
*.dvi
*.xdv
*-converted-to.*
# these rules might exclude image files for figures etc.
# *.ps
# *.eps
# *.pdf
## Generated if empty string is given at "Please type another file name for output:"
.pdf
## Bibliography auxiliary files (bibtex/biblatex/biber):
*.bbl
*.bcf
*.blg
*-blx.aux
*-blx.bib
*.run.xml
## Build tool auxiliary files:
*.fdb_latexmk
*.synctex
*.synctex(busy)
*.synctex.gz
*.synctex.gz(busy)
*.pdfsync
## Build tool directories for auxiliary files
# latexrun
latex.out/
## Auxiliary and intermediate files from other packages:
# algorithms
*.alg
*.loa
# achemso
acs-*.bib
# amsthm
*.thm
# beamer
*.nav
*.pre
*.snm
*.vrb
# changes
*.soc
# comment
*.cut
# cprotect
*.cpt
# elsarticle (documentclass of Elsevier journals)
*.spl
# endnotes
*.ent
# fixme
*.lox
# feynmf/feynmp
*.mf
*.mp
*.t[1-9]
*.t[1-9][0-9]
*.tfm
#(r)(e)ledmac/(r)(e)ledpar
*.end
*.?end
*.[1-9]
*.[1-9][0-9]
*.[1-9][0-9][0-9]
*.[1-9]R
*.[1-9][0-9]R
*.[1-9][0-9][0-9]R
*.eledsec[1-9]
*.eledsec[1-9]R
*.eledsec[1-9][0-9]
*.eledsec[1-9][0-9]R
*.eledsec[1-9][0-9][0-9]
*.eledsec[1-9][0-9][0-9]R
# glossaries
*.acn
*.acr
*.glg
*.glo
*.gls
*.glsdefs
*.lzo
*.lzs
*.slg
*.slo
*.sls
# uncomment this for glossaries-extra (will ignore makeindex's style files!)
# *.ist
# gnuplot
*.gnuplot
*.table
# gnuplottex
*-gnuplottex-*
# gregoriotex
*.gaux
*.glog
*.gtex
# htlatex
*.4ct
*.4tc
*.idv
*.lg
*.trc
*.xref
# hyperref
*.brf
# knitr
*-concordance.tex
# TODO Uncomment the next line if you use knitr and want to ignore its generated tikz files
# *.tikz
*-tikzDictionary
# listings
*.lol
# luatexja-ruby
*.ltjruby
# makeidx
*.idx
*.ilg
*.ind
# minitoc
*.maf
*.mlf
*.mlt
*.mtc[0-9]*
*.slf[0-9]*
*.slt[0-9]*
*.stc[0-9]*
# minted
_minted*
*.pyg
# morewrites
*.mw
# newpax
*.newpax
# nomencl
*.nlg
*.nlo
*.nls
# pax
*.pax
# pdfpcnotes
*.pdfpc
# sagetex
*.sagetex.sage
*.sagetex.py
*.sagetex.scmd
# scrwfile
*.wrt
# svg
svg-inkscape/
# sympy
*.sout
*.sympy
sympy-plots-for-*.tex/
# pdfcomment
*.upa
*.upb
# pythontex
*.pytxcode
pythontex-files-*/
# tcolorbox
*.listing
# thmtools
*.loe
# TikZ & PGF
*.dpth
*.md5
*.auxlock
# titletoc
*.ptc
# todonotes
*.tdo
# vhistory
*.hst
*.ver
# easy-todo
*.lod
# xcolor
*.xcp
# xmpincl
*.xmpi
# xindy
*.xdy
# xypic precompiled matrices and outlines
*.xyc
*.xyd
# endfloat
*.ttt
*.fff
# Latexian
TSWLatexianTemp*
## Editors:
# WinEdt
*.bak
*.sav
# Texpad
.texpadtmp
# LyX
*.lyx~
# Kile
*.backup
# gummi
.*.swp
# KBibTeX
*~[0-9]*
# TeXnicCenter
*.tps
# auto folder when using emacs and auctex
./auto/*
*.el
# expex forward references with \gathertags
*-tags.tex
# standalone packages
*.sta
# Makeindex log files
*.lpz
# xwatermark package
*.xwm
# REVTeX puts footnotes in the bibliography by default, unless the nofootinbib
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
# Uncomment the next line to have this generated file ignored.
#*Notes.bib

View File

@ -0,0 +1,59 @@
public final class Duration {
public static final Duration ZERO = new Duration(0, 0);
static final int MINUTES_PER_HOUR = 60;
static final int SECONDS_PER_MINUTE = 60;
static final int SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR;
static final long NANOS_PER_SECOND = 1000_000_000L;
private final long seconds;
private final int nanos;
public Duration(long seconds, int nanos) {
this.seconds = seconds;
this.nanos = nanos;
}
@Override
public String toString() {
if (this == ZERO) {
return "PT0S";
}
long hours = seconds / SECONDS_PER_HOUR;
int minutes = (int) ((seconds % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE);
int secs = (int) (seconds % SECONDS_PER_MINUTE);
StringBuilder buf = new StringBuilder(24);
buf.append("PT");
if (hours != 0) {
buf.append(hours).append('H');
}
if (minutes != 0) {
buf.append(minutes).append('M');
}
if (secs == 0 && nanos == 0 && buf.length() > 2) {
return buf.toString();
}
if (secs < 0 && nanos > 0) {
if (secs == -1) {
buf.append("-0");
} else {
buf.append(secs + 1);
}
} else {
buf.append(secs);
}
if (nanos > 0) {
int pos = buf.length();
if (secs < 0) {
buf.append(2 * NANOS_PER_SECOND - nanos);
} else {
buf.append(nanos + NANOS_PER_SECOND);
}
while (buf.charAt(buf.length() - 1) == '0') {
buf.setLength(buf.length() - 1);
}
buf.setCharAt(pos, '.');
}
buf.append('S');
return buf.toString();
}
}

View File

@ -0,0 +1,21 @@
phase = 05
version = 1
name = MichaelChen
solutionname = Solution_Phase$(phase)_$(name)
target = $(solutionname)_V$(version).zip
package = $(solutionname).pdf Duration.java Mutation_Testing_Sample_Model.xml
latexmkflags =
.PHONY : all dev
all : $(target)
dev : latexmkflags = -pvc
dev : all
$(target) : $(package)
zip -FSr $(target) $(package)
%.pdf : %.tex
latexmk -jobname="$*" $(latexmkflags) -pdf $<

View File

@ -0,0 +1,228 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE nta PUBLIC '-//Uppaal Team//DTD Flat System 1.1//EN' 'http://www.it.uu.se/research/group/darts/uppaal/flat-1_2.dtd'>
<nta>
<declaration>// Place global declarations here.
// As input to your method / class model, you can use either...
typedef int[-25,25] cust_t; // ... a custom integer type which is restricted to a certain value range...
const int list_size = 4; // ...or a fixed number of given values...
int values[list_size] = {-1, 0, 1, 300}; // ... which are defined in this array ...
typedef int[0,list_size-1] index_t; // ... and are indexed inside the model via this index type.
broadcast chan initialized; // The broadcast channel assures that the initial variable assignment in the method / class model is synchronized
// with the completion of the value generation (e.g. of InputFromRange or InputFromList)
int x_in = 0; // These variables globally hold the initial input values to the method / class model
int y_in = 0;</declaration>
<template>
<name>InputFromRange</name>
<location id="id0" x="-238" y="-204">
</location>
<location id="id1" x="-671" y="-204">
<urgent/>
</location>
<location id="id2" x="-434" y="-205">
<urgent/>
</location>
<init ref="id1"/>
<transition>
<source ref="id2"/>
<target ref="id0"/>
<label kind="synchronisation" x="-382" y="-229">initialized!</label>
</transition>
<transition>
<source ref="id1"/>
<target ref="id2"/>
<label kind="select" x="-637" y="-238">xi : cust_t, yi : cust_t</label>
<label kind="assignment" x="-620" y="-187">x_in = xi, y_in = yi</label>
</transition>
</template>
<template>
<name>InputFromList</name>
<location id="id3" x="42" y="8">
<urgent/>
</location>
<location id="id4" x="238" y="9">
</location>
<location id="id5" x="-195" y="8">
<urgent/>
</location>
<init ref="id5"/>
<transition>
<source ref="id3"/>
<target ref="id4"/>
<label kind="synchronisation" x="94" y="-16">initialized!</label>
</transition>
<transition>
<source ref="id5"/>
<target ref="id3"/>
<label kind="select" x="-178" y="-25">ind_x : index_t, ind_y : index_t</label>
<label kind="assignment" x="-204" y="26">x_in = values[ind_x], y_in = values[ind_y]</label>
</transition>
</template>
<template>
<name x="5" y="5">SetEqual</name>
<declaration>// Place local declarations here.
int x = 0;
int y = 0;</declaration>
<location id="id6" x="297" y="-34">
<name x="287" y="-68">End</name>
</location>
<location id="id7" x="178" y="25">
<name x="168" y="-9">B</name>
</location>
<location id="id8" x="178" y="-102">
<name x="170" y="-85">A</name>
</location>
<location id="id9" x="51" y="-34">
</location>
<location id="id10" x="-161" y="-33">
<name x="-171" y="-67">Init</name>
<urgent/>
</location>
<init ref="id10"/>
<transition>
<source ref="id7"/>
<target ref="id6"/>
<label kind="guard" x="221" y="8">!(x&lt;y)</label>
</transition>
<transition>
<source ref="id7"/>
<target ref="id7"/>
<label kind="guard" x="161" y="68">x&lt;y</label>
<label kind="assignment" x="161" y="102">x=x+1</label>
<nail x="238" y="93"/>
<nail x="102" y="93"/>
</transition>
<transition>
<source ref="id8"/>
<target ref="id8"/>
<label kind="guard" x="161" y="-204">x&gt;y</label>
<label kind="assignment" x="153" y="-170">x=x-1</label>
<nail x="246" y="-178"/>
<nail x="93" y="-178"/>
</transition>
<transition>
<source ref="id8"/>
<target ref="id6"/>
<label kind="guard" x="221" y="-93">!(x&gt;y)</label>
</transition>
<transition>
<source ref="id9"/>
<target ref="id7"/>
<label kind="guard" x="76" y="0">x&lt;y</label>
</transition>
<transition>
<source ref="id9"/>
<target ref="id8"/>
<label kind="guard" x="76" y="-93">x&gt;=y</label>
</transition>
<transition>
<source ref="id10"/>
<target ref="id9"/>
<label kind="synchronisation" x="-102" y="-59">initialized?</label>
<label kind="assignment" x="-119" y="-25">x = x_in, y = y_in</label>
</transition>
</template>
<template>
<name>SetEqualMutant</name>
<declaration>// Place local declarations here.
int x = 0;
int y = 0;</declaration>
<location id="id11" x="144" y="51">
<name x="134" y="17">B</name>
</location>
<location id="id12" x="263" y="-8">
<name x="253" y="-42">End</name>
</location>
<location id="id13" x="144" y="-76">
<name x="136" y="-59">A</name>
</location>
<location id="id14" x="17" y="-8">
</location>
<location id="id15" x="-195" y="-7">
<name x="-205" y="-41">Init</name>
<urgent/>
</location>
<init ref="id15"/>
<transition>
<source ref="id14"/>
<target ref="id12"/>
<label kind="guard" x="119" y="-34">x&gt;=y</label>
</transition>
<transition>
<source ref="id11"/>
<target ref="id12"/>
<label kind="guard" x="187" y="34">!(x&lt;y)</label>
</transition>
<transition>
<source ref="id11"/>
<target ref="id11"/>
<label kind="guard" x="127" y="94">x&lt;y</label>
<label kind="assignment" x="127" y="128">x=x+1</label>
<nail x="204" y="119"/>
<nail x="68" y="119"/>
</transition>
<transition>
<source ref="id13"/>
<target ref="id13"/>
<label kind="guard" x="127" y="-178">x&gt;y</label>
<label kind="assignment" x="119" y="-144">x=x-1</label>
<nail x="212" y="-152"/>
<nail x="59" y="-152"/>
</transition>
<transition>
<source ref="id13"/>
<target ref="id12"/>
<label kind="guard" x="187" y="-67">!(x&gt;y)</label>
</transition>
<transition>
<source ref="id14"/>
<target ref="id11"/>
<label kind="guard" x="42" y="26">x&lt;y</label>
</transition>
<transition>
<source ref="id15"/>
<target ref="id14"/>
<label kind="synchronisation" x="-136" y="-34">initialized?</label>
<label kind="assignment" x="-153" y="0">x = x_in, y = y_in</label>
</transition>
</template>
<system>// Place template instantiations here.
SE = SetEqual(); // The instance of the original model
SE_MUT = SetEqualMutant(); // The instance of the mutated model
IN_RANGE = InputFromRange(); // Use this template in the system definition below if you want take input values from an integer range...
IN_LIST = InputFromList(); // ...or this if you want to provide a predefined list of possible / probable / common input values
// List one or more processes to be composed into a system.
system IN_RANGE, SE, SE_MUT;</system>
<queries>
<query>
<formula>A[] (SE.End &amp;&amp; SE_MUT.End) imply (SE.x == SE_MUT.x &amp;&amp; SE.y == SE_MUT.y)
</formula>
<comment>This formula can be used to compare the results and/or states of the original and the mutated template.
In this example, it covers the requirement that for all paths (A), all states on that individual path ([]) should satisfy that if the locations "SE.End" and "SE_MUT.End" are active (meaning that both instances reached the final state),
the x and y values of the original model template should be equal to the corresponding values of the mutated template.
(Note: "SE.End" represents the "End" location of the template instance for the method / class as named in the "System declarations" section)
</comment>
</query>
<query>
<formula>A[] SE.End imply (SE.x == SE.y)
</formula>
<comment>This formula covers the requirement that for all paths (A), all states on that individual path ([]) should satisfy that if the location "SE.End" is active, the x and y values of that template instance (SE.x, SE.y) must be equal.
(Note: "SE.End" represents the "End" location of the template instance for the method / class as named in the "System declarations" section)
</comment>
</query>
<query>
<formula>A[] SE.End imply (SE.y == y_in)
</formula>
<comment>This formula covers the requirement that for all paths (A), all states on that individual path ([]) should satisfy that if the location "SE.End" is active, the y value of the template instance (SE.y) must still be equal to the input value y_in.
Of course, you can even be more strict with this property, and adapt it so that "SE.y" should remain unchanged in every single state along the algorithm execution.
(Note: "SE.End" represents the "End" location of the template instance for the method / class as named in the "System declarations" section)
</comment>
</query>
</queries>
</nta>

View File

@ -0,0 +1,228 @@
\documentclass[a4paper]{scrreprt}
\usepackage[left=4cm,bottom=3cm,top=3cm,right=4cm,nohead,nofoot]{geometry}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{listings}
\usepackage{enumitem}
\usepackage{subcaption}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
\usepackage{xparse}
\usepackage{multirow}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{\textfloatsep}{16pt}
\renewcommand{\labelenumi}{\alph{enumi})}
\renewcommand{\labelenumii}{\arabic{enumii}) }
\newcommand{\baseinfo}[5]{
\begin{center}
\begin{tabular}{p{15cm}r}
\vspace{-4.5pt}{ \Large \bfseries #1} & \multirow{2}{*}{} \\[0.4cm]
#2 & \\[0.5cm]
\end{tabular}
\end{center}
\vspace{-18pt}\hrule\vspace{6pt}
\begin{tabular}{ll}
\textbf{Name:} & #4\\
\textbf{Group:} & #5\\
\end{tabular}
\vspace{4pt}\hrule\vspace{2pt}
\footnotesize \textbf{Software Testing} \hfil - \hfil Summer 2022 \hfil - \hfil #3 \hfil - \hfil Sibylle Schupp / Sascha Lehmann \hfil \\
}
\newcounter{question}
\NewDocumentEnvironment{question}{m o}{%
\addtocounter{question}{1}%
\paragraph{\textcolor{red}{Task~\arabic{question}} - #1\hfill\IfNoValueTF{#2}{}{[#2 P]}}
\leavevmode\\%
}{%
\vskip 1em%
}
\NewDocumentEnvironment{answer}{}{%
\vspace{6pt}
\leavevmode\\
\textit{Answer:}\\[-0.25cm]
{\color{red}\rule{\textwidth}{0.4mm}}
}{%
\leavevmode\\
{\color{red}\rule{\textwidth}{0.4mm}}
}
\newcommand{\projectinfo}[5]{
\baseinfo{Project Phase #1 - Submission Sheet}{#2}{#3}{#4}{#5}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\name{[Add name here]}
\def\group{[Add group here]}
\begin{document}
\projectinfo{5}{Software Testing - Syntax Coverage\small}{\today}{\name}{\group}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Task 1 %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{question}{Answer basic questions on Syntax Coverage}[3]
\begin{enumerate}[topsep=0pt, leftmargin=*]
\item Define the following terms in your own words:
\begin{enumerate}
\item \textit{Production Rule}, \textit{Generator}, and \textit{Terminal}
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item \textit{Mutant}, \textit{Ground String}, and \textit{Mutation Operator}
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item \textit{RIP Model}
\begin{answer}
[TODO: Add answer here]
\end{answer}
\end{enumerate}
\item Name and describe \textit{2 syntax-based coverage criteria}. Does one of these two criteria subsume the other? Explain why, or provide a counterexample.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item What does it mean to \textit{"kill a mutant"}? Explain the concept with an own code example.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Name and describe the \textit{4 different classified types} of mutants in the context of mutant killing.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\end{enumerate}
\end{question}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Task 2 %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{question}{Apply Syntax Coverage criteria to a sample program}[5]
\begin{enumerate}[topsep=0pt, leftmargin=*]
\item Select \textit{one} mutation operator from Table~\ref{table:operators} (the operators are taken from \textit{Introduction to Software Testing} by Ammann and Offutt), and apply it \textit{once} to every occurrence of a target expression, statement or instruction inside the given \texttt{toString()} method (e.g., choose the \textit{SOR} operator, and for each \verb|<<|, \verb|>>|, or \verb|>>>| that occurs in the method, replace it with \textit{one} other shift operator). The operator has to be applicable to at least two parts of the code. For each mutation, document the line, original epression, and mutated expression.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Select \textit{one} other mutation operator, and apply all of its concrete mutations to \textit{one} target expression, statement or instruction inside the given \texttt{toString()} method (e.g., choose the \textit{SOR} operator, and replace one occurring \verb|<<| with the other shift operators \verb|>>| and \verb|>>>|). Document the line, original epression, and mutated expressions.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Pick one set of method mutations (either the mutations of task 2a or 2b), and provide a minimum set of tests that kill all introduced mutants \textit{strongly} (\textit{Strong Mutation Coverage (SMC)}). If that is not possible for a concrete mutant, explain why, and kill that mutant \textit{weakly} (\textit{Weak Mutation Coverage (WMC)}) instead. If neither of that is possible, explain it as well.
\begin{answer}
[TODO: Add answer here]
\begin{lstlisting}[language=Java,belowskip=-0.8\baselineskip]
/* Add code here */
\end{lstlisting}
% or: \lstinputlisting[language=Java,belowskip=-0.8\baselineskip]{file_name.java}
\end{answer}
\item For the \textit{other} set of method mutations, provide a minimum set of tests that kill the mutants only \textit{weakly}, but \textbf{not} \textit{strongly}. If that is not possible for a concrete mutant, explain why, and kill the mutants \textit{strongly} instead. If that is not possible as well, explain it.
\begin{answer}
[TODO: Add answer here]
\begin{lstlisting}[language=Java,belowskip=-0.8\baselineskip]
/* Add code here */
\end{lstlisting}
% or: \lstinputlisting[language=Java,belowskip=-0.8\baselineskip]{file_name.java}
\end{answer}
\item For both applied operators, select one concrete mutation and describe the conditions that need to hold for the \textit{Reachability}, \textit{Infection}, and \textit{Propagation} of the induced change.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\begin{table}[t]
\footnotesize
\hspace*{-1cm}\begin{tabular}{|c|c|l|}
\hline
\textbf{Abbr.} & \textbf{Mutation Operator Name} & \textbf{Mutation (\textit{a} is a constant or expression)} \\ \cline{1-3}
ABS & Absolute Value Insertion & $a \rightarrow abs(a), -abs(a), failOnZero(a)$ \\ \cline{1-3}
UOI & Unary Operator Insertion & $a \rightarrow \{!,-,+,\sim\}a$\\ \cline{1-3}
UOD & Unary Operator Deletion & $\{!,-,+,\sim\}a \rightarrow a$\\ \cline{1-3}
AOR & Arithmetic Operator Replacement & $a+b \rightarrow a \{-,*,/,**,\%\} b, a, b$\\ \cline{1-3}
ROR & Relational Operator Replacement & $a>b \rightarrow a \{>=,<,<=,==,!=\} b, true, false$\\ \cline{1-3}
COR & Conditional Operator Replacement & $a\&\&b \rightarrow a \{||,\&,|,\hat{}\} b, true, false, a, b$\\ \cline{1-3}
SOR & Shift Operator Replacement & $a<<b \rightarrow a \{>>,>>>\} b, a$\\ \cline{1-3}
LOR & Logical Operator Replacement & $a\&b \rightarrow a \{|,\hat{}\} b, a, b$\\ \cline{1-3}
ASR & Assignment Operator Replacement & $a+=b \rightarrow a \{-=,*=,/=,\%=,\&=,|=,\hat{}=,<<=,>>=,>>>=\} b$\\ \cline{1-3}
SVR & Scalar Variable Replacement & $a=b*c \rightarrow a=b*b,a=b*a,a=a*c,a=c*c,b=b*c,c=b*c$\\ \cline{1-3}
BSR & Bomb Statement Replacement & instruction $\rightarrow$ Bomb() (throws exception when reached)\\
\hline
\end{tabular}
\caption{Exemplary mutation operators with their introduced changes for an expression / instruction}
\label{table:operators}
\end{table}
\end{enumerate}
\end{question}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Task 3 %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{question}{Application to software project}[8]
\begin{enumerate}[topsep=0pt, leftmargin=*]
\item As a group, decide on \textbf{one test suite} (original + own tests) that you want to use for this task
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item In consultation with your group, pick a unique mutation tool for Java code (i.e., no two members of one group should use the same tool).
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Depending on the capabilities of the selected mutation testing tool, determine the amount of \textit{killed mutants} for at least \textbf{3 different mutation operators} (handle the results individually as long as your tool returns the results for each individual operator, or supports the application of single selected operators).
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item For each of the applied mutation operators, pick a distinct method of your project that was affected by that operator, and highlight / describe the instructions that are changed. Explain how the test suite does or does not satisfy the criteria of \textit{Reachability}, \textit{Infection}, and \textit{Propagation} for that part.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Pick one suitable method (restricted to int values) or class from your project, and derive an automaton expressing its behaviour. For the creation of your automaton, use the \textit{Uppaal} model checker environment.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Formulate at least 2 formal requirements that your model / method needs to satisfy, create corresponding \textit{queries} in Uppaal, and execute them to assure that your base model satisfies them. Enable \texttt{Options $\rightarrow$ Diagnostic Trace $\rightarrow$ Some} to get a counterexample trace in case that a queried formula is not satisfied. This trace can be inspected in the \texttt{Simulator} tab.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Apply \textit{one} mutation operator from Table~\ref{table:operators} to \textit{one} single expression in your model, and re-evaluate your queries. Explain why the verification results of the model changed or remained the same. If a counterexample is created, note the test vector that kills the mutant.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Reroute one transition in your model (i.e., connect the edge to a different destination node), and re-evaluate your queries. Explain why the verification results of the model changed or remained the same. If a counterexample is created, note the test vector that kills the mutant.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\end{enumerate}
\end{question}
\end{document}

Binary file not shown.

View File

@ -0,0 +1,228 @@
\documentclass[a4paper]{scrreprt}
\usepackage[left=4cm,bottom=3cm,top=3cm,right=4cm,nohead,nofoot]{geometry}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{listings}
\usepackage{enumitem}
\usepackage{subcaption}
\usepackage{pgf}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
\usepackage{xparse}
\usepackage{multirow}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setlength{\textfloatsep}{16pt}
\renewcommand{\labelenumi}{\alph{enumi})}
\renewcommand{\labelenumii}{\arabic{enumii}) }
\newcommand{\baseinfo}[5]{
\begin{center}
\begin{tabular}{p{15cm}r}
\vspace{-4.5pt}{ \Large \bfseries #1} & \multirow{2}{*}{} \\[0.4cm]
#2 & \\[0.5cm]
\end{tabular}
\end{center}
\vspace{-18pt}\hrule\vspace{6pt}
\begin{tabular}{ll}
\textbf{Name:} & #4\\
\textbf{Group:} & #5\\
\end{tabular}
\vspace{4pt}\hrule\vspace{2pt}
\footnotesize \textbf{Software Testing} \hfil - \hfil Summer 2022 \hfil - \hfil #3 \hfil - \hfil Sibylle Schupp / Sascha Lehmann \hfil \\
}
\newcounter{question}
\NewDocumentEnvironment{question}{m o}{%
\addtocounter{question}{1}%
\paragraph{\textcolor{red}{Task~\arabic{question}} - #1\hfill\IfNoValueTF{#2}{}{[#2 P]}}
\leavevmode\\%
}{%
\vskip 1em%
}
\NewDocumentEnvironment{answer}{}{%
\vspace{6pt}
\leavevmode\\
\textit{Answer:}\\[-0.25cm]
{\color{red}\rule{\textwidth}{0.4mm}}
}{%
\leavevmode\\
{\color{red}\rule{\textwidth}{0.4mm}}
}
\newcommand{\projectinfo}[5]{
\baseinfo{Project Phase #1 - Submission Sheet}{#2}{#3}{#4}{#5}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\name{[Add name here]}
\def\group{[Add group here]}
\begin{document}
\projectinfo{5}{Software Testing - Syntax Coverage\small}{\today}{\name}{\group}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Task 1 %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{question}{Answer basic questions on Syntax Coverage}[3]
\begin{enumerate}[topsep=0pt, leftmargin=*]
\item Define the following terms in your own words:
\begin{enumerate}
\item \textit{Production Rule}, \textit{Generator}, and \textit{Terminal}
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item \textit{Mutant}, \textit{Ground String}, and \textit{Mutation Operator}
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item \textit{RIP Model}
\begin{answer}
[TODO: Add answer here]
\end{answer}
\end{enumerate}
\item Name and describe \textit{2 syntax-based coverage criteria}. Does one of these two criteria subsume the other? Explain why, or provide a counterexample.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item What does it mean to \textit{"kill a mutant"}? Explain the concept with an own code example.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Name and describe the \textit{4 different classified types} of mutants in the context of mutant killing.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\end{enumerate}
\end{question}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Task 2 %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{question}{Apply Syntax Coverage criteria to a sample program}[5]
\begin{enumerate}[topsep=0pt, leftmargin=*]
\item Select \textit{one} mutation operator from Table~\ref{table:operators} (the operators are taken from \textit{Introduction to Software Testing} by Ammann and Offutt), and apply it \textit{once} to every occurrence of a target expression, statement or instruction inside the given \texttt{toString()} method (e.g., choose the \textit{SOR} operator, and for each \verb|<<|, \verb|>>|, or \verb|>>>| that occurs in the method, replace it with \textit{one} other shift operator). The operator has to be applicable to at least two parts of the code. For each mutation, document the line, original epression, and mutated expression.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Select \textit{one} other mutation operator, and apply all of its concrete mutations to \textit{one} target expression, statement or instruction inside the given \texttt{toString()} method (e.g., choose the \textit{SOR} operator, and replace one occurring \verb|<<| with the other shift operators \verb|>>| and \verb|>>>|). Document the line, original epression, and mutated expressions.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Pick one set of method mutations (either the mutations of task 2a or 2b), and provide a minimum set of tests that kill all introduced mutants \textit{strongly} (\textit{Strong Mutation Coverage (SMC)}). If that is not possible for a concrete mutant, explain why, and kill that mutant \textit{weakly} (\textit{Weak Mutation Coverage (WMC)}) instead. If neither of that is possible, explain it as well.
\begin{answer}
[TODO: Add answer here]
\begin{lstlisting}[language=Java,belowskip=-0.8\baselineskip]
/* Add code here */
\end{lstlisting}
% or: \lstinputlisting[language=Java,belowskip=-0.8\baselineskip]{file_name.java}
\end{answer}
\item For the \textit{other} set of method mutations, provide a minimum set of tests that kill the mutants only \textit{weakly}, but \textbf{not} \textit{strongly}. If that is not possible for a concrete mutant, explain why, and kill the mutants \textit{strongly} instead. If that is not possible as well, explain it.
\begin{answer}
[TODO: Add answer here]
\begin{lstlisting}[language=Java,belowskip=-0.8\baselineskip]
/* Add code here */
\end{lstlisting}
% or: \lstinputlisting[language=Java,belowskip=-0.8\baselineskip]{file_name.java}
\end{answer}
\item For both applied operators, select one concrete mutation and describe the conditions that need to hold for the \textit{Reachability}, \textit{Infection}, and \textit{Propagation} of the induced change.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\begin{table}[t]
\footnotesize
\hspace*{-1cm}\begin{tabular}{|c|c|l|}
\hline
\textbf{Abbr.} & \textbf{Mutation Operator Name} & \textbf{Mutation (\textit{a} is a constant or expression)} \\ \cline{1-3}
ABS & Absolute Value Insertion & $a \rightarrow abs(a), -abs(a), failOnZero(a)$ \\ \cline{1-3}
UOI & Unary Operator Insertion & $a \rightarrow \{!,-,+,\sim\}a$\\ \cline{1-3}
UOD & Unary Operator Deletion & $\{!,-,+,\sim\}a \rightarrow a$\\ \cline{1-3}
AOR & Arithmetic Operator Replacement & $a+b \rightarrow a \{-,*,/,**,\%\} b, a, b$\\ \cline{1-3}
ROR & Relational Operator Replacement & $a>b \rightarrow a \{>=,<,<=,==,!=\} b, true, false$\\ \cline{1-3}
COR & Conditional Operator Replacement & $a\&\&b \rightarrow a \{||,\&,|,\hat{}\} b, true, false, a, b$\\ \cline{1-3}
SOR & Shift Operator Replacement & $a<<b \rightarrow a \{>>,>>>\} b, a$\\ \cline{1-3}
LOR & Logical Operator Replacement & $a\&b \rightarrow a \{|,\hat{}\} b, a, b$\\ \cline{1-3}
ASR & Assignment Operator Replacement & $a+=b \rightarrow a \{-=,*=,/=,\%=,\&=,|=,\hat{}=,<<=,>>=,>>>=\} b$\\ \cline{1-3}
SVR & Scalar Variable Replacement & $a=b*c \rightarrow a=b*b,a=b*a,a=a*c,a=c*c,b=b*c,c=b*c$\\ \cline{1-3}
BSR & Bomb Statement Replacement & instruction $\rightarrow$ Bomb() (throws exception when reached)\\
\hline
\end{tabular}
\caption{Exemplary mutation operators with their introduced changes for an expression / instruction}
\label{table:operators}
\end{table}
\end{enumerate}
\end{question}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Task 3 %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{question}{Application to software project}[8]
\begin{enumerate}[topsep=0pt, leftmargin=*]
\item As a group, decide on \textbf{one test suite} (original + own tests) that you want to use for this task
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item In consultation with your group, pick a unique mutation tool for Java code (i.e., no two members of one group should use the same tool).
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Depending on the capabilities of the selected mutation testing tool, determine the amount of \textit{killed mutants} for at least \textbf{3 different mutation operators} (handle the results individually as long as your tool returns the results for each individual operator, or supports the application of single selected operators).
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item For each of the applied mutation operators, pick a distinct method of your project that was affected by that operator, and highlight / describe the instructions that are changed. Explain how the test suite does or does not satisfy the criteria of \textit{Reachability}, \textit{Infection}, and \textit{Propagation} for that part.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Pick one suitable method (restricted to int values) or class from your project, and derive an automaton expressing its behaviour. For the creation of your automaton, use the \textit{Uppaal} model checker environment.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Formulate at least 2 formal requirements that your model / method needs to satisfy, create corresponding \textit{queries} in Uppaal, and execute them to assure that your base model satisfies them. Enable \texttt{Options $\rightarrow$ Diagnostic Trace $\rightarrow$ Some} to get a counterexample trace in case that a queried formula is not satisfied. This trace can be inspected in the \texttt{Simulator} tab.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Apply \textit{one} mutation operator from Table~\ref{table:operators} to \textit{one} single expression in your model, and re-evaluate your queries. Explain why the verification results of the model changed or remained the same. If a counterexample is created, note the test vector that kills the mutant.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\item Reroute one transition in your model (i.e., connect the edge to a different destination node), and re-evaluate your queries. Explain why the verification results of the model changed or remained the same. If a counterexample is created, note the test vector that kills the mutant.
\begin{answer}
[TODO: Add answer here]
\end{answer}
\end{enumerate}
\end{question}
\end{document}