(Forty-five) HTML test report advanced applications of automated test - modify HTMLTestRunner

Essays and records to facilitate their access to fellow travelers.

#------------------------------------------------I ------------------------------------------- dividing line is a shame

  Learning before selenium automation, it is best to learn HTML, CSS, JavaScript and other knowledge, help to understand the principles of operation and positioning elements. About python and selenium install any additional information please search on their own here do not introduced, all examples are performed using python3.6 + selenium.

#------------------------------------------------I ------------------------------------------- dividing line is a shame

HTML test report

In terms of software testers, test output is difficult to measure. In other words, the value of the testers more difficult to quantify and evaluate, I believe that the software testers deep. We spend a lot of time and effort doing automated as well. So, we need a beautiful and easy to understand test reports to demonstrate automated test results. Obviously, a simple Log files is not enough.

HTMLTestRunner is Python standard library unittest a testing framework extension unit, which is easy to use to generate HTML test report. HTMLTestRunner in BSD release under license.

Download the following address:

http://tungwaiyip.info/software/HTMLTestRunner.html

This extension is very simple, just a HTMLTestRunner.py file, select it and click the right mouse button, the pop-up shortcut menu select Save Target As, save it locally. Installation is simple, assign it to a Python installation directory.

Windows : Save the downloaded file to the .. \ Python3.6 \ Lib directory.

Linux : to Ubuntu , for example, you first need to open a terminal and find Python installation directory. After opening the terminal, enter Python commands into the Python interactive mode, by sys.path can view native Python3 installation directory.

The author is Windows , place the path as shown below:

 

Modify HTMLTestRunner

Because HTMLTestRunner.py is based Python2 developed in order to support python3 the environment, the need on the part of the contents of the edit. Here opened by the editor HTMLTestRunner.py

Need to modify the following positions:

# 94 line

import StringIO

change into:

import I

 

#第539行

self.outputBuffer = StringIO.StringIO()

change into:

self.outputBuffer = io.StringIO()

 

 

# Line 631

print >>sys.stderr, '\nTime Elapsed: %s' % (self.stopTime-self.startTime)

change into:

print (sys.stderr, '\nTime Elapsed: %s' % (self.stopTime-self.startTime))

 

# Line 642

if not rmap.has_key(cls):

change into:

if not cls in rmap:

 

# # 766 line 

Uo = O.Decode ( ' Latin-1 ' )

change into:

Uo = and

 

# # 772 line 

Ue = E.Decode ( ' Latin-1 ' )

change into:

Vo = e

Guess you like

Origin www.cnblogs.com/lirongyang/p/11595686.html