Skip to content

fix(test): unifiy test for RF<4 and RF>=4 #30

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

Merged
merged 1 commit into from
Sep 9, 2021
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
17 changes: 13 additions & 4 deletions tests/utest/oxygen/test_oxygen_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from subprocess import check_output, run
from unittest import TestCase
from unittest.mock import ANY, create_autospec, patch, Mock
from xml.etree import ElementTree

from robot.running.model import TestSuite

Expand Down Expand Up @@ -54,10 +55,18 @@ def test_junit_works_on_cli(self):
text=True,
shell=True)

for expected in ('<stat pass="69" fail="3">Critical Tests</stat>',
'<stat pass="69" fail="3">All Tests</stat>'):
self.assertIn(expected, example.read_text())
self.assertIn(expected, actual.read_text())
example_xml = ElementTree.parse(example).getroot()
actual_xml = ElementTree.parse(actual).getroot()

# RF<4 has multiple `stat` elements therefore we use the double slash
# and a filter to single out the `stat` element with text "All Tests"
all_tests_stat_block = './statistics/total//stat[.="All Tests"]'

example_stat = example_xml.find(all_tests_stat_block)
actual_stat = actual_xml.find(all_tests_stat_block)

self.assertEqual(example_stat.get('pass'), actual_stat.get('pass'))
self.assertEqual(example_stat.get('fail'), actual_stat.get('fail'))


class TestOxygenCLI(TestCase):
Expand Down