You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
xUnit outputs: Add separate <testsuite> entries for each suite #2982
Currently Robot's xUnit output only contains one <testsuite> element and all executed tests as its direct child elements. This is true regardless does the executed top-level test suite have child suites or not. The underlying problem with the xUnit format is that there is not official specification for it, but based on the discussion in #2292 it seems that tools consuming these outputs ought to support nested suite structures and that reporting suites like that would be better than the current flat approach. The problem is that although tools that have been tested seem to support nested structures, there may be other tools, especially custom scripts, that don't.
This kind of potentially backwards-incompatible change can only be done in a major release. We are somewhat late in RF 3.1 release cycle, but if the enhancement is considered useful and possible problems not severe, the feature can still get it. For that we'd need feedback from the user community.
If we decide to implement this feature, then the next thing to decide is do we want to wrap the test suite structure into a <testsuites> element or do we want to use just <testsuite> elements. A problem is, again, that there is no official xUnit format specification, so it's unclear is <testsuites> needed and what benefits would it give. If there are no concrete benefits, I'd propose not to have it. This is again something that I'd hope the community to comment.
I would very much like to see this added to the xunit output since the current implementation does not work well with DevOps pipeline.
From the RF point of view, we want to run all suites in a single run. This yields an output.xml with multiple suites and then xunit output removes that information which results in duplicate test names in a single xunit file. This in turn means that the result of these test cases get merged on the DevOps 'Tests' History for the execution time, pass/fail, etc. of the test cases.
Note that in this case, the duplicate test case name is an API reference (/devices/delete) which exist in the suite test_valid_API_calls as well as in the suite test_invalid_API_calls. The only option I have now is to change the names of the test cases to make xunit behave as desired, but this really feels like a workaround.
Edit: 'Test suite' is a display and filtering option in the 'Tests' tab of a Release so the support for it seems to be there.
Implementing this sounds like a good idea. There is risk for backwards incompatibility issues but that risk is small and benefits seem to be bigger.
I want RF 4.1 to be smallish and as backwards compatible release as possible. Because this issues has backwards incompatibility risks, I think it's better to move it to RF 5.0 scope. If there is someone who'd like to see this already in RF 4.1, comment this issue or contact me otherwise. I can still do the required changes, they are small, but I would like that someone to test the changes with Jenkins and preferably other tools processing xUnit outputs.
Let's just add <testsuite> elements for each suite, no root <testsuites> (see my comment above). Based on the documentation at https://llg.cubic.org/docs/junit that <testsuites> is only needed if you have multiple suites because there must be one root element in XML. Robot's suite structure always has exactly one root suite so we don't need it.
The aforementioned documentation also shows that suites could have timestamp (apparently not universally supported) and properties (we could use them for documentation and metadata). Adding them, or at least the latter, could be considered but would require its own issue.
Hi, I would also like to see this issue fixed rather sooner than later. When it is fixed, I can help test the implementation on my Azure DevOps pipeline.
I recently created an Azure DevOps pipeline that executes my Robot test cases with the xunit output and it seems that indeed the test results in Azure DevOps only contains one element and all executed tests as its direct child elements.
My project has child suites under the top-level test suite so with current implementation all the test cases results appear directly under the top-level test suite. This is quite confusing from test management perspective.
This isn't implemented yet but will certainly be in RF 5.0. That release is targeted for January 2022, so it'll still take a little time for it to be officially released. If you want to get this into use as soon as possible, consider providing a pull request implementing the functionality with adequate tests. That way it will be in the first alpha. I can implement this myself, but I have other issues that have a lot higher priority that I'm going to look first.
Activity
pekkaklarck commentedon Oct 12, 2018
If we decide to implement this feature, then the next thing to decide is do we want to wrap the test suite structure into a
<testsuites>element or do we want to use just<testsuite>elements. A problem is, again, that there is no official xUnit format specification, so it's unclear is<testsuites>needed and what benefits would it give. If there are no concrete benefits, I'd propose not to have it. This is again something that I'd hope the community to comment.robinmackaij commentedon Feb 18, 2019
I would very much like to see this added to the xunit output since the current implementation does not work well with DevOps pipeline.
From the RF point of view, we want to run all suites in a single run. This yields an output.xml with multiple suites and then xunit output removes that information which results in duplicate test names in a single xunit file. This in turn means that the result of these test cases get merged on the DevOps 'Tests' History for the execution time, pass/fail, etc. of the test cases.
Note that in this case, the duplicate test case name is an API reference (/devices/delete) which exist in the suite test_valid_API_calls as well as in the suite test_invalid_API_calls. The only option I have now is to change the names of the test cases to make xunit behave as desired, but this really feels like a workaround.
Edit: 'Test suite' is a display and filtering option in the 'Tests' tab of a Release so the support for it seems to be there.
pekkaklarck commentedon Mar 3, 2021
We should make a decision about this. I add this to RF 4.1 scope so that we either do the change or close the issue.
pekkaklarck commentedon Jul 2, 2021
Decisions:
<testsuite>elements for each suite, no root<testsuites>(see my comment above). Based on the documentation at https://llg.cubic.org/docs/junit that<testsuites>is only needed if you have multiple suites because there must be one root element in XML. Robot's suite structure always has exactly one root suite so we don't need it.narhieemi commentedon Sep 6, 2021
Hi, I would also like to see this issue fixed rather sooner than later. When it is fixed, I can help test the implementation on my Azure DevOps pipeline.
I recently created an Azure DevOps pipeline that executes my Robot test cases with the xunit output and it seems that indeed the test results in Azure DevOps only contains one element and all executed tests as its direct child elements.
My project has child suites under the top-level test suite so with current implementation all the test cases results appear directly under the top-level test suite. This is quite confusing from test management perspective.
Thanks in advance
Eemi
lizzyliuY commentedon Oct 11, 2021
May I ask what is the current status of this enhancement? Do we already have an version including the fix?
Thanks,
Lizzy
pekkaklarck commentedon Oct 12, 2021
This isn't implemented yet but will certainly be in RF 5.0. That release is targeted for January 2022, so it'll still take a little time for it to be officially released. If you want to get this into use as soon as possible, consider providing a pull request implementing the functionality with adequate tests. That way it will be in the first alpha. I can implement this myself, but I have other issues that have a lot higher priority that I'm going to look first.
rikerfi commentedon Nov 23, 2021
Time being, my interim implementation does following xunit output. I think it is compatible for the Decision points mentioned above.
Here, I have two suites on the top level, but there could be more deeper nested testsuites.
pekkaklarck commentedon Nov 24, 2021
Looks good to me. Please create a PR, even a draft, for us to see the code!
pekkaklarck commentedon Dec 2, 2021
Implemented in PR #4156 by @rikerfi. Thanks for contribution!
xUnit outputs: Add separate <testsuite> entries for each suite (robot…