From 624c655f36ae6b9e49b3e868f02f817e5f236c9e Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Mon, 25 Apr 2016 11:28:28 +0000 Subject: [PATCH] SSDM-3505: improved content of targets/test-results/TEST-integration.xml SVN: 36278 --- integration-tests/test.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/integration-tests/test.py b/integration-tests/test.py index 0cb885da1a9..de0d0310609 100755 --- a/integration-tests/test.py +++ b/integration-tests/test.py @@ -7,6 +7,7 @@ import os import os.path import sys import time +import traceback import settings from systemtest.util import printAndFlush, renderDuration @@ -14,14 +15,12 @@ from systemtest.util import printAndFlush, renderDuration startTime = time.time() testCases = [] failedTestCases = {} -numberOfTestCases = 0 -numberOfFailedTestCases = 0 for f in sorted(os.listdir(os.path.dirname(os.path.abspath(__file__)))): splittedFileName = f.rsplit('.', 1) if len(splittedFileName) > 1: moduleName = splittedFileName[0] fileType = splittedFileName[1] - if moduleName.startswith('test_') and fileType == 'py': + if moduleName.startswith('test') and fileType == 'py': testCases.append(moduleName) try: __import__(moduleName) @@ -39,8 +38,11 @@ with open('targets/test-results/TEST-integration.xml', 'w') as out: for testCase in testCases: if testCase in failedTestCases: out.write(" <testcase name='%s'>\n" % testCase) + exceptionInfo = failedTestCases[testCase] out.write(" <failure>\n") - out.write(" %s\n" % failedTestCases[testCase][1]) + msgs = traceback.format_exception(exceptionInfo[0], exceptionInfo[1], exceptionInfo[2]) + for msg in msgs: + out.write(" %s\n" % msg) out.write(" </failure>\n") out.write(" </testcase>\n") else: @@ -48,6 +50,7 @@ with open('targets/test-results/TEST-integration.xml', 'w') as out: out.write("</testsuite>\n") printAndFlush('=====================================') printAndFlush("%d test cases executed in %s" % (len(testCases), renderedDuration)) +numberOfFailedTestCases = len(failedTestCases) if numberOfFailedTestCases == 0: printAndFlush("no test case failed") exit(0) -- GitLab