in the reading of the god of the worm when selenium2+python2.7, it is found that generating Htmltestrunner test reports using the Htmltestrunner module is the Python2 syntax. And I am more accustomed to Python3. And I also use the Python3.4 environment, in the Internet to find a lot of information, modified the next htmltestrunner.py
Reference: http://bbs.chinaunix.net/thread-4154743-1-1.html
: http://tungwaiyip.info/software/HTMLTestRunner.html
after modification Htmltestrunner: Http://pan.baidu.com/s/1tp3Ts
To modify a rollup:
Section 94 Line, change import Stringio to import IO
Section 539 lines, change self.outputbuffer = Stringio.stringio () to self.outputbuffer= io. Stringio ()
Section 642 rows, if not Rmap.has_key (CLS): modified to If NOTCLS in Rmap:
Section 766 lines, change uo = O.decode (' latin-1 ') to UO = e
Section 775 line, change UE = E.decode (' latin-1 ') to UE = e
Section 631 lines, print >> sys.stderr, ' \ntime Elapsed:%s '% (self.stoptime-self.starttime) modified to print (Sys.stderr, ' \ ntimeelapsed:%s '% (self.stoptime-self.starttime))
in the Python3.4 use Htmltestrunner, start, introduce Htmltestrunner module error.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/57/0F/wKiom1SQEMWBM42dAADayP_VDbI930.jpg "style=" float: none; "title=" 1.png "alt=" Wkiom1sqemwbm42daadayp_vdbi930.jpg "/>
in the Htmltestrunner 94 lines, is the use of the Stringio, but Python3, there is no stringio. Instead, it's IO. Stringio. So change this line to import IO
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/57/0D/wKioL1SQEWWCLN6OAACNe_XHb-0276.jpg "title=" 2.png " Style= "Float:none;" alt= "wkiol1sqewwcln6oaacne_xhb-0276.jpg"/>
in the in the Htmltestrunner 539 line, Self.outputbuffer =stringio.stringio () is modified to Self.outputbuffer = IO. Stringio ()
After the modification, the module was successfully introduced.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/57/0D/wKioL1SQEWXQ5nwqAAAfwKWCq7A398.jpg "title=" 3.png " Style= "Float:none;" alt= "wkiol1sqewxq5nwqaaafwkwcq7a398.jpg"/>
After running the test script, the error is found:
File "C:\Python34\lib\HTMLTestRunner.py", line 642, in Sortresult
If not Rmap.has_key (CLS):
so go to 642 lines To modify the code:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/57/0F/wKiom1SQEMWBFOGqAAHk9V7s8aI786.jpg "title=" 4.png " Style= "Float:none;" alt= "wkiom1sqemwbfogqaahk9v7s8ai786.jpg"/>
Continue to error after running:
Attributeerror: ' Str ' object has Noattribute ' decode '
go to 766,772 Lines continue to modify (note: 766 lines is UO and 772 lines is the UE, then blind, did not notice these, thought is the same, leading to some inexplicable errors, tossing half a day):
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/57/0D/wKioL1SQEWWzsaT4AAGhjRJUC8A160.jpg "title=" 5.png " Style= "Float:none;" alt= "wkiol1sqewwzsat4aaghjrjuc8a160.jpg"/>
Modified to run, found and error:
File "C:\Python34\lib\HTMLTestRunner.py", line 631, in run
Print >> sys.stderr, ' \ntime Elapsed:%s '% (self.stoptime-self.starttime)
typeerror:unsupported operand type (s) for >>: ' Builtin_function_or_method ' and ' _io. Textiowrapper '
go to 631 View, discover the entire program, the only one print:
Print >> Sys.stderr, ' \ntimeelapsed:%s '% (self.stoptime-self.starttime
this is 2.x, we modify the print to 3.x, modified as follows:
Print (Sys.stderr, ' \ntime Elapsed:%s '% (self.stoptime-self.starttime))
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/57/0D/wKioL1SQKQiQXaAoAAFswm6x65g015.jpg "style=" float: none; "title=" 6.png "alt=" Wkiol1sqkqiqxaaoaafswm6x65g015.jpg "/>
continue to run the script, OK run successfully
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/57/10/wKiom1SQKGij3vziAAB68boiMbo473.jpg "title=" 7.png " Style= "Float:none;" alt= "wkiom1sqkgij3vziaab68boimbo473.jpg"/>
view the specified directory that generated the result.html
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/57/0D/wKioL1SQKQjQI36aAABV-8qVGGc809.jpg "title=" 8.png " Style= "Float:none;" alt= "wkiol1sqkqjqi36aaabv-8qvggc809.jpg"/>
Click to open the report:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/57/10/wKiom1SQKGjSigDZAAKeYPcKFwY603.jpg "title=" 9.png " Style= "Float:none;" alt= "wkiom1sqkgjsigdzaakeypckfwy603.jpg"/>
Htmltestrunner Modifying the version of Python3