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