Interface Automation of the visual test report generation BeautifulReport

 When writing automated tests with python, unittest framework and BeautifulReport combine for perfect visual test report

[Step]: ready BeautifulReport, git Address:

https://github.com/TesterlifeRaymond/BeautifulReport

If you install git down on your computer, you can use the command git clone directly to a local directory specified

git clone https://github.com/TesterlifeRaymond/BeautifulReport

Cloned into the python installation directory / Lib lower / site-packages / directory;

If the installation is not git, downloaded to the local BeautifulReport.ZIP the python / Lib / site-packages / directory directly on git

 

[Step]: organizational use cases and apply BeautifulReport

Used herein unittest.defaultTestLoader.discover () method of batch processing integration test suite, then BeautifulReport () method of execution cases. code show as below:

the unittest Import 
from BeautifulReport Import BeautifulReport 

IF the __name__ == '__main__': 
   case_path = the os.path.join (The os.getcwd (), "TestCases") Discover = unittest.defaultTestLoader.discover (case_path, pattern = "Inter * .py" , top_level_dir = None) # test report write path report_dir = "F.: \\ \\ Work LDS linkcld \\ \\ \\ report" Result = BeautifulReport (Discover) result.report (filename = 'test_report', Description = ' Interface automated test report consolidated ', log_path = report_dir)

Explanation:

report (filename -> Test report name, if not specified the default file name report.html; description -> name display cases use test report; log_path = -> Test report file write path '.')

 

carry out!

web using automated test when this test report, the failure can also be performed with the embodiment of a screenshot tried subsequent re-recording.

Specific Reference: https://www.cnblogs.com/hao2018/p/10093343.html

Guess you like

Origin www.cnblogs.com/wulixia/p/11420315.html