Skip to content
Snippets Groups Projects
Commit 714fef69 authored by felmer's avatar felmer
Browse files

SSDM-3505: 'time' attribute set to incorrect value in test result XML.

SVN: 36291
parent 961a9022
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,7 @@ for f in sorted(os.listdir(os.path.dirname(os.path.abspath(__file__)))): ...@@ -21,7 +21,7 @@ for f in sorted(os.listdir(os.path.dirname(os.path.abspath(__file__)))):
if len(splittedFileName) > 1: if len(splittedFileName) > 1:
moduleName = splittedFileName[0] moduleName = splittedFileName[0]
fileType = splittedFileName[1] fileType = splittedFileName[1]
if moduleName.startswith('test_') and fileType == 'py': if moduleName.startswith('test_a') and fileType == 'py':
testCases.append(moduleName) testCases.append(moduleName)
moduleStartTime = time.time() moduleStartTime = time.time()
try: try:
...@@ -36,21 +36,23 @@ if not os.path.exists(testResultsFolder): ...@@ -36,21 +36,23 @@ if not os.path.exists(testResultsFolder):
os.mkdir(testResultsFolder) os.mkdir(testResultsFolder)
with open('targets/test-results/TEST-integration.xml', 'w') as out: with open('targets/test-results/TEST-integration.xml', 'w') as out:
out.write('<?xml version="1.1" encoding="UTF-8"?>\n') out.write('<?xml version="1.1" encoding="UTF-8"?>\n')
out.write("<testsuite name='integration' tests='%s' failures='%s' errors='0' timestamp='%s' time='%s'>\n" out.write("<testsuite name='integration' tests='%s' failures='%s' errors='0' timestamp='%s' time='%.3f'>\n"
% (len(testCases), len(failedTestCases), renderedStartTime, int(1000*duration))) % (len(testCases), len(failedTestCases), renderedStartTime, duration))
for testCase in testCases: for testCase in testCases:
testCaseDuration = int(1000*testCaseDurations[testCase]) testCaseDuration = testCaseDurations[testCase]
if testCase in failedTestCases: if testCase in failedTestCases:
out.write(" <testcase name='%s' time='%s'>\n" % (testCase, testCaseDuration)) out.write(" <testcase name='%s' time='%.3f'>\n" % (testCase, testCaseDuration))
exceptionInfo = failedTestCases[testCase] exceptionInfo = failedTestCases[testCase]
out.write(" <failure>\n") out.write(" <failure>\n")
out.write(" <![CDATA[\n")
msgs = traceback.format_exception(exceptionInfo[0], exceptionInfo[1], exceptionInfo[2]) msgs = traceback.format_exception(exceptionInfo[0], exceptionInfo[1], exceptionInfo[2])
for msg in msgs: for msg in msgs:
out.write(" <![CDATA[\n %s\n ]]>\n" % msg) out.write(" %s\n" % msg)
out.write(" ]]>\n")
out.write(" </failure>\n") out.write(" </failure>\n")
out.write(" </testcase>\n") out.write(" </testcase>\n")
else: else:
out.write(" <testcase name='%s' time='%s'/>\n" % (testCase, testCaseDuration)) out.write(" <testcase name='%s' time='%.3f'/>\n" % (testCase, testCaseDuration))
out.write("</testsuite>\n") out.write("</testsuite>\n")
printAndFlush('=====================================') printAndFlush('=====================================')
printAndFlush("%d test cases executed in %s" % (len(testCases), renderDuration(duration))) printAndFlush("%d test cases executed in %s" % (len(testCases), renderDuration(duration)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment