229 lines
11 KiB
TeX
229 lines
11 KiB
TeX
\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}
|