From 824d5e3b6954407a694f5739cbeb40f66324c8d7 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Wed, 14 Dec 2022 15:41:49 +0100 Subject: Developing Unit Testing. --- doc/listings/test.sh | 2 ++ doc/listings/testOutput.txt | 28 ++++++++++++++++++++++++++++ doc/tex/imago.tex | 10 ---------- doc/tex/systemAnalysis.tex | 31 +++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 doc/listings/test.sh create mode 100644 doc/listings/testOutput.txt (limited to 'doc') diff --git a/doc/listings/test.sh b/doc/listings/test.sh new file mode 100644 index 0000000..b929249 --- /dev/null +++ b/doc/listings/test.sh @@ -0,0 +1,2 @@ +#!/bin/sh +coverage run --source=imago -m unittest discover tests/ && coverage report -m --skip-empty diff --git a/doc/listings/testOutput.txt b/doc/listings/testOutput.txt new file mode 100644 index 0000000..2bfa52f --- /dev/null +++ b/doc/listings/testOutput.txt @@ -0,0 +1,28 @@ +Name Stmts Miss Cover Missing +------------------------------------------------------------------------------- +imago/data/enums.py 17 0 100% +imago/engine/core.py 39 39 0% 3-68 +imago/engine/createDecisionAlgorithm.py 11 11 0% 3-21 +imago/engine/decisionAlgorithm.py 9 4 56% 6, 10, 14, 18 +imago/engine/imagoIO.py 105 105 0% 3-186 +imago/engine/keras/convNeuralNetwork.py 12 12 0% 3-54 +imago/engine/keras/denseNeuralNetwork.py 12 12 0% 3-40 +imago/engine/keras/initialDenseNeuralNetwork.py 11 11 0% 3-28 +imago/engine/keras/keras.py 28 28 0% 3-49 +imago/engine/keras/neuralNetwork.py 137 137 0% 3-206 +imago/engine/monteCarlo.py 107 78 27% 17-24, 32-35, 41-49, 53-54, 71, 77-79, 84-88, 92-93, 110-125, 129-130, 136-140, 144-156, 162-182, 186-187 +imago/engine/parseHelpers.py 48 0 100% +imago/gameLogic/gameBoard.py 199 55 72% 115, 128, 136-139, 177, 188, 192, 202, 211-212, 216, 224, 228, 230, 235-241, 267-274, 278-303, 307-311 +imago/gameLogic/gameData.py 24 24 0% 3-51 +imago/gameLogic/gameMove.py 93 29 69% 21, 27, 33-35, 51-56, 73, 91, 117, 121-125, 130-133, 137-141, 145 +imago/gameLogic/gameState.py 42 22 48% 17-21, 25, 29, 38, 43-49, 53, 57, 61, 66-71 +imago/scripts/monteCarloSimulation.py 17 17 0% 3-25 +imago/sgfParser/astNode.py 125 125 0% 1-156 +imago/sgfParser/parsetab.py 18 18 0% 5-28 +imago/sgfParser/sgf.py 6 6 0% 3-13 +imago/sgfParser/sgflex.py 31 31 0% 5-71 +imago/sgfParser/sgfyacc.py 41 41 0% 5-71 +------------------------------------------------------------------------------- +TOTAL 1132 805 29% + +8 empty files skipped. diff --git a/doc/tex/imago.tex b/doc/tex/imago.tex index 4b292f1..7978a0c 100644 --- a/doc/tex/imago.tex +++ b/doc/tex/imago.tex @@ -38,16 +38,6 @@ \newcommand{\lref}[1]{Listing~\ref{#1}} %\newcommand{\uurl}[1]{\underline{\url{#1}}} -%\newcommand{\acronim}[2] -%{ -% \iftoggle{#1} -% {#1} -% {#1 (#2)\toggletrue{#1}} -%} -% -%\newtoggle{SGF} -%\newcommand{\acrSGF}[0]{\acronim{SGF}{Smart Game Format}} - \newcommand{\tabitem}{~~\llap{\textbullet}~~} \begin{document} diff --git a/doc/tex/systemAnalysis.tex b/doc/tex/systemAnalysis.tex index bbae66e..ba5fbf1 100644 --- a/doc/tex/systemAnalysis.tex +++ b/doc/tex/systemAnalysis.tex @@ -878,6 +878,17 @@ The engine interface reads the input for generating a move as stated by the \subsection{Testing Plan Specification} +The Testing Plan will include four types of tests: + +\begin{itemize} + + \item Unitary Testing: for isolated code elements. + \item Integration Testing: for the collaboration between components. + \item System Testing: for the product as a whole. + \item Usability Testing: for the experience of users with the product. + +\end{itemize} + \subsubsection{Unitary Testing} Tests for the Python code are developed using the unittest \cite{python_unittest} @@ -888,4 +899,24 @@ The coverage of unit testing is checked with Coverage.py \cite{python_coverage}, which can by itself run the unittest tests and generate coverage reports based on the results. +The script used to run the tests is shown on \lref{lst:test} and its output on +\lref{lst:testOutput}. + % Maybe put an example report here? +\begin{listing}[h] + \inputminted{bash}{listings/test.sh} + \caption{Dense neural network model.} + \label{lst:test} +\end{listing} + +\begin{listing}[h] + \inputminted[fontsize=\footnotesize]{text}{listings/testOutput.txt} + \caption{Unitary testing output.} + \label{lst:testOutput} +\end{listing} + +\subsubsection{Integration Testing} + +\subsubsection{System Testing} + +\subsubsection{Usability Testing} -- cgit v1.2.1