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