运行符合规则的所有测试用例
This commit is contained in:
parent
cbf053d298
commit
26cc77c7f4
|
@ -0,0 +1,38 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
@Author : nqp
|
||||
@desc :
|
||||
"""
|
||||
|
||||
import unittest
|
||||
import sys,os
|
||||
from framework import HTMLTestReportCN
|
||||
from framework.ReadConfig import ReadConfig
|
||||
from framework.case_strategy import CaseStrategy
|
||||
from test_suites.test_baidu import to_init
|
||||
|
||||
sys.path.append(os.path.abspath(os.path.dirname(__file__)))
|
||||
|
||||
class RunAllTests(object):
|
||||
|
||||
def __init__(self):
|
||||
cs = CaseStrategy()
|
||||
self.test_suite = cs.collect_cases()
|
||||
self.tester = ReadConfig().get_test_account()['name']
|
||||
|
||||
def run(self):
|
||||
to_init().clean_test_data()
|
||||
|
||||
# 启动测试时创建文件夹并获取报告的名字
|
||||
daf = HTMLTestReportCN.DirAndFiles()
|
||||
daf.create_dir(title='自动化测试报告')
|
||||
report_path = HTMLTestReportCN.GlobalMsg.get_value("report_path")
|
||||
|
||||
with open(report_path, "wb") as fp:
|
||||
runner = HTMLTestReportCN.HTMLTestRunner(stream=fp, title='自动化测试报告', description='用例执行情况:', tester=self.tester)
|
||||
runner.run(self.test_suite)
|
||||
|
||||
to_init().clean_test_data()
|
||||
|
||||
if __name__ == "__main__":
|
||||
RunAllTests().run()
|
Loading…
Reference in New Issue