After the automated test is complete, we need to generate a test report to view the test results and use the Htmltestrunner module to directly generate the HTML-formatted report.
Test Report generation
Download Address : http://tungwaiyip.info/software/HTMLTestRunner.html
Because the template for this report was written by a master in Python 2.x, we used Python 3.x, so we need to make the following modifications.
after download modify: 94 line introduced name, from import Stringio to import IO 539 line Self.outputbuffer=stringio.stringio () changed to self.outputbuffer= Io. Stringio () 631 line print>>sys.stderr, ' \ntime elapsed:%s '% (self.stoptime-self-starttime) modified to print (Sys.stderr, ' \ Ntime elapsed:%s '% (self.stoptime-self-starttime)) 642 rows if not Rmap.has_key (CLS) replaced by if not CLS in rmap:766 row Uoo.decode (' l Atin-1 ') changed to Uo=o 772 lines Ue=e.decode (' latin-1) to Ue=e
Storage Path:
Store the modified files in the C:\...\python36\lib
the actual use of the code:
Or the previous case of Baidu (https://mp.csdn.net/postedit/80067833), modify the runtest.py, as follows:
At the end of the run, the test report is placed in the directory we wrote in our code, and the file name is written as code:
The test report format is as follows:
Test Report Optimization
Found a better template on the web.
Download Address: Https://github.com/easonhan007/HTMLTestRunner
After decompression, place the bstestrunner.py in the C:\...\python36\lib
Modify runtest.py as follows:
Run the code and test the report as follows:
The test report reported an error because it was not very familiar to Python, so I downloaded a bstestrunner.py with the following address: https://download.csdn.net/download/qq_21205435/9980658
Then run the Post test report as follows:
It's still an error. See the error message, suspicion is the cause of the drive. Originally used in Chrome browser, changed to Firefox browser, there is no error: