File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 33from subprocess import check_output , run
44from unittest import TestCase
55from unittest .mock import ANY , create_autospec , patch , Mock
6+ from xml .etree import ElementTree
67
78from 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+ example_xml = ElementTree .parse (example ).getroot ()
59+ actual_xml = ElementTree .parse (actual ).getroot ()
60+
61+ # RF<4 has multiple `stat` elements therefore we use the double slash
62+ # and a filter to single out the `stat` element with text "All Tests"
63+ all_tests_stat_block = './statistics/total//stat[.="All Tests"]'
64+
65+ example_stat = example_xml .find (all_tests_stat_block )
66+ actual_stat = actual_xml .find (all_tests_stat_block )
67+
68+ self .assertEqual (example_stat .get ('pass' ), actual_stat .get ('pass' ))
69+ self .assertEqual (example_stat .get ('fail' ), actual_stat .get ('fail' ))
6170
6271
6372class TestOxygenCLI (TestCase ):
You can’t perform that action at this time.
0 commit comments