diff --git a/.gitignore b/.gitignore index 4f36722..3c85039 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,4 @@ dist/ *.egg-info/ .coverage .venv/ -*.xml build/ diff --git a/tcms_junit_plugin/__init__.py b/tcms_junit_plugin/__init__.py index 43a8db2..fa2520b 100644 --- a/tcms_junit_plugin/__init__.py +++ b/tcms_junit_plugin/__init__.py @@ -14,7 +14,18 @@ def parse(self, junit_xml, progress_cb=None): self.backend.configure() xml = JUnitXml.fromfile(junit_xml) - for xml_case in xml: + # apparently junit.xml may contain either a tag, + # e.g. Katalon Studio + if xml._tag == "testsuites": # pylint: disable=protected-access + cases = [] + for suite in xml: + for case in suite: + cases.append(case) + # or directly (only 1) tag - nose & py.test + else: + cases = list(xml) + + for xml_case in cases: summary = "%s.%s" % (xml_case.classname, xml_case.name) test_case = self.backend.test_case_get_or_create(summary) diff --git a/tests/bin/make-junit.xml b/tests/bin/make-junit.xml index 442606f..61e0ded 100755 --- a/tests/bin/make-junit.xml +++ b/tests/bin/make-junit.xml @@ -18,3 +18,6 @@ export TCMS_BUILD="$TRAVIS_BUILD_NUMBER-$(echo $TRAVIS_COMMIT | cut -c1-7)" nosetests --with-xunit ./tcms-junit.xml-plugin nosetests.xml + +# parse additional data files collected from issues +./tcms-junit.xml-plugin tests/data/9.xml diff --git a/tests/data/9.xml b/tests/data/9.xml new file mode 100644 index 0000000..0afe0e0 --- /dev/null +++ b/tests/data/9.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + 2019-05-15 10:46:06 - [TEST_CASE][FAILED] - Test Cases/Simple Examples/Login Test/Data-driven examples/Login with username and password as a default value of variables: Test Cases/Simple Examples/Login Test/Data-driven examples/Login with username and password as a default value of variables FAILED. + 2019-05-15 10:46:06 - [TEST_CASE][FAILED] - Test Cases/Simple Examples/Login Test/Data-driven examples/Login with username and password as a default value of variables: Test Cases/Simple Examples/Login Test/Data-driven examples/Login with username and password as a default value of variables FAILED. + + 2019-05-15 10:46:05 - [TEST_SUITE][INCOMPLETE] - Login test suite with data-driven-approach: null + 2019-05-15 10:46:05 - [TEST_SUITE][INCOMPLETE] - Login test suite with data-driven-approach: null + +