eerste test
[tt2015.git] / a2 / 1cases.tex
1 \subsection{Preflight checklist}
2 Before actual certification is commenced we perform a manual test using a
3 checklist.
4 If any of the checks fail we immediately reject the product.
5 The checklist is given in the table below. All commands in \texttt{monospace}
6 are to be run in a terminal. Commands prefixed with a \texttt{\#} should be run
7 with root permissions. Commands prefixed with a \texttt{\$} should be run with
8 user permissions.
9
10 \begin{longtabu}{|l|X|}
11 \hline
12 Check 1 & Get the SUT in a workable state. \\
13 \hline
14 Course of action &
15 \begin{enumerate}
16 \item Import the VirtualBox image into VirtualBox.
17 \item Boot the vm.
18 \item Verify the SUT booted successfully and the network modules
19 are loaded.
20 \end{enumerate}\\
21 \hline Passed & \textit{Yes/No} \\
22 \hline\hline
23 Check 2 & Verify the SUT is complete. \\\hline
24 Course of action &
25 \begin{enumerate}
26 \item Boot the SUT as in \emph{Check 1}.
27 \item Verify the loopback device exists by running
28 \texttt{\$ ifconfig}.
29 \item Verify the \emph{echo-server} is present on the system.
30 \item Verify \emph{Scapy} is present on the system by running
31 \texttt{\$ scapy}.
32 \item Verify all scripts used for testing are present on the
33 system.
34 \end{enumerate}\\
35 \hline
36 Passed & \textit{Yes/No}\\
37 Check 3 & Initialize the testing environment.\\
38 \hline
39 Course of action &
40 \begin{enumerate}
41 \item Boot the SUT as in \emph{Check 1}.
42 \item Setup iptables by executing
43 \texttt{\# code/iptables.sh}~\footnote{ The IPTables script
44 ensures that the OS does not drop packets due to an the
45 unknown source.}
46 \item Navigate to the working directory by running
47 \texttt{\$ cd /home/student/tt2015}
48 \item Compile the echo server by running
49 \texttt{\# cd code/server \&\& make \&\& cd -}
50 \item Start the echo server by running
51 \texttt{\# cd code/server \&\& java Main}
52 \end{enumerate}\\
53 \hline
54 Passed & \textit{Yes/No}\\
55 \hline\hline
56 Check 4 & Test the tool environment.\\
57 \hline
58 Course of action &
59 \begin{enumerate}
60 \item Initialize the SUT as in \emph{Check 3}
61 \item Execute the test script by running
62 \texttt{\# code/client/helloworld.py}.
63 \item Verify the console displays a success message.
64 \end{enumerate}\\
65 \hline
66 Passed & \textit{Yes/No}\\
67 \hline\hline
68 Check 5 & All test inputs and scripts are present. \\\hline
69 % DIT MOET NOG EVEN ANDERS
70 Course of action &
71 \begin{enumerate}
72 \item Boot the SUT as in \emph{Check 1}.
73 \item Execute the command \texttt{ls scripts/tests}
74 \item Verify that there is a file named case$X$ for each test case $X$
75 \item Use \emph{ls packets}
76 \item Verify that there is a file named \texttt{single.pcap} and
77 \texttt{multi.pcap}.
78 \end{enumerate}\\
79 \hline
80 Passed & \textit{Yes/No}\\
81 \hline
82 \caption{Preflight checklist\label{tbl:preflight}}
83 \end{longtabu}
84
85 \subsection{Testing of SUT}
86 The SUT is a series of services for other computer programs with no end-user
87 facing interface. Therefore the SUT will be tested solely by calling it's
88 services through various automated scripts. An automated test suite will be
89 available which executes all these automated scripts and aggregates their
90 results to asses whether or not the SUT has passed the test.
91
92 The implementation of the SUT is tested using black box testing techniques. A
93 series of tests asses the correctness of the implementation with regards to the
94 TCP specification. These tests are specified in Table~\textbf{referentie naar
95 tests-tabel}. The test cases aim to cover the most interesting parts of the TCP
96 specification.
97
98 To cover the TCP specification as complete as possible while still maintaining
99 a feasible test suite the tests are divided into equivalence partitions. Below
100 these partitions are given.
101
102 \begin{enumerate}
103 \item \emph{Number of packets} in request~\footnote{A request is considered
104 establishing a connection (handshake) and a number of payload packets}
105 \begin{enumerate}
106 \item 0 payload packets
107 \item 1 payload packet
108 \item n=small payload packets
109 \item n=big payload packets
110 \end{enumerate}
111 \item Correct or incorrect \emph{source port}
112 \item Correct or incorrect \emph{destination port}
113 \item Bits flipped in \emph{payload}
114 \begin{enumerate}
115 \item Correct payload
116 \item Payload with even number of bits flipped
117 \item Payload with odd number of bits flipped
118 \end{enumerate}
119 \item Correct or Incorrect \emph{checksum}
120 \item Packets received in or out of order, or missing packets
121 \end{enumerate}
122
123 \textbf{hier iets over waarom deze partities relevant zijn! Waarom odd en
124 even number of bits flipped bijv interessant?}
125 \bigskip
126
127 Partitions 2 to 6 are tested using pairwise testing to keep the number of test
128 cases feasible. The pairs are then all *except some where it does not make sense
129 to do so) tested with the different request sizes of partition 1.
130
131 This is expressed in Table~\ref{table:testpairs}.
132
133 \begin{table}
134 % DIT MAAK IK NOG EVEN MOOI
135 \begin{tabularx}{\linewidth}{p{2cm} | l | p{2cm} | l | p{1cm} || c | c | p{1.3cm} | p{1.3cm}}
136 \textbf{Payload} & \textbf{checksum} & \textbf{destination port} & \textbf{order} & \textbf{source port} & \textbf{payload 0} & \textbf{payload 1} & \textbf{payload small} & \textbf{payload big} \\ \hline \hline
137 Correct & Correct & Correct & In order & Correct & \checkmark & \checkmark & \checkmark & \checkmark \\ \hline
138 Correct & Incorrect & Incorrect & Missing packet & Incorrect & \xmark & \xmark & \checkmark & \checkmark \\ \hline
139 odd\# of bits flipped & Correct & Incorrect & Out of order & Incorrect & \xmark & \xmark & \checkmark & \checkmark \\ \hline
140 odd\# of bits flipped & Incorrect & Correct & Missing packet & Correct & \xmark & \xmark & \checkmark & \checkmark \\ \hline
141 even\# of bits flipped & Correct & Incorrect & Missing packet & Correct & \xmark & \xmark & \checkmark & \checkmark \\ \hline
142 even\# of bits flipped & Incorrect & Correct & Out of order & Incorrect & \xmark & \xmark & \checkmark & \checkmark \\ \hline
143 odd\# of bits flipped & Incorrect & Incorrect & In order & Incorrect & \checkmark & \checkmark & \checkmark & \checkmark \\ \hline
144 even\# of bits flipped & Incorrect & Incorrect & In order & Incorrect & \checkmark & \checkmark & \checkmark & \checkmark \\ \hline
145 Correct & Incorrect & Incorrect & Out of order & Correct & \xmark & \xmark & \checkmark & \checkmark \\
146 \end{tabularx}
147 \caption{Combinations of test cases}
148 \label{table:testpairs}
149 \end{table}
150
151 \subsection{Quality, completeness and coverage of tests}
152
153 The network packets used in testing are constructed from prerecorded, known to
154 be correct, network traffic. These packets are then modified with well used and
155 field tested tools. Due to this the chance of errors in the test cases is quite
156 low. However, no formal proof of correctness of the test cases is present, this
157 means that any defects found might not be the result of a fault in the SUT.
158 Therefore detected defects should only indicate there is a high chance that
159 there is a fault in the SUT and can not result directly in the conclusion that
160 there actually is one.
161
162 \bigskip
163
164 Due to the nature of black-box testing coverage of the code in the
165 implementation of the SUT is unknown. However completeness of the tests over
166 the specification of the SUT can be assessed.
167
168 \bigskip
169
170 Due to the clear and exhaustive specification of TCP the completeness of the
171 test suite can be clearly assessed.
172
173 As always, $100\%$ completeness is not feasible, therefore test cases are
174 carefully selected to cover the most interesting parts of the TCP specification
175 to ensure a test suite.
176
177 To further decrease the number of tests needed test cases are divided into
178 equivalence partitions and the combination of cases as described in
179 Table~\ref{table:testpairs} ensures that all partitions are
180 covered and the number of individual tests is still feasible.
181
182
183 %
184 % wat ik ook probeer ik krijg de eerste collum
185 % zijn tekst niet verticaal gecentered
186 %
187
188
189 \subsection{Test cases}
190
191 %\begin{table}
192 %\begin{tabularx}{\linewidth}{| l | X|}
193 %\hline
194 %Nr & 1 \\\hline
195 %Title & Single valid request. \\\hline
196 %Input & Pcap file with prerecorded valid packets. \\\hline
197 %Expected output & Pcap file with valid response to request. \\\hline
198 %Course of action & \begin{enumerate}
199 % \item Execute \emph{./scripts/tests/case1-single-valid.sh}
200 % \item Load \emph{output/case1.pcap} with ...
201 %\end{enumerate} \\\hline
202 %Valid trace & \begin{enumerate}
203 % \item \textbf{Hier packets benoemen?}
204 %\end{enumerate} \\\hline
205 %\end{tabularx}
206 %
207 %\begin{tabularx}{\linewidth}{| l | X|}
208 % \hline
209 % Nr & 2 \\\hline
210 %Title & Single request with corrupted checksum. \\\hline
211 % Input & Pcap file used as \emph{test-case 1} input. \\\hline
212 % Expected output & No response from SUT, logs with rejected packets. \\\hline
213 % Course of action & \begin{enumerate}
214 % \item Load input pcap file into ....
215 % \item Corrupt checksum of loaded packets.
216 % \item Save resulting packets as pcap file.
217 % \item Load new pcap file into ...
218 % \item Replay new pcap file.
219 % \item Record SUT response using...
220 % \item Extract log with rejected packets.
221 % \item Save recorded packets as a pcap file.
222 % \item Analyze packets in resulting file.
223 % \end{enumerate} \\\hline
224 % Valid trace & \begin{enumerate}
225 % \item \textbf{Aangeven welke packets corrupted zijn?}
226 % \end{enumerate} \\\hline
227 %\end{tabularx}
228 %\end{table}