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:
    10
    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:
    7
    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

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,250
    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:
    7
    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

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,250
    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:
    7
    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:
    10
    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.
unityunity