Search Unity

Unity Test Runner .xml report to .html

Discussion in 'Testing & Automation' started by Macoron, Feb 11, 2020.

  1. Macoron

    Macoron

    Joined:
    Mar 11, 2017
    Posts:
    33
    I'm working on an open source project. We use Github Actions to test and build our game (it's free for open-source). While Unity Actions can output an .xml report, it's hardly readable. Is there any tool that can generate .html report and can be easily added to Github Actions CI?

    I tried NUnit-HTML-Report-Generator and extentreports-dotnet-cli, but they both failed to parse test runner results (see in attachment). Did I miss something?

    Just to be clear, I'm talking about this buid-in package.
     

    Attached Files:

  2. seans_unity3d

    seans_unity3d

    Unity Technologies

    Joined:
    Feb 28, 2017
    Posts:
    9
    Hi Macoron -

    You didn't miss anything. The main use case for viewing results is in the test runner window.

    However, if you're running them from command line and generating a result.xml file that you'd like to view outside of the Editor, our team wrote a reporter that we use internally for this, and we made it available on the Unity Technologies GitHub project: https://github.com/Unity-Technologies/UnityTestRunnerResultsReporter. I think this will work for you, to some degree at least. Good luck!
     
    Last edited: Feb 11, 2020
    Macoron likes this.
  3. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,657
    The version of NUnit used by the package is V3, not V2, so I am not that surprised that NUnit-HTML-Report-Generator did not work.

    I'm not sure why Extent failed though, I would expect it to support V3, and looking briefly at its NUnit parser it looks like it should have worked. Do you have any more information about what failures you saw?
     
  4. seans_unity3d

    seans_unity3d

    Unity Technologies

    Joined:
    Feb 28, 2017
    Posts:
    9
    The schema of the Unity Test Runner result file is very custom and I don't believe it will be recognizable by any tools that know how to parse NUnit results schema. I'd love to be wrong if you find one :)
     
  5. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,657
    I'm not sure where you got that idea - it is supposed to be conformant to the schema described at https://github.com/nunit/docs/wiki/Test-Result-XML-Format. (There's even a comment in ResultsWriter.cs which says so!)
     
  6. seans_unity3d

    seans_unity3d

    Unity Technologies

    Joined:
    Feb 28, 2017
    Posts:
    9
    This was a few years back that I tried to do the same, maybe we're trying to be more compliant now with it. That was my experience back then. Would be awesome if it works now.
     
  7. Macoron

    Macoron

    Joined:
    Mar 11, 2017
    Posts:
    33
    Thanks for a link! It actually working and I can use it in my CI. The output isn't perfect though, can see some missing links and error. But anyway - it's a good start.
    Attached example of results from my test project.
     

    Attached Files:

    seans_unity3d likes this.
  8. SuperPudding98

    SuperPudding98

    Joined:
    Sep 23, 2017
    Posts:
    1
    First of all thank you, I just found this thread and it helped me so much (I didn't know about the unity actions repo).
    I set up CI with github actions, and I would really like to use test runner results reporter, but I'm very new to CI and to github actions in particular (I'm a hobbyist).
    Could you provide some example to how you set this up?
     
  9. rempelj

    rempelj

    Joined:
    Aug 3, 2013
    Posts:
    54
    Pitou22 likes this.
  10. WittyKyrie

    WittyKyrie

    Joined:
    Aug 21, 2021
    Posts:
    4
  11. WittyKyrie

    WittyKyrie

    Joined:
    Aug 21, 2021
    Posts:
    4
    upload_2022-5-20_11-33-37.png
     

    Attached Files:

  12. Pitou22

    Pitou22

    Joined:
    Sep 23, 2015
    Posts:
    54
    alexz-aug likes this.