Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to get the same logs as the built-in Unity Test Runner

Discussion in 'Testing & Automation' started by Swimgod, Jan 14, 2022.

  1. Swimgod

    Swimgod

    Joined:
    May 7, 2018
    Posts:
    3
    Hello,
    I am following the implementation of running Unity tests programmatically and was able to execute them, but from the test results, I cannot figure out how to get the same logging as the Unity Test Runner when doing assertions.

    https://docs.unity3d.com/Packages/com.unity.test-framework@1.1/manual/extension-run-tests.html
    https://docs.unity.cn/Packages/com.unity.test-framework@1.1/manual/extension-get-test-results.html

    upload_2022-1-14_13-37-31.png

    I was expecting to be able print out the logs similar to the Unity Test Runner to the console like above. But when I do it programmatically, there does not seem to be a way to access and print out those same logs.

    Any help would be greatly appreciated!
     
  2. sbergen

    sbergen

    Joined:
    Jan 12, 2015
    Posts:
    53
    I'm not familiar with running tests programmatically, but the message you are looking for is the NUnit AssertionException.Message. Hope that helps!