\section{System tests}

The purpose of system testing is to test the program as a whole. It will take place in the testing phase.

When it's said that the program must be able to do something, it's meant that the program must be able to do it \emph{correctly}.

\

Definitions used:
\begin{itemize}
\item \emph{Input file} - Any file defined as input.
\item \emph{Definition file} - All input files except for data.
\end{itemize}

\subsection{Input}

Test cases concerning the format of the input files will be written in the design phase, after the formats have been defined.

\begin{itemize}
\item The program must accept all valid input files.
\item The program must report syntax errors in the definition files. (Requirement E2)
\item The program must report semantic errors in the definition files. (Requirement E3)
\end{itemize}

\begin{tabular}[]{| l p{10cm} |}
\hline
Id: & \\
& \\
Name: & Comments\\
& \\
Description: & The program must ignore all lines beginning with '\#' in the input files.\\
& \\
Reference: & Requirement ??\\
& \\
Test case: & ??\\
& \\
Expected results: & ??\\
\hline
\end{tabular}
\vspace{.5cm}

\subsection{Simulation}

\subsubsection{Variable values}

When a variable is defined to receive it's value from the data, the program must be able to retrieve that value. It must also be possible to define a distribution for such a variable. (Requirement M2)

If a variable's value is missing from the data, the program must treat the variable as a parameter. (Requirement D2)

\subsubsection{Parameter values}

\begin{itemize}
\item The program must be able to retrieve a parameter's value, either from a distribution or an equation. (Requirement M3)
\item Parameters may have proposal or prior distributions, if so the program must be able to take them into consideration. (Requirement S10)
\item The program must be able to retrieve initial values for the parameters from the definition files. (Requirement S11)
\item The program must be able to read the initial values from a file that contains the last values of an earlier simulation. (Requirement S13)
\end{itemize}

\begin{tabular}[]{| l p{10cm} |}
\hline
Id: & \\
& \\
Name: & Parameter with a missing initial value\\
& \\
Description: & If a parameter is missing an initial value, the program must display an error message.\\
& \\
Reference: & Requirement S11\\
& \\
Test case: & Leave the definition of an initial value for a parameter out of the definition files.\\
& \\
Expected results: & The program displays an error message.\\
\hline
\end{tabular}
\vspace{.5cm}

\subsubsection{Dependencies}

The program must be able to calculate functional, stochastic and spatial dependencies. (Requirement M3)

\subsubsection{Equations}

The program must be able to calculate the following equations on the right side of an expression: +, -, *, /, logarithm and power. (Requirement M5)

\subsubsection{Grouped variables/parameters}

The program must be able to take into consideration that some variables/parameters are related to the same entity. (Requirement M6)

\subsubsection{Predefined distributions}

The program must be able to calculate all the distributions defined in requirement M10.

\subsubsection{User defined distributions}

The program must be able to calculate user defined distributions. (Requirement M11)

\subsubsection{Algorithms}

The program must be able to use the Metropolis-Hastings and Gibbs sampling algorithms. (Requirements S1 and S2)

\subsubsection{Number of updates}

The number updates performed during a simulation must correspond to the number  defined. (Requirement S3)

\subsubsection{Number of burn-in iterations}

The number of burn-in iterations performed during a simulation must correspond to the number defined. (Requirement S4)

\subsubsection{Blocks}

The program must be able to take into consideration defined blocks. (Requirements S6 and S8)

\subsubsection{Update strategies}

The program must be able to execute update strategies as defined. (Requirement S7)

\subsubsection{Proposal strategies}

The program must be able to execute proposal strategies as defined. (Requirement S9)

\subsubsection{Progress information during the simulation}

\begin{tabular}[]{| l p{10cm} |}
\hline
Id: & \\
& \\
Name: & Progress information during the simulation\\
& \\
Description: & The program must display information about the progress of the simulation while it's being run.\\
& \\
Reference: & Requirement S14\\
& \\
Test case: & Run a simulation.\\
& \\
Expected results: & The program will display information about the progress of the simulation while it's being run.\\
\hline
\end{tabular}
\vspace{.5cm}

\subsubsection{Soft stop}

If the user decides to stop the simulation before it's completed, the program must:

\begin{enumerate}
\item Complete the current iteration.
\item Write output files so that it's possible to continue the simulation later.
\item Stop the simulation.
\end{enumerate}

(Requirement S15)

\subsubsection{File access checks}

\begin{tabular}[]{| l p{10cm} |}
\hline
Id: & \\
& \\
Name: & Unavailable input file\\
& \\
Description: & If an input is not available, the program must display an error message.\\
& \\
Reference: & Requirement E1\\
& \\
Test case: & For all input file types: Give the program an unavailable input file.\\
& \\
Expected results: & The program displays an error message.\\
\hline
\end{tabular}
\vspace{.5cm}

\begin{tabular}[]{| l p{10cm} |}
\hline
Id: & \\
& \\
Name: & Unavailable output file\\
& \\
Description: & The program must make sure that the output files are availabe to be written before beginning the simulation. If not, the program must print an error message.\\
& \\
Reference: & Requirement OP6\\
& \\
Test case: & For all output file types: Give the program an unavailable output file.\\
& \\
Expected results: & The simulation doesn't begin and the program displays an error message.\\
\hline
\end{tabular}
\vspace{.5cm}

\begin{tabular}[]{| l p{10cm} |}
\hline
Id: & \\
& \\
Name: & Unavailable output file during the simulation\\
& \\
Description: & If an output file becomes unavailable during the simulation, the program must prompt for a new file.\\
& \\
Reference: & Requirement OP7\\
& \\
Test case: & For all output file types: Make an output file unavailable during the simulation.\\
& \\
Expected results: & The program prompts for a new file.\\
\hline
\end{tabular}

\subsection{Output}

The test cases concerning the format of the output files will be written in the design phase, after the formats have been defined.

\begin{tabular}[]{| l p{10cm} |}
\hline
Id: & \\
& \\
Name: & Output file names\\
& \\
Description: & Names of the output files must correspond to the names defined by the user.\\
& \\
Reference: & Requirement OP2\\
& \\
Test case: & Run a simulation.\\
& \\
Expected results: & For all output files: The name of the output file corresponds to the name defined for it by the user.\\
\hline
\end{tabular}
\vspace{.5cm}

\begin{tabular}[]{| l p{10cm} |}
\hline
Id: & \\
& \\
Name: & Parameters in the output\\
& \\
Description: & The parameters printed must be the parameters defined as output in the definition files.\\
& \\
Reference: & Requirement S12\\
& \\
Test case: & Run a simulation.\\
& \\
Expected results: & The parameters printed to the output files correspond to the parameters defined as output.\\
\hline
\end{tabular}
\vspace{.5cm}

\begin{itemize}
\item The defined thinning factor must affect the output correctly. (Requirement S5)
\end{itemize}

\newcommand{\comment}[1]{}
\comment{

\begin{tabular}[]{| l p{10cm} |}
\hline
Id: & \\
& \\
Name: & \\
& \\
Description: & \\
& \\
Reference: & \\
& \\
Test case: & \\
& \\
Expected results: & \\
\hline
\end{tabular}
\vspace{.5cm}

}
