Skip to content

Commit

Permalink
tcms-junit.xml-plugin will now print TestRun ID on the terminal
Browse files Browse the repository at this point in the history
this makes it easier to chain multiple invocations of this command
if you want to add multiple results into the same TR
  • Loading branch information
atodorov committed Sep 20, 2019
1 parent a3d3bcf commit 6cc1448
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion tcms_junit_plugin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ def __init__(self):
self.backend = Backend(prefix='[junit.xml] ')

def parse(self, junit_xml, progress_cb=None):
"""
Parse the input file and return the TestRun ID.
"""
self.backend.configure()

xml = JUnitXml.fromfile(junit_xml)
Expand Down Expand Up @@ -61,10 +64,13 @@ def parse(self, junit_xml, progress_cb=None):
if progress_cb:
progress_cb()

return self.backend.run_id


def main(argv):
if len(argv) < 2:
raise Exception("USAGE: %s junit.xml" % argv[0])

plugin = Plugin()
plugin.parse(argv[1])
tr_id = plugin.parse(argv[1])
print(tr_id)
3 changes: 2 additions & 1 deletion tests/bin/make-junit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export TCMS_BUILD="$TRAVIS_BUILD_NUMBER-$(echo $TRAVIS_COMMIT | cut -c1-7)"


nosetests --with-xunit
./tcms-junit.xml-plugin nosetests.xml
TCMS_RUN_ID=`./tcms-junit.xml-plugin nosetests.xml`

# parse additional data files collected from issues
# and add to TestRun created in the previous step
./tcms-junit.xml-plugin tests/data/9.xml

0 comments on commit 6cc1448

Please sign in to comment.