From 1850fab30d43b5a5b70c5a229d46c57e29f01828 Mon Sep 17 00:00:00 2001 From: Michael Chen Date: Wed, 18 May 2022 16:40:39 +0200 Subject: [PATCH] Unpacked project template for phase03 --- .../phase_03/project_phase03_tasks/.gitignore | 306 ++++++++++++++++++ .../project_phase03_tasks/HashMap.java | 29 ++ .../phase_03/project_phase03_tasks/Makefile | 21 ++ .../Solution_Phase03_MichaelChen.tex | 208 ++++++++++++ .../project_phase03_tasks.pdf | 3 + .../project_phase03_template.tex | 208 ++++++++++++ 6 files changed, 775 insertions(+) create mode 100644 project_task_sheets/phase_03/project_phase03_tasks/.gitignore create mode 100644 project_task_sheets/phase_03/project_phase03_tasks/HashMap.java create mode 100644 project_task_sheets/phase_03/project_phase03_tasks/Makefile create mode 100644 project_task_sheets/phase_03/project_phase03_tasks/Solution_Phase03_MichaelChen.tex create mode 100644 project_task_sheets/phase_03/project_phase03_tasks/project_phase03_tasks.pdf create mode 100644 project_task_sheets/phase_03/project_phase03_tasks/project_phase03_template.tex diff --git a/project_task_sheets/phase_03/project_phase03_tasks/.gitignore b/project_task_sheets/phase_03/project_phase03_tasks/.gitignore new file mode 100644 index 0000000..afdad5a --- /dev/null +++ b/project_task_sheets/phase_03/project_phase03_tasks/.gitignore @@ -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 diff --git a/project_task_sheets/phase_03/project_phase03_tasks/HashMap.java b/project_task_sheets/phase_03/project_phase03_tasks/HashMap.java new file mode 100644 index 0000000..5545908 --- /dev/null +++ b/project_task_sheets/phase_03/project_phase03_tasks/HashMap.java @@ -0,0 +1,29 @@ +import java.util.Map.Entry; + +public class HashMap { + static final int MAXIMUM_CAPACITY = 1 << 10; + transient Entry[] table; + int threshold; + final float loadFactor; + + public HashMap(int initialCapacity, float loadFactor) { + if (initialCapacity < 0) + throw new IllegalArgumentException("Illegal initial capacity: " + initialCapacity); + if (initialCapacity > MAXIMUM_CAPACITY) + initialCapacity = MAXIMUM_CAPACITY; + if (loadFactor <= 0 || Float.isNaN(loadFactor)) + throw new IllegalArgumentException("Illegal load factor: " + loadFactor); + + // Find a power of 2 >= initialCapacity + int capacity = 1; + while (capacity < initialCapacity) + capacity <<= 1; + this.loadFactor = loadFactor; + threshold = (int)(capacity * loadFactor); + table = new Entry[capacity]; + } + + public int getCapacity() { + return table.length; + } +} diff --git a/project_task_sheets/phase_03/project_phase03_tasks/Makefile b/project_task_sheets/phase_03/project_phase03_tasks/Makefile new file mode 100644 index 0000000..eeda579 --- /dev/null +++ b/project_task_sheets/phase_03/project_phase03_tasks/Makefile @@ -0,0 +1,21 @@ +phase = 03 +version = 1 +name = MichaelChen + +solutionname = Solution_Phase$(phase)_$(name) +target = $(solutionname)_V$(version).zip +package = $(solutionname).pdf +latexmkflags = + +.PHONY : all dev + +all : $(target) + +dev : latexmkflags = -pvc +dev : all + +$(target) : $(package) + zip -FSr $(target) $(package) + +%.pdf : %.tex + latexmk -jobname="$*" $(latexmkflags) -pdf $< diff --git a/project_task_sheets/phase_03/project_phase03_tasks/Solution_Phase03_MichaelChen.tex b/project_task_sheets/phase_03/project_phase03_tasks/Solution_Phase03_MichaelChen.tex new file mode 100644 index 0000000..6190a4c --- /dev/null +++ b/project_task_sheets/phase_03/project_phase03_tasks/Solution_Phase03_MichaelChen.tex @@ -0,0 +1,208 @@ +\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{3}{Software Testing - Graph Coverage\small}{\today}{\name}{\group} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Task 1 %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{question}{Answer basic questions on Graph Coverage}[3] +\begin{enumerate}[topsep=0pt, leftmargin=*] + \item Define the following terms in your own words: + \begin{enumerate} + \item Graph + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item (Test-)Path + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item Syntactic and Semantic Reach + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \end{enumerate} + \item Which testing situations are suitable for the Graph Coverage approach? + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item What is the difference between \textit{Tours}, \textit{Tours With Sidetrips}, and \textit{Tours With Detours}? + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item Describe (1-2 sentences) the \textit{Node Coverage} (NC) and \textit{Edge Coverage} (EC) criterion. What are their counterparts for code-based coverage? + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item Name and describe (2-3 sentences) 2 \textit{Path Coverage Criteria} OR 2 \textit{Data Flow Test Criteria}. Does one of these two criteria subsume the other? + \begin{answer} + [TODO: Add answer here] + \end{answer} + +\end{enumerate} +\end{question} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Task 2 %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{question}{Apply Graph Coverage criteria to a sample program}[5] +\begin{enumerate}[topsep=0pt, leftmargin=*] + \item Create the control flow graph for the given constructor. + \begin{answer} + [TODO: Add answer here] + + % Example graph using tikz + \begin{center} + \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm,semithick] + \tikzstyle{every state}=[fill=gray,draw=none,text=white] + + \node[initial,state] (A) {$A$}; + \node[state] (B) [above right of=A] {$B$}; + \node[state] (D) [below right of=A] {$C$}; + \node[state] (C) [below right of=B] {$D$}; + + \path (A) edge node {Dummy Label 1} (B) + (B) edge [loop above] node {Dummy Label 2} (B) + edge node {Dummy Label 3} (C) + (C) edge node {Dummy Label 4} (D) + (D) edge node {Dummy Label 5} (A); + \end{tikzpicture} + \end{center} + \end{answer} + + \item Create a minimum set of test cases that reaches 100\% coverage for the instruction coverage criterion. + \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 Extend the set of test cases so that it additionally reaches 100\% coverage for the branch coverage criterion. Describe the necessity of the added tests. + \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 Analyze the code regarding the following data flow criteria, and list all relevant DU pairs. Does your test suite require additional tests to cover them? + \begin{enumerate} + \item All-defs with respect to \texttt{capacity} + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item All-uses with respect to \texttt{loadFactor} + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \end{enumerate} +\end{enumerate} +\end{question} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Task 3 %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{question}{Apply Graph Coverage criteria to your software project}[8] +\begin{enumerate}[topsep=0pt, leftmargin=*] + \item Measure the coverage of your given project test suite (which includes the existing test suite as well as the tests that you created in previous project phases) by three graph coverage criteria which you can freely choose. Describe each individual result in 2-3 sentences. + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item Extend the test suite with own tests, which have to fullfil \textbf{one} of the following criteria: + \begin{enumerate} + \item Increase the coverage values of all three coverage criteria that you applied in the previous subtask with at least 10 tests (compare and describe the effects on coverage for each individual test), OR + \item Reveal a new bug in the software project (describe the bug, its context, and a potential fix in detail) + \end{enumerate} + \begin{answer} + [TODO: Add answer here] + + \begin{lstlisting}[language=Java,belowskip=-0.8\baselineskip] +/* Add code here */ + \end{lstlisting} + \end{answer} + +\end{enumerate} +\end{question} + +\end{document} diff --git a/project_task_sheets/phase_03/project_phase03_tasks/project_phase03_tasks.pdf b/project_task_sheets/phase_03/project_phase03_tasks/project_phase03_tasks.pdf new file mode 100644 index 0000000..383f41c --- /dev/null +++ b/project_task_sheets/phase_03/project_phase03_tasks/project_phase03_tasks.pdf @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34e9f7239399a2d06ead736ee14e408b6354eeeb11ebbad748c1771935a6e12c +size 421218 diff --git a/project_task_sheets/phase_03/project_phase03_tasks/project_phase03_template.tex b/project_task_sheets/phase_03/project_phase03_tasks/project_phase03_template.tex new file mode 100644 index 0000000..6190a4c --- /dev/null +++ b/project_task_sheets/phase_03/project_phase03_tasks/project_phase03_template.tex @@ -0,0 +1,208 @@ +\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{3}{Software Testing - Graph Coverage\small}{\today}{\name}{\group} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Task 1 %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{question}{Answer basic questions on Graph Coverage}[3] +\begin{enumerate}[topsep=0pt, leftmargin=*] + \item Define the following terms in your own words: + \begin{enumerate} + \item Graph + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item (Test-)Path + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item Syntactic and Semantic Reach + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \end{enumerate} + \item Which testing situations are suitable for the Graph Coverage approach? + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item What is the difference between \textit{Tours}, \textit{Tours With Sidetrips}, and \textit{Tours With Detours}? + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item Describe (1-2 sentences) the \textit{Node Coverage} (NC) and \textit{Edge Coverage} (EC) criterion. What are their counterparts for code-based coverage? + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item Name and describe (2-3 sentences) 2 \textit{Path Coverage Criteria} OR 2 \textit{Data Flow Test Criteria}. Does one of these two criteria subsume the other? + \begin{answer} + [TODO: Add answer here] + \end{answer} + +\end{enumerate} +\end{question} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Task 2 %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{question}{Apply Graph Coverage criteria to a sample program}[5] +\begin{enumerate}[topsep=0pt, leftmargin=*] + \item Create the control flow graph for the given constructor. + \begin{answer} + [TODO: Add answer here] + + % Example graph using tikz + \begin{center} + \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm,semithick] + \tikzstyle{every state}=[fill=gray,draw=none,text=white] + + \node[initial,state] (A) {$A$}; + \node[state] (B) [above right of=A] {$B$}; + \node[state] (D) [below right of=A] {$C$}; + \node[state] (C) [below right of=B] {$D$}; + + \path (A) edge node {Dummy Label 1} (B) + (B) edge [loop above] node {Dummy Label 2} (B) + edge node {Dummy Label 3} (C) + (C) edge node {Dummy Label 4} (D) + (D) edge node {Dummy Label 5} (A); + \end{tikzpicture} + \end{center} + \end{answer} + + \item Create a minimum set of test cases that reaches 100\% coverage for the instruction coverage criterion. + \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 Extend the set of test cases so that it additionally reaches 100\% coverage for the branch coverage criterion. Describe the necessity of the added tests. + \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 Analyze the code regarding the following data flow criteria, and list all relevant DU pairs. Does your test suite require additional tests to cover them? + \begin{enumerate} + \item All-defs with respect to \texttt{capacity} + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item All-uses with respect to \texttt{loadFactor} + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \end{enumerate} +\end{enumerate} +\end{question} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%% Task 3 %%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\begin{question}{Apply Graph Coverage criteria to your software project}[8] +\begin{enumerate}[topsep=0pt, leftmargin=*] + \item Measure the coverage of your given project test suite (which includes the existing test suite as well as the tests that you created in previous project phases) by three graph coverage criteria which you can freely choose. Describe each individual result in 2-3 sentences. + \begin{answer} + [TODO: Add answer here] + \end{answer} + + \item Extend the test suite with own tests, which have to fullfil \textbf{one} of the following criteria: + \begin{enumerate} + \item Increase the coverage values of all three coverage criteria that you applied in the previous subtask with at least 10 tests (compare and describe the effects on coverage for each individual test), OR + \item Reveal a new bug in the software project (describe the bug, its context, and a potential fix in detail) + \end{enumerate} + \begin{answer} + [TODO: Add answer here] + + \begin{lstlisting}[language=Java,belowskip=-0.8\baselineskip] +/* Add code here */ + \end{lstlisting} + \end{answer} + +\end{enumerate} +\end{question} + +\end{document}