Skip to content

xUnit outputs: Add separate <testsuite> entries for each suite #2982

Closed

Description

@pekkaklarck

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.

Activity

  1. pekkaklarck commented on Oct 12, 2018

    @pekkaklarck
    MemberAuthor

    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.

  2. robinmackaij commented on Feb 18, 2019

    @robinmackaij
    Contributor

    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.

  3. pekkaklarck commented on Mar 3, 2021

    @pekkaklarck
    MemberAuthor

    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.

  4. added this to the v4.1 milestone on Mar 3, 2021
  5. pekkaklarck commented on Jul 2, 2021

    @pekkaklarck
    MemberAuthor

    Decisions:

    1. 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.
    2. 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.
    3. 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.
    4. 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.
  6. modified the milestones: v4.1, v5.0 on Jul 2, 2021
  7. narhieemi commented on Sep 6, 2021

    @narhieemi

    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

  8. lizzyliuY commented on Oct 11, 2021

    @lizzyliuY

    May I ask what is the current status of this enhancement? Do we already have an version including the fix?

    Thanks,
    Lizzy

  9. pekkaklarck commented on Oct 12, 2021

    @pekkaklarck
    MemberAuthor

    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.

  10. rikerfi commented on Nov 23, 2021

    @rikerfi
    Contributor

    Time being, my interim implementation does following xunit output. I think it is compatible for the Decision points mentioned above.

    <?xml version="1.0" encoding="UTF-8"?>
    <testsuite name="Koe" tests="3" errors="0" failures="0" skipped="0" time="0.057" timestamp="2021-11-23T12:39:52.075000">
        <testsuite name="Simple" tests="2" errors="0" failures="0" skipped="0" time="0.030" timestamp="2021-11-23T12:39:52.093000">
            <testcase classname="Koe.Simple" name="Let's Test Some Nop" time="0.002">
            </testcase>
            <testcase classname="Koe.Simple" name="Now Test Some Logging" time="0.011">
            </testcase>
        </testsuite>
        <testsuite name="Simple Nested" tests="1" errors="0" failures="0" skipped="0" time="0.007" timestamp="2021-11-23T12:39:52.124000">
            <testcase classname="Koe.Simple Nested" name="Simple Looping Test" time="0.002">
            </testcase>
        </testsuite>
    </testsuite>
    

    Here, I have two suites on the top level, but there could be more deeper nested testsuites.

  11. pekkaklarck commented on Nov 24, 2021

    @pekkaklarck
    MemberAuthor

    Looks good to me. Please create a PR, even a draft, for us to see the code!

  12. added
    acknowledge
    and removed on Dec 2, 2021
  13. pekkaklarck commented on Dec 2, 2021

    @pekkaklarck
    MemberAuthor

    Implemented in PR #4156 by @rikerfi. Thanks for contribution!

  14. added a commit that references this issue on Jul 15, 2025
    2517682
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgealpha 1backwards incompatiblegood first issuepriority: high

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions