src/eric7/Documentation/Source/eric7.Testing.Interfaces.UnittestRunner.html

branch
eric7
changeset 9209
b99e7fd55fd3
parent 9097
213951c41dcd
child 10407
03b41b9bb392
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric7.Testing.Interfaces.UnittestRunner</title>
4 <meta charset="UTF-8">
5 <link rel="stylesheet" href="styles.css">
6 </head>
7 <body>
8 <a NAME="top" ID="top"></a>
9 <h1>eric7.Testing.Interfaces.UnittestRunner</h1>
10
11 <p>
12 Module implementing the test runner script for the 'unittest' framework.
13 </p>
14 <h3>Global Attributes</h3>
15
16 <table>
17 <tr><td>None</td></tr>
18 </table>
19 <h3>Classes</h3>
20
21 <table>
22
23 <tr>
24 <td><a href="#EricTestResult">EricTestResult</a></td>
25 <td>Class implementing a TestResult derivative to send the data via a network connection.</td>
26 </tr>
27 </table>
28 <h3>Functions</h3>
29
30 <table>
31
32 <tr>
33 <td><a href="#_assembleTestCasesList">_assembleTestCasesList</a></td>
34 <td>Protected function to assemble a list of test cases included in a test suite.</td>
35 </tr>
36 <tr>
37 <td><a href="#runtest">runtest</a></td>
38 <td>Function to run the tests.</td>
39 </tr>
40 </table>
41 <hr />
42 <hr />
43 <a NAME="EricTestResult" ID="EricTestResult"></a>
44 <h2>EricTestResult</h2>
45
46 <p>
47 Class implementing a TestResult derivative to send the data via a network
48 connection.
49 </p>
50 <h3>Derived from</h3>
51 unittest.TestResult
52 <h3>Class Attributes</h3>
53
54 <table>
55 <tr><td>None</td></tr>
56 </table>
57 <h3>Class Methods</h3>
58
59 <table>
60 <tr><td>None</td></tr>
61 </table>
62 <h3>Methods</h3>
63
64 <table>
65
66 <tr>
67 <td><a href="#EricTestResult.__init__">EricTestResult</a></td>
68 <td>Constructor</td>
69 </tr>
70 <tr>
71 <td><a href="#EricTestResult.addError">addError</a></td>
72 <td>Public method called if a test errored.</td>
73 </tr>
74 <tr>
75 <td><a href="#EricTestResult.addExpectedFailure">addExpectedFailure</a></td>
76 <td>Public method called if a test failed expected.</td>
77 </tr>
78 <tr>
79 <td><a href="#EricTestResult.addFailure">addFailure</a></td>
80 <td>Public method called if a test failed.</td>
81 </tr>
82 <tr>
83 <td><a href="#EricTestResult.addSkip">addSkip</a></td>
84 <td>Public method called if a test was skipped.</td>
85 </tr>
86 <tr>
87 <td><a href="#EricTestResult.addSubTest">addSubTest</a></td>
88 <td>Public method called for each subtest to record its result.</td>
89 </tr>
90 <tr>
91 <td><a href="#EricTestResult.addUnexpectedSuccess">addUnexpectedSuccess</a></td>
92 <td>Public method called if a test succeeded expectedly.</td>
93 </tr>
94 <tr>
95 <td><a href="#EricTestResult.startTest">startTest</a></td>
96 <td>Public method called at the start of a test.</td>
97 </tr>
98 <tr>
99 <td><a href="#EricTestResult.startTestRun">startTestRun</a></td>
100 <td>Public method called once before any tests are executed.</td>
101 </tr>
102 <tr>
103 <td><a href="#EricTestResult.stopTest">stopTest</a></td>
104 <td>Public method called at the end of a test.</td>
105 </tr>
106 <tr>
107 <td><a href="#EricTestResult.stopTestRun">stopTestRun</a></td>
108 <td>Public method called once after all tests are executed.</td>
109 </tr>
110 </table>
111 <h3>Static Methods</h3>
112
113 <table>
114 <tr><td>None</td></tr>
115 </table>
116
117 <a NAME="EricTestResult.__init__" ID="EricTestResult.__init__"></a>
118 <h4>EricTestResult (Constructor)</h4>
119 <b>EricTestResult</b>(<i>writer, failfast</i>)
120
121 <p>
122 Constructor
123 </p>
124 <dl>
125
126 <dt><i>writer</i> (EricJsonWriter)</dt>
127 <dd>
128 reference to the object to write the results to
129 </dd>
130 <dt><i>failfast</i> (bool)</dt>
131 <dd>
132 flag indicating to stop at the first error
133 </dd>
134 </dl>
135 <a NAME="EricTestResult.addError" ID="EricTestResult.addError"></a>
136 <h4>EricTestResult.addError</h4>
137 <b>addError</b>(<i>test, err</i>)
138
139 <p>
140 Public method called if a test errored.
141 </p>
142 <dl>
143
144 <dt><i>test</i> (TestCase)</dt>
145 <dd>
146 reference to the test object
147 </dd>
148 <dt><i>err</i> (tuple)</dt>
149 <dd>
150 tuple containing the exception data like sys.exc_info
151 (exception type, exception instance, traceback)
152 </dd>
153 </dl>
154 <a NAME="EricTestResult.addExpectedFailure" ID="EricTestResult.addExpectedFailure"></a>
155 <h4>EricTestResult.addExpectedFailure</h4>
156 <b>addExpectedFailure</b>(<i>test, err</i>)
157
158 <p>
159 Public method called if a test failed expected.
160 </p>
161 <dl>
162
163 <dt><i>test</i> (TestCase)</dt>
164 <dd>
165 reference to the test object
166 </dd>
167 <dt><i>err</i> (tuple)</dt>
168 <dd>
169 tuple containing the exception data like sys.exc_info
170 (exception type, exception instance, traceback)
171 </dd>
172 </dl>
173 <a NAME="EricTestResult.addFailure" ID="EricTestResult.addFailure"></a>
174 <h4>EricTestResult.addFailure</h4>
175 <b>addFailure</b>(<i>test, err</i>)
176
177 <p>
178 Public method called if a test failed.
179 </p>
180 <dl>
181
182 <dt><i>test</i> (TestCase)</dt>
183 <dd>
184 reference to the test object
185 </dd>
186 <dt><i>err</i> (tuple)</dt>
187 <dd>
188 tuple containing the exception data like sys.exc_info
189 (exception type, exception instance, traceback)
190 </dd>
191 </dl>
192 <a NAME="EricTestResult.addSkip" ID="EricTestResult.addSkip"></a>
193 <h4>EricTestResult.addSkip</h4>
194 <b>addSkip</b>(<i>test, reason</i>)
195
196 <p>
197 Public method called if a test was skipped.
198 </p>
199 <dl>
200
201 <dt><i>test</i> (TestCase)</dt>
202 <dd>
203 reference to the test object
204 </dd>
205 <dt><i>reason</i> (str)</dt>
206 <dd>
207 reason for skipping the test
208 </dd>
209 </dl>
210 <a NAME="EricTestResult.addSubTest" ID="EricTestResult.addSubTest"></a>
211 <h4>EricTestResult.addSubTest</h4>
212 <b>addSubTest</b>(<i>test, subtest, err</i>)
213
214 <p>
215 Public method called for each subtest to record its result.
216 </p>
217 <dl>
218
219 <dt><i>test</i> (TestCase)</dt>
220 <dd>
221 reference to the test object
222 </dd>
223 <dt><i>subtest</i> (TestCase)</dt>
224 <dd>
225 reference to the subtest object
226 </dd>
227 <dt><i>err</i> (tuple)</dt>
228 <dd>
229 tuple containing the exception data like sys.exc_info
230 (exception type, exception instance, traceback)
231 </dd>
232 </dl>
233 <a NAME="EricTestResult.addUnexpectedSuccess" ID="EricTestResult.addUnexpectedSuccess"></a>
234 <h4>EricTestResult.addUnexpectedSuccess</h4>
235 <b>addUnexpectedSuccess</b>(<i>test</i>)
236
237 <p>
238 Public method called if a test succeeded expectedly.
239 </p>
240 <dl>
241
242 <dt><i>test</i> (TestCase)</dt>
243 <dd>
244 reference to the test object
245 </dd>
246 </dl>
247 <a NAME="EricTestResult.startTest" ID="EricTestResult.startTest"></a>
248 <h4>EricTestResult.startTest</h4>
249 <b>startTest</b>(<i>test</i>)
250
251 <p>
252 Public method called at the start of a test.
253 </p>
254 <dl>
255
256 <dt><i>test</i> (TestCase)</dt>
257 <dd>
258 reference to the test object
259 </dd>
260 </dl>
261 <a NAME="EricTestResult.startTestRun" ID="EricTestResult.startTestRun"></a>
262 <h4>EricTestResult.startTestRun</h4>
263 <b>startTestRun</b>(<i></i>)
264
265 <p>
266 Public method called once before any tests are executed.
267 </p>
268 <a NAME="EricTestResult.stopTest" ID="EricTestResult.stopTest"></a>
269 <h4>EricTestResult.stopTest</h4>
270 <b>stopTest</b>(<i>test</i>)
271
272 <p>
273 Public method called at the end of a test.
274 </p>
275 <dl>
276
277 <dt><i>test</i> (TestCase)</dt>
278 <dd>
279 reference to the test object
280 </dd>
281 </dl>
282 <a NAME="EricTestResult.stopTestRun" ID="EricTestResult.stopTestRun"></a>
283 <h4>EricTestResult.stopTestRun</h4>
284 <b>stopTestRun</b>(<i></i>)
285
286 <p>
287 Public method called once after all tests are executed.
288 </p>
289 <div align="right"><a href="#top">Up</a></div>
290 <hr />
291 <hr />
292 <a NAME="_assembleTestCasesList" ID="_assembleTestCasesList"></a>
293 <h2>_assembleTestCasesList</h2>
294 <b>_assembleTestCasesList</b>(<i>suite</i>)
295
296 <p>
297 Protected function to assemble a list of test cases included in a test
298 suite.
299 </p>
300 <dl>
301
302 <dt><i>suite</i> (unittest.TestSuite)</dt>
303 <dd>
304 test suite to be inspected
305 </dd>
306 </dl>
307 <dl>
308 <dt>Return:</dt>
309 <dd>
310 list of tuples containing the test case ID, the string
311 representation and the short description
312 </dd>
313 </dl>
314 <dl>
315 <dt>Return Type:</dt>
316 <dd>
317 list of tuples of (str, str)
318 </dd>
319 </dl>
320 <div align="right"><a href="#top">Up</a></div>
321 <hr />
322 <hr />
323 <a NAME="runtest" ID="runtest"></a>
324 <h2>runtest</h2>
325 <b>runtest</b>(<i>argv</i>)
326
327 <p>
328 Function to run the tests.
329 </p>
330 <dl>
331
332 <dt><i>argv</i> (list of str)</dt>
333 <dd>
334 list of command line parameters.
335 </dd>
336 </dl>
337 <div align="right"><a href="#top">Up</a></div>
338 <hr />
339 </body></html>

eric ide

mercurial