import unittest
import HTMLTestRunner
import os
from searchtests import SearchTests
from homepagetests import HomePageTest
# get the directory path to output report file
dir = os.getcwd()
# get all tests from SearchProductTest and HomePageTest class
search_tests = unittest.TestLoader().loadTestsFromTestCase(SearchTests)
home_page_tests = unittest.TestLoader().loadTestsFromTestCase(HomePageTest)
# create a test suite combining search_test and home_page_test
smoke_tests = unittest.TestSuite([home_page_tests, search_tests])
# open the report file
outfile = open(dir + "\SmokeTestReport.html", "w")
# run the suite using HTMLTestRunner
runner.run(smoke_tests)
执行该测试套件,HTMLTestRunner像unittest的默认测试执行器一样运行所有的测试。在用例执行的最后,它将生成测试报告文件
---------------------
【转载,仅作分享,侵删】
作者: arthur
来源:CSDN
原文:https://blog.csdn.net/chen__an/article/details/88643050
版权声明:本文为博主原创文章,转载请附上博文链接!