Skip to content

Commit ce39832

Browse files
author
Matej Cotman
committed
fix(test): unifiy test for RF<4 and RF>=4
1 parent bfdb35f commit ce39832

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

tests/utest/oxygen/test_oxygen_cli.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from subprocess import check_output, run
44
from unittest import TestCase
55
from unittest.mock import ANY, create_autospec, patch, Mock
6+
from xml.etree import ElementTree
67

78
from robot.running.model import TestSuite
89

@@ -54,10 +55,18 @@ def test_junit_works_on_cli(self):
5455
text=True,
5556
shell=True)
5657

57-
for expected in ('<stat pass="69" fail="3">Critical Tests</stat>',
58-
'<stat pass="69" fail="3">All Tests</stat>'):
59-
self.assertIn(expected, example.read_text())
60-
self.assertIn(expected, actual.read_text())
58+
exampleTree = ElementTree.parse(example)
59+
exampleRoot = exampleTree.getroot()
60+
61+
actualTree = ElementTree.parse(actual)
62+
actualRoot = actualTree.getroot()
63+
64+
exampleStat = exampleRoot.find(
65+
'./statistics/total//stat[.="All Tests"]')
66+
actualStat = actualRoot.find('./statistics/total//stat[.="All Tests"]')
67+
68+
self.assertEqual(exampleStat.get('pass'), actualStat.get('pass'))
69+
self.assertEqual(exampleStat.get('fail'), actualStat.get('fail'))
6170

6271

6372
class TestOxygenCLI(TestCase):

0 commit comments

Comments
 (0)