Commit 3c696c48 authored by libin's avatar libin

test

parent 33302e71
......@@ -3,35 +3,31 @@
import os
import time
import unittest
from dep import HTMLTestRunner
from src.common import web_client
testunit = unittest.TestSuite()
test_dir = 'testcases'
from src.datalib import init_data
from src.dep import HTMLTestRunner
from src.common import web_client
init_data.init()
testunit = unittest.TestSuite()
test_dir = '../testcase_for_test'
tests = unittest.defaultTestLoader.discover(test_dir, pattern='testcase*.py',
tests = unittest.defaultTestLoader.discover(test_dir, pattern='*.py',
top_level_dir=None)
test_report = './report/'
test_report = '../report/'
now = time.strftime("%Y_%m_%d_%H_%M_%S") # 获取当前时间
#定义个报告存放路径
# 定义个报告存放路径
filename = test_report + now + '_result.html'
fp = open(filename, 'wb')
#定义测试报告
runner = HTMLTestRunner.HTMLTestRunner(stream=fp, title=u'智能工位系统测试报告', description=u'用例执行情况:')
#运行测试用例
runner.run(tests)
fp.close()
cwdpath = os.getcwd()
report = web_client.WebClient('file:////' + cwdpath + filename[1:])
report.run_chrome()
# 定义测试报告
runner = HTMLTestRunner.HTMLTestRunner(stream=fp, verbosity=2, title=u'智能工位系统测试报告', description=u'用例执行情况:')
# 运行测试用例
runner.run(tests)
fp.close()
report = web_client.WebClient('file:////' + os.path.abspath(filename))
report.run_chrome()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment