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