/
run_tests.py
41 lines (36 loc) · 1.06 KB
/
run_tests.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
36
37
38
39
40
41
import testenv
import os
import sys
import subprocess
from os.path import join
import robot
import statuschecker
ROBOT_ARGS = [
'--doc', 'SudsLibrary_Acceptance_Tests',
'--outputdir', testenv.RESULTS_DIR,
'--report', 'none',
'--log', 'none',
'--pythonpath', testenv.SRC_DIR,
'--debugfile', join(testenv.RESULTS_DIR, 'syslog.txt')
]
def acceptance_tests(args):
runner = 'pybot'
if os.sep == '\\':
runner += '.bat'
_make_results_dir()
cmd = [runner] + ROBOT_ARGS + args + [testenv.TEST_DATA]
print "Executing:\n" + " ".join(cmd)
subprocess.call(cmd)
outputxml = join(testenv.RESULTS_DIR, "output.xml")
statuschecker.process_output(outputxml)
rc = robot.rebot(outputxml, outputdir=testenv.RESULTS_DIR)
if rc == 0:
print 'All tests passed'
else:
print '%d test%s failed' % (rc, 's' if rc != 1 else '')
def _make_results_dir():
if not os.path.exists(testenv.RESULTS_DIR):
os.mkdir(testenv.RESULTS_DIR)
if __name__ == '__main__':
args = sys.argv[1:]
acceptance_tests(args)