Skip to content

Commit

Permalink
count 'skipped' tests as skipped (#1121)
Browse files Browse the repository at this point in the history
Previously only 'skip' and 'disabled' were counted as skipped tests.
However, junit format explicitly allows 'skipped' (cmp.
https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd#L196)

For reference, also see the same issue in colcon:
- Bug: colcon/colcon-test-result#18
- PR: colcon/colcon-test-result#19
  • Loading branch information
dseifert authored and dirk-thomas committed Sep 28, 2020
1 parent cc39597 commit 55dcf35
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/catkin/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def _get_testsuite_stats(node):
num_tests = int(node.attrib['tests'])
num_errors = int(node.attrib['errors'])
num_failures = int(node.attrib['failures'])
num_skipped = int(node.get('skip', '0')) + int(node.get('disabled', '0'))
num_skipped = int(node.get('skip', '0')) + int(node.get('skipped', '0')) + int(node.get('disabled', '0'))
return (num_tests, num_errors, num_failures, num_skipped)


Expand Down
14 changes: 14 additions & 0 deletions test/unit_tests/test_test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,20 @@ def test_read_junit_skip(self):
finally:
shutil.rmtree(rootdir)

def test_read_junit_skipped(self):
try:
rootdir = tempfile.mkdtemp()

result_file = os.path.join(rootdir, 'test1.xml')
with open(result_file, 'w') as fhand:
fhand.write('<testsuites tests="5" failures="3" errors="1" skipped="2" time="35" name="AllTests"></testsuites>')
(num_tests, num_errors, num_failures) = catkin_test_results.read_junit(result_file)
self.assertEqual((5, 1, 3), (num_tests, num_errors, num_failures))
(num_tests, num_errors, num_failures, num_skipped) = catkin_test_results.read_junit2(result_file)
self.assertEqual((5, 1, 3, 2), (num_tests, num_errors, num_failures, num_skipped))
finally:
shutil.rmtree(rootdir)

def test_test_results(self):
try:
rootdir = tempfile.mkdtemp()
Expand Down

0 comments on commit 55dcf35

Please sign in to comment.