File Directory
File inside the structure that is the wording of conventional unittest framework
The total execution file
# #coding=utf-8
import unittest, time, os, multiprocessing
import unittest #引入框架
import HTMLTestRunner_Chart
import sys
reload(sys)
sys.setdefaultencoding('utf8')
# Create a test suite
testunit = unittest.TestSuite ()
# The test test test case directory beginning of the file is extracted, and access to the inside of the test cases
n = '/ Users / lucax / Desktop / work / automation cover / codemao_request_houtai / Script / user_manage / old_Cat_mange /'
the Discover = unittest. defaultTestLoader.discover (the n-, pattern = 'old_Cat_mange * .py', the n-top_level_dir =)
# following through continuous screening made unnecessary parts, and finally removing only the module name to the name of the test case class name..
for test_suite in the Discover:
for test_case in test_suite:
testunit.addTest (test_case)
n = '/ Users / lucax / Desktop / work / Automation cover / codemao_request_houtai / Script / user_manage / permission_Manage /'
Discover unittest.defaultTestLoader.discover = (n-, pattern = '* .py permission_Manage', = n-top_level_dir)
# by the following Do not continue to raise part of the screening, and finally removing only the module name to the name of the test case class name..
for test_suite in the Discover:
for test_case in test_suite:
testunit.addTest (test_case)
# # To report a test method:
IF __name__ == '__main__':
# Storage path defined reports
filename = '/ Users / lucax / Desktop / work / Automation coverage /codemao_request_houtai/report/123.HTML'
File = FP (filename, "WB")
# define test report
Runner = HTMLTestRunner_Chart.HTMLTestRunner (
Stream = FP,
title = U 'test report interfaces cat ancestors',
Description = U 'with the implementation of the embodiment:', verbosity = 2)
# Test run
runner.run (TestUnit)
# close the report file
fp.close ()
Report results:
Report by a third-party report: https://www.cnblogs.com/kaibindirver/p/10982100.html