Skip to content
Snippets Groups Projects
Commit 30895a09 authored by felmer's avatar felmer
Browse files

SSDM-3505: escaping failure message in CDATA of test report xml.

SVN: 36288
parent 6a872e26
No related branches found
No related tags found
No related merge requests found
...@@ -39,17 +39,18 @@ with open('targets/test-results/TEST-integration.xml', 'w') as out: ...@@ -39,17 +39,18 @@ with open('targets/test-results/TEST-integration.xml', 'w') as out:
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='%s'>\n"
% (len(testCases), len(failedTestCases), renderedStartTime, int(1000*duration))) % (len(testCases), len(failedTestCases), renderedStartTime, int(1000*duration)))
for testCase in testCases: for testCase in testCases:
testCaseDuration = int(1000*testCaseDurations[testCase])
if testCase in failedTestCases: if testCase in failedTestCases:
out.write(" <testcase name='%s' time='%s'>\n" % (testCase, int(1000*testCaseDurations[testCase]))) out.write(" <testcase name='%s' time='%s'>\n" % (testCase, testCaseDuration))
exceptionInfo = failedTestCases[testCase] exceptionInfo = failedTestCases[testCase]
out.write(" <failure>\n") out.write(" <failure>\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(" %s\n" % msg) out.write(" <![CDATA[\n %s\n ]]>\n" % msg)
out.write(" </failure>\n") out.write(" </failure>\n")
out.write(" </testcase>\n") out.write(" </testcase>\n")
else: else:
out.write(" <testcase name='%s'/>\n" % testCase) out.write(" <testcase name='%s' time='%s'/>\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