|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric7.Testing.Interfaces.TestExecutorBase</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.TestExecutorBase</h1> |
|
10 |
|
11 <p> |
|
12 Module implementing the executor base class for the various testing frameworks |
|
13 and supporting classes. |
|
14 </p> |
|
15 <h3>Global Attributes</h3> |
|
16 |
|
17 <table> |
|
18 <tr><td>None</td></tr> |
|
19 </table> |
|
20 <h3>Classes</h3> |
|
21 |
|
22 <table> |
|
23 |
|
24 <tr> |
|
25 <td><a href="#TestConfig">TestConfig</a></td> |
|
26 <td>Class containing the test run configuration.</td> |
|
27 </tr> |
|
28 <tr> |
|
29 <td><a href="#TestExecutorBase">TestExecutorBase</a></td> |
|
30 <td>Base class for test framework specific implementations.</td> |
|
31 </tr> |
|
32 <tr> |
|
33 <td><a href="#TestResult">TestResult</a></td> |
|
34 <td>Class containing the test result data.</td> |
|
35 </tr> |
|
36 <tr> |
|
37 <td><a href="#TestResultCategory">TestResultCategory</a></td> |
|
38 <td>Class defining the supported result categories.</td> |
|
39 </tr> |
|
40 </table> |
|
41 <h3>Functions</h3> |
|
42 |
|
43 <table> |
|
44 <tr><td>None</td></tr> |
|
45 </table> |
|
46 <hr /> |
|
47 <hr /> |
|
48 <a NAME="TestConfig" ID="TestConfig"></a> |
|
49 <h2>TestConfig</h2> |
|
50 |
|
51 <p> |
|
52 Class containing the test run configuration. |
|
53 </p> |
|
54 <h3>Derived from</h3> |
|
55 None |
|
56 <h3>Class Attributes</h3> |
|
57 |
|
58 <table> |
|
59 <tr><td>None</td></tr> |
|
60 </table> |
|
61 <h3>Class Methods</h3> |
|
62 |
|
63 <table> |
|
64 <tr><td>None</td></tr> |
|
65 </table> |
|
66 <h3>Methods</h3> |
|
67 |
|
68 <table> |
|
69 <tr><td>None</td></tr> |
|
70 </table> |
|
71 <h3>Static Methods</h3> |
|
72 |
|
73 <table> |
|
74 <tr><td>None</td></tr> |
|
75 </table> |
|
76 |
|
77 <div align="right"><a href="#top">Up</a></div> |
|
78 <hr /> |
|
79 <hr /> |
|
80 <a NAME="TestExecutorBase" ID="TestExecutorBase"></a> |
|
81 <h2>TestExecutorBase</h2> |
|
82 |
|
83 <p> |
|
84 Base class for test framework specific implementations. |
|
85 </p> |
|
86 <h3>Signals</h3> |
|
87 <dl> |
|
88 |
|
89 <dt>collectError(list of tuple of (str, str)</dt> |
|
90 <dd> |
|
91 ) emitted when errors |
|
92 are encountered during test collection. Tuple elements are the |
|
93 test name and the error message. |
|
94 </dd> |
|
95 <dt>collected(list of tuple of (str, str, str)</dt> |
|
96 <dd> |
|
97 ) emitted after all tests |
|
98 have been collected. Tuple elements are the test id, the test name and |
|
99 a short description of the test. |
|
100 </dd> |
|
101 <dt>coverageDataSaved(str)</dt> |
|
102 <dd> |
|
103 emitted after the coverage data was saved. |
|
104 The element is the absolute path of the coverage data file. |
|
105 </dd> |
|
106 <dt>startTest(tuple of (str, str, str)</dt> |
|
107 <dd> |
|
108 emitted before tests are run. |
|
109 Tuple elements are test id, test name and short description. |
|
110 </dd> |
|
111 <dt>stop()</dt> |
|
112 <dd> |
|
113 emitted when the test process is being stopped. |
|
114 </dd> |
|
115 <dt>testFinished(list, str)</dt> |
|
116 <dd> |
|
117 emitted when the test has finished. |
|
118 The elements are the list of test results and the captured output |
|
119 of the test worker (if any). |
|
120 </dd> |
|
121 <dt>testResult(TestResult)</dt> |
|
122 <dd> |
|
123 emitted when a test result is ready |
|
124 </dd> |
|
125 <dt>testRunAboutToBeStarted()</dt> |
|
126 <dd> |
|
127 emitted just before the test run will |
|
128 be started. |
|
129 </dd> |
|
130 <dt>testRunFinished(int, float)</dt> |
|
131 <dd> |
|
132 emitted when the test run has finished. |
|
133 The elements are the number of tests run and the duration in seconds |
|
134 </dd> |
|
135 </dl> |
|
136 <h3>Derived from</h3> |
|
137 QObject |
|
138 <h3>Class Attributes</h3> |
|
139 |
|
140 <table> |
|
141 <tr><td>module</td></tr><tr><td>name</td></tr><tr><td>runner</td></tr> |
|
142 </table> |
|
143 <h3>Class Methods</h3> |
|
144 |
|
145 <table> |
|
146 |
|
147 <tr> |
|
148 <td><a href="#TestExecutorBase.isInstalled">isInstalled</a></td> |
|
149 <td>Class method to check whether a test framework is installed.</td> |
|
150 </tr> |
|
151 </table> |
|
152 <h3>Methods</h3> |
|
153 |
|
154 <table> |
|
155 |
|
156 <tr> |
|
157 <td><a href="#TestExecutorBase.__init__">TestExecutorBase</a></td> |
|
158 <td>Constructor</td> |
|
159 </tr> |
|
160 <tr> |
|
161 <td><a href="#TestExecutorBase._prepareProcess">_prepareProcess</a></td> |
|
162 <td>Protected method to prepare a process object to be started.</td> |
|
163 </tr> |
|
164 <tr> |
|
165 <td><a href="#TestExecutorBase.createArguments">createArguments</a></td> |
|
166 <td>Public method to create the arguments needed to start the test process.</td> |
|
167 </tr> |
|
168 <tr> |
|
169 <td><a href="#TestExecutorBase.finished">finished</a></td> |
|
170 <td>Public method handling the unit test process been finished.</td> |
|
171 </tr> |
|
172 <tr> |
|
173 <td><a href="#TestExecutorBase.getVersions">getVersions</a></td> |
|
174 <td>Public method to get the test framework version and version information of its installed plugins.</td> |
|
175 </tr> |
|
176 <tr> |
|
177 <td><a href="#TestExecutorBase.hasCoverage">hasCoverage</a></td> |
|
178 <td>Public method to get the test framework version and version information of its installed plugins.</td> |
|
179 </tr> |
|
180 <tr> |
|
181 <td><a href="#TestExecutorBase.readAllOutput">readAllOutput</a></td> |
|
182 <td>Public method to read all output of the test process.</td> |
|
183 </tr> |
|
184 <tr> |
|
185 <td><a href="#TestExecutorBase.start">start</a></td> |
|
186 <td>Public method to start the testing process.</td> |
|
187 </tr> |
|
188 <tr> |
|
189 <td><a href="#TestExecutorBase.stopIfRunning">stopIfRunning</a></td> |
|
190 <td>Public method to stop the testing process, if it is running.</td> |
|
191 </tr> |
|
192 </table> |
|
193 <h3>Static Methods</h3> |
|
194 |
|
195 <table> |
|
196 <tr><td>None</td></tr> |
|
197 </table> |
|
198 |
|
199 <a NAME="TestExecutorBase.isInstalled" ID="TestExecutorBase.isInstalled"></a> |
|
200 <h4>TestExecutorBase.isInstalled (class method)</h4> |
|
201 <b>isInstalled</b>(<i>interpreter</i>) |
|
202 |
|
203 <p> |
|
204 Class method to check whether a test framework is installed. |
|
205 </p> |
|
206 <p> |
|
207 The test is performed by checking, if a module loader can found. |
|
208 </p> |
|
209 <dl> |
|
210 |
|
211 <dt><i>interpreter</i> (str)</dt> |
|
212 <dd> |
|
213 interpreter to be used for the test |
|
214 </dd> |
|
215 </dl> |
|
216 <dl> |
|
217 <dt>Return:</dt> |
|
218 <dd> |
|
219 flag indicating the test framework module is installed |
|
220 </dd> |
|
221 </dl> |
|
222 <dl> |
|
223 <dt>Return Type:</dt> |
|
224 <dd> |
|
225 bool |
|
226 </dd> |
|
227 </dl> |
|
228 <a NAME="TestExecutorBase.__init__" ID="TestExecutorBase.__init__"></a> |
|
229 <h4>TestExecutorBase (Constructor)</h4> |
|
230 <b>TestExecutorBase</b>(<i>testWidget</i>) |
|
231 |
|
232 <p> |
|
233 Constructor |
|
234 </p> |
|
235 <dl> |
|
236 |
|
237 <dt><i>testWidget</i> (TestingWidget)</dt> |
|
238 <dd> |
|
239 reference to the unit test widget |
|
240 </dd> |
|
241 </dl> |
|
242 <a NAME="TestExecutorBase._prepareProcess" ID="TestExecutorBase._prepareProcess"></a> |
|
243 <h4>TestExecutorBase._prepareProcess</h4> |
|
244 <b>_prepareProcess</b>(<i>workDir, pythonpath</i>) |
|
245 |
|
246 <p> |
|
247 Protected method to prepare a process object to be started. |
|
248 </p> |
|
249 <dl> |
|
250 |
|
251 <dt><i>workDir</i> (str)</dt> |
|
252 <dd> |
|
253 working directory |
|
254 </dd> |
|
255 <dt><i>pythonpath</i> (list of str)</dt> |
|
256 <dd> |
|
257 list of directories to be added to the Python path |
|
258 </dd> |
|
259 </dl> |
|
260 <dl> |
|
261 <dt>Return:</dt> |
|
262 <dd> |
|
263 prepared process object |
|
264 </dd> |
|
265 </dl> |
|
266 <dl> |
|
267 <dt>Return Type:</dt> |
|
268 <dd> |
|
269 QProcess |
|
270 </dd> |
|
271 </dl> |
|
272 <a NAME="TestExecutorBase.createArguments" ID="TestExecutorBase.createArguments"></a> |
|
273 <h4>TestExecutorBase.createArguments</h4> |
|
274 <b>createArguments</b>(<i>config</i>) |
|
275 |
|
276 <p> |
|
277 Public method to create the arguments needed to start the test process. |
|
278 </p> |
|
279 <dl> |
|
280 |
|
281 <dt><i>config</i> (TestConfig)</dt> |
|
282 <dd> |
|
283 configuration for the test execution |
|
284 </dd> |
|
285 </dl> |
|
286 <dl> |
|
287 <dt>Return:</dt> |
|
288 <dd> |
|
289 list of process arguments |
|
290 </dd> |
|
291 </dl> |
|
292 <dl> |
|
293 <dt>Return Type:</dt> |
|
294 <dd> |
|
295 list of str |
|
296 </dd> |
|
297 </dl> |
|
298 <dl> |
|
299 |
|
300 <dt>Raises <b>NotImplementedError</b>:</dt> |
|
301 <dd> |
|
302 this method needs to be implemented by |
|
303 derived classes |
|
304 </dd> |
|
305 </dl> |
|
306 <a NAME="TestExecutorBase.finished" ID="TestExecutorBase.finished"></a> |
|
307 <h4>TestExecutorBase.finished</h4> |
|
308 <b>finished</b>(<i></i>) |
|
309 |
|
310 <p> |
|
311 Public method handling the unit test process been finished. |
|
312 </p> |
|
313 <p> |
|
314 This method should read the results (if necessary) and emit the signal |
|
315 testFinished. |
|
316 </p> |
|
317 <dl> |
|
318 |
|
319 <dt>Raises <b>NotImplementedError</b>:</dt> |
|
320 <dd> |
|
321 this method needs to be implemented by |
|
322 derived classes |
|
323 </dd> |
|
324 </dl> |
|
325 <a NAME="TestExecutorBase.getVersions" ID="TestExecutorBase.getVersions"></a> |
|
326 <h4>TestExecutorBase.getVersions</h4> |
|
327 <b>getVersions</b>(<i>interpreter</i>) |
|
328 |
|
329 <p> |
|
330 Public method to get the test framework version and version information |
|
331 of its installed plugins. |
|
332 </p> |
|
333 <dl> |
|
334 |
|
335 <dt><i>interpreter</i> (str)</dt> |
|
336 <dd> |
|
337 interpreter to be used for the test |
|
338 </dd> |
|
339 </dl> |
|
340 <dl> |
|
341 <dt>Return:</dt> |
|
342 <dd> |
|
343 dictionary containing the framework name and version and the |
|
344 list of available plugins with name and version each |
|
345 </dd> |
|
346 </dl> |
|
347 <dl> |
|
348 <dt>Return Type:</dt> |
|
349 <dd> |
|
350 dict |
|
351 </dd> |
|
352 </dl> |
|
353 <dl> |
|
354 |
|
355 <dt>Raises <b>NotImplementedError</b>:</dt> |
|
356 <dd> |
|
357 this method needs to be implemented by |
|
358 derived classes |
|
359 </dd> |
|
360 </dl> |
|
361 <a NAME="TestExecutorBase.hasCoverage" ID="TestExecutorBase.hasCoverage"></a> |
|
362 <h4>TestExecutorBase.hasCoverage</h4> |
|
363 <b>hasCoverage</b>(<i>interpreter</i>) |
|
364 |
|
365 <p> |
|
366 Public method to get the test framework version and version information |
|
367 of its installed plugins. |
|
368 </p> |
|
369 <dl> |
|
370 |
|
371 <dt><i>interpreter</i> (str)</dt> |
|
372 <dd> |
|
373 interpreter to be used for the test |
|
374 </dd> |
|
375 </dl> |
|
376 <dl> |
|
377 <dt>Return:</dt> |
|
378 <dd> |
|
379 flag indicating the availability of coverage functionality |
|
380 </dd> |
|
381 </dl> |
|
382 <dl> |
|
383 <dt>Return Type:</dt> |
|
384 <dd> |
|
385 bool |
|
386 </dd> |
|
387 </dl> |
|
388 <dl> |
|
389 |
|
390 <dt>Raises <b>NotImplementedError</b>:</dt> |
|
391 <dd> |
|
392 this method needs to be implemented by |
|
393 derived classes |
|
394 </dd> |
|
395 </dl> |
|
396 <a NAME="TestExecutorBase.readAllOutput" ID="TestExecutorBase.readAllOutput"></a> |
|
397 <h4>TestExecutorBase.readAllOutput</h4> |
|
398 <b>readAllOutput</b>(<i>process=None</i>) |
|
399 |
|
400 <p> |
|
401 Public method to read all output of the test process. |
|
402 </p> |
|
403 <dl> |
|
404 |
|
405 <dt><i>process</i> (QProcess)</dt> |
|
406 <dd> |
|
407 reference to the process object |
|
408 </dd> |
|
409 </dl> |
|
410 <dl> |
|
411 <dt>Return:</dt> |
|
412 <dd> |
|
413 test process output |
|
414 </dd> |
|
415 </dl> |
|
416 <dl> |
|
417 <dt>Return Type:</dt> |
|
418 <dd> |
|
419 str |
|
420 </dd> |
|
421 </dl> |
|
422 <a NAME="TestExecutorBase.start" ID="TestExecutorBase.start"></a> |
|
423 <h4>TestExecutorBase.start</h4> |
|
424 <b>start</b>(<i>config, pythonpath</i>) |
|
425 |
|
426 <p> |
|
427 Public method to start the testing process. |
|
428 </p> |
|
429 <dl> |
|
430 |
|
431 <dt><i>config</i> (TestConfig)</dt> |
|
432 <dd> |
|
433 configuration for the test execution |
|
434 </dd> |
|
435 <dt><i>pythonpath</i> (list of str)</dt> |
|
436 <dd> |
|
437 list of directories to be added to the Python path |
|
438 </dd> |
|
439 </dl> |
|
440 <dl> |
|
441 |
|
442 <dt>Raises <b>RuntimeError</b>:</dt> |
|
443 <dd> |
|
444 raised if the the testing process did not start |
|
445 </dd> |
|
446 </dl> |
|
447 <a NAME="TestExecutorBase.stopIfRunning" ID="TestExecutorBase.stopIfRunning"></a> |
|
448 <h4>TestExecutorBase.stopIfRunning</h4> |
|
449 <b>stopIfRunning</b>(<i></i>) |
|
450 |
|
451 <p> |
|
452 Public method to stop the testing process, if it is running. |
|
453 </p> |
|
454 <div align="right"><a href="#top">Up</a></div> |
|
455 <hr /> |
|
456 <hr /> |
|
457 <a NAME="TestResult" ID="TestResult"></a> |
|
458 <h2>TestResult</h2> |
|
459 |
|
460 <p> |
|
461 Class containing the test result data. |
|
462 </p> |
|
463 <h3>Derived from</h3> |
|
464 None |
|
465 <h3>Class Attributes</h3> |
|
466 |
|
467 <table> |
|
468 <tr><td>None</td></tr> |
|
469 </table> |
|
470 <h3>Class Methods</h3> |
|
471 |
|
472 <table> |
|
473 <tr><td>None</td></tr> |
|
474 </table> |
|
475 <h3>Methods</h3> |
|
476 |
|
477 <table> |
|
478 <tr><td>None</td></tr> |
|
479 </table> |
|
480 <h3>Static Methods</h3> |
|
481 |
|
482 <table> |
|
483 <tr><td>None</td></tr> |
|
484 </table> |
|
485 |
|
486 <div align="right"><a href="#top">Up</a></div> |
|
487 <hr /> |
|
488 <hr /> |
|
489 <a NAME="TestResultCategory" ID="TestResultCategory"></a> |
|
490 <h2>TestResultCategory</h2> |
|
491 |
|
492 <p> |
|
493 Class defining the supported result categories. |
|
494 </p> |
|
495 <h3>Derived from</h3> |
|
496 IntEnum |
|
497 <h3>Class Attributes</h3> |
|
498 |
|
499 <table> |
|
500 <tr><td>FAIL</td></tr><tr><td>OK</td></tr><tr><td>PENDING</td></tr><tr><td>RUNNING</td></tr><tr><td>SKIP</td></tr> |
|
501 </table> |
|
502 <h3>Class Methods</h3> |
|
503 |
|
504 <table> |
|
505 <tr><td>None</td></tr> |
|
506 </table> |
|
507 <h3>Methods</h3> |
|
508 |
|
509 <table> |
|
510 <tr><td>None</td></tr> |
|
511 </table> |
|
512 <h3>Static Methods</h3> |
|
513 |
|
514 <table> |
|
515 <tr><td>None</td></tr> |
|
516 </table> |
|
517 |
|
518 <div align="right"><a href="#top">Up</a></div> |
|
519 <hr /> |
|
520 </body></html> |