-
Notifications
You must be signed in to change notification settings - Fork 0
/
all_test.py
35 lines (33 loc) · 1004 Bytes
/
all_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import unittest
import HTMLTestRunner
import time,threading
from testCase import *
def begin(pare):
testunit=unittest.TestSuite()
#将测试用例加入到测试容器(套件)中
now = time.strftime("%Y-%m-%d-%H_%M_%S",time.localtime(time.time()))
if '1' in pare:
testunit.addTest(unittest.makeSuite(cyb360.seleniumTest))
filename = now+'result1.html'
else:
testunit.addTest(unittest.makeSuite(cyb361.seleniumTest))
filename = now+'result2.html'
fp = file(filename, 'wb')
runner =HTMLTestRunner.HTMLTestRunner(
stream=fp,
title=pare,
description=u'案例执行情况:')
runner.run(testunit)
threads = []
t1 = threading.Thread(target=begin,args=("1",))
t2 = threading.Thread(target=begin,args=("2",))
threads.append(t1)
threads.append(t2)
if __name__ == '__main__':
for t in threads:
t.setDaemon(True)
t.start()
for t in threads:
t.join()