Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generating XML for polarion with not passed tests #963

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion ods_ci/utils/scripts/polarion/xunit_add_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from copy import deepcopy
from xml.dom import minidom
import os
from junitparser import JUnitXml, TestCase, TestSuite
from junitparser import JUnitXml, TestCase, TestSuite, Failure, Error, Skipped
import yaml


Expand Down Expand Up @@ -191,6 +191,23 @@ def restructure_xml_for_polarion(src_xunit_xml_file, xunit_xml_file_restructured
tc = TestCase()
tc.name = suite.name
tc.time = suite.time

if not suite.is_passed:
if isinstance(suite.result[0], Failure):
f = Failure()
f.type = suite.result[0].type
f.message = suite.result[0].message
tc.append(f)
elif isinstance(suite.result[0], Error):
e = Error()
e.type = suite.result[0].type
e.message = suite.result[0].message
tc.append(e)
elif suite.is_skipped:
s = Skipped()
s.type = suite.result[0].type
s.message = suite.result[0].message
tc.append(s)
xml_testsuite.append(tc)
xml_testsuites.append(xml_testsuite)
xml_testsuites.write(xunit_xml_file_restructured, pretty=True)
Expand Down