├── HTMLTestRunner.py
├── README
├── sample_test_report.html
└── test_HTMLTestRunner.py
/HTMLTestRunner.py:
--------------------------------------------------------------------------------
1 | """
2 | A TestRunner for use with the Python unit testing framework. It
3 | generates a HTML report to show the result at a glance.
4 |
5 | The simplest way to use this is to invoke its main method. E.g.
6 |
7 | import unittest
8 | import HTMLTestRunner
9 |
10 | ... define your tests ...
11 |
12 | if __name__ == '__main__':
13 | HTMLTestRunner.main()
14 |
15 |
16 | For more customization options, instantiates a HTMLTestRunner object.
17 | HTMLTestRunner is a counterpart to unittest's TextTestRunner. E.g.
18 |
19 | # output to a file
20 | fp = file('my_report.html', 'wb')
21 | runner = HTMLTestRunner.HTMLTestRunner(
22 | stream=fp,
23 | title='My unit test',
24 | description='This demonstrates the report output by HTMLTestRunner.'
25 | )
26 |
27 | # Use an external stylesheet.
28 | # See the Template_mixin class for more customizable options
29 | runner.STYLESHEET_TMPL = ''
30 |
31 | # run the test
32 | runner.run(my_test_suite)
33 |
34 |
35 | ------------------------------------------------------------------------
36 | Copyright (c) 2004-2007, Wai Yip Tung
37 | All rights reserved.
38 |
39 | Redistribution and use in source and binary forms, with or without
40 | modification, are permitted provided that the following conditions are
41 | met:
42 |
43 | * Redistributions of source code must retain the above copyright notice,
44 | this list of conditions and the following disclaimer.
45 | * Redistributions in binary form must reproduce the above copyright
46 | notice, this list of conditions and the following disclaimer in the
47 | documentation and/or other materials provided with the distribution.
48 | * Neither the name Wai Yip Tung nor the names of its contributors may be
49 | used to endorse or promote products derived from this software without
50 | specific prior written permission.
51 |
52 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
53 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
54 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
55 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
56 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
57 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
58 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
59 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
60 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
61 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
62 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
63 | """
64 |
65 | # URL: http://tungwaiyip.info/software/HTMLTestRunner.html
66 |
67 | __author__ = "Wai Yip Tung"
68 | __version__ = "0.8.3"
69 |
70 |
71 | """
72 | Change History
73 |
74 | Version 0.8.3
75 | * Prevent crash on class or module-level exceptions (Darren Wurf).
76 |
77 | Version 0.8.2
78 | * Show output inline instead of popup window (Viorel Lupu).
79 |
80 | Version in 0.8.1
81 | * Validated XHTML (Wolfgang Borgert).
82 | * Added description of test classes and test cases.
83 |
84 | Version in 0.8.0
85 | * Define Template_mixin class for customization.
86 | * Workaround a IE 6 bug that it does not treat
301 |
302 | %(heading)s
303 | %(report)s
304 | %(ending)s
305 |
306 |