Start with explenation of partitions
[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 bit flips
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 These partitions were chosen since they correspond to key parts of the TCP
124 specification.
125
126 TCP segments are send over a TCP connection from a \emph{source} to a \emph{destination port}. Therefore segments which are received which have a
127 source or destination port set to an incorrect value should not be regarded
128 as segments belonging to the connection.
129
130 TCP uses a \emph{checksum} to catch any error introduced in headers, when this
131 checksum does not match the actual computed checksum the packet should be
132 disregarded.
133
134 The TCP checksum is also an inherently weak one, as it is simply the
135 bitwise negation of the addition in ones complement arithmetic
136 of all 16 bit words in the header and data of the segment (excluding the
137 header). Therefore any bit error where the ones complement value of one word
138 increases by one, and the value of another decreases by one, is undetected.
139 The SUT should exhibit the same behavior and accept packets where these type
140 of bit error occur.
141
142 \textbf{hier iets over waarom deze partities relevant zijn! Waarom odd en
143 even number of bits flipped bijv interessant?}
144 \bigskip
145
146 Partitions 2 to 6 are tested using pairwise testing to keep the number of test
147 cases feasible. The pairs are then all *except some where it does not make sense
148 to do so) tested with the different request sizes of partition 1.
149
150 This is expressed in Table~\ref{table:testpairs}.
151
152 \begin{table}
153 % DIT MAAK IK NOG EVEN MOOI
154 \begin{tabularx}{\linewidth}{p{2cm} | l | p{2cm} | l | p{1cm} || c | c | p{1.3cm} | p{1.3cm}}
155 \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
156 Correct & Correct & Correct & In order & Correct & \checkmark & \checkmark & \checkmark & \checkmark \\ \hline
157 Correct & Incorrect & Incorrect & Missing packet & Incorrect & \xmark & \xmark & \checkmark & \checkmark \\ \hline
158 odd\# of bits flipped & Correct & Incorrect & Out of order & Incorrect & \xmark & \xmark & \checkmark & \checkmark \\ \hline
159 odd\# of bits flipped & Incorrect & Correct & Missing packet & Correct & \xmark & \xmark & \checkmark & \checkmark \\ \hline
160 even\# of bits flipped & Correct & Incorrect & Missing packet & Correct & \xmark & \xmark & \checkmark & \checkmark \\ \hline
161 even\# of bits flipped & Incorrect & Correct & Out of order & Incorrect & \xmark & \xmark & \checkmark & \checkmark \\ \hline
162 odd\# of bits flipped & Incorrect & Incorrect & In order & Incorrect & \checkmark & \checkmark & \checkmark & \checkmark \\ \hline
163 even\# of bits flipped & Incorrect & Incorrect & In order & Incorrect & \checkmark & \checkmark & \checkmark & \checkmark \\ \hline
164 Correct & Incorrect & Incorrect & Out of order & Correct & \xmark & \xmark & \checkmark & \checkmark \\
165 \end{tabularx}
166 \caption{Combinations of test cases}
167 \label{table:testpairs}
168 \end{table}
169
170 \subsection{Quality, completeness and coverage of tests}
171
172 The network packets used in testing are constructed from prerecorded, known to
173 be correct, network traffic. These packets are then modified with well used and
174 field tested tools. Due to this the chance of errors in the test cases is quite
175 low. However, no formal proof of correctness of the test cases is present, this
176 means that any defects found might not be the result of a fault in the SUT.
177 Therefore detected defects should only indicate there is a high chance that
178 there is a fault in the SUT and can not result directly in the conclusion that
179 there actually is one.
180
181 \bigskip
182
183 Due to the nature of black-box testing coverage of the code in the
184 implementation of the SUT is unknown. However completeness of the tests over
185 the specification of the SUT can be assessed.
186
187 \bigskip
188
189 Due to the clear and exhaustive specification of TCP the completeness of the
190 test suite can be clearly assessed.
191
192 As always, $100\%$ completeness is not feasible, therefore test cases are
193 carefully selected to cover the most interesting parts of the TCP specification
194 to ensure a test suite.
195
196 To further decrease the number of tests needed test cases are divided into
197 equivalence partitions and the combination of cases as described in
198 Table~\ref{table:testpairs} ensures that all partitions are
199 covered and the number of individual tests is still feasible.
200
201
202 %
203 % wat ik ook probeer ik krijg de eerste collum
204 % zijn tekst niet verticaal gecentered
205 %
206
207
208 \subsection{Test cases}
209
210 %\begin{table}
211 %\begin{tabularx}{\linewidth}{| l | X|}
212 %\hline
213 %Nr & 1 \\\hline
214 %Title & Single valid request. \\\hline
215 %Input & Pcap file with prerecorded valid packets. \\\hline
216 %Expected output & Pcap file with valid response to request. \\\hline
217 %Course of action & \begin{enumerate}
218 % \item Execute \emph{./scripts/tests/case1-single-valid.sh}
219 % \item Load \emph{output/case1.pcap} with ...
220 %\end{enumerate} \\\hline
221 %Valid trace & \begin{enumerate}
222 % \item \textbf{Hier packets benoemen?}
223 %\end{enumerate} \\\hline
224 %\end{tabularx}
225 %
226 %\begin{tabularx}{\linewidth}{| l | X|}
227 % \hline
228 % Nr & 2 \\\hline
229 %Title & Single request with corrupted checksum. \\\hline
230 % Input & Pcap file used as \emph{test-case 1} input. \\\hline
231 % Expected output & No response from SUT, logs with rejected packets. \\\hline
232 % Course of action & \begin{enumerate}
233 % \item Load input pcap file into ....
234 % \item Corrupt checksum of loaded packets.
235 % \item Save resulting packets as pcap file.
236 % \item Load new pcap file into ...
237 % \item Replay new pcap file.
238 % \item Record SUT response using...
239 % \item Extract log with rejected packets.
240 % \item Save recorded packets as a pcap file.
241 % \item Analyze packets in resulting file.
242 % \end{enumerate} \\\hline
243 % Valid trace & \begin{enumerate}
244 % \item \textbf{Aangeven welke packets corrupted zijn?}
245 % \end{enumerate} \\\hline
246 %\end{tabularx}
247 %\end{table}