Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Resolved Unity Test Tools Replacement

Discussion in 'Testing & Automation' started by Nigey, Apr 24, 2018.

  1. Nigey

    Nigey

    Joined:
    Sep 29, 2013
    Posts:
    1,115
    Hi Guys,

    I want to make some physics assertions. Unity Test Tools is gone, and there only seems to be an editor test runner. It looks like that doesn't really allow setting up tests in a test scene and what not. Am I missing something?
     
  2. ElvisAlistar

    ElvisAlistar

    Unity Technologies

    Joined:
    Oct 2, 2013
    Posts:
    226
    Nigey likes this.
  3. Nigey

    Nigey

    Joined:
    Sep 29, 2013
    Posts:
    1,115
    Hey @ElvisAlistar thanks for coming back to me! Yeah I see the editor test runner. I'm already using that a fair bit and it's good for what it does, but it looks like there's a usage gap between the two systems. You have playmode tests right, but to set up a machine gun firing a load of bullets, and affirming those bullets are bringing a target down to zero health isn't so much of an easy win, without Unity Test Tools. You need to layout the whole test environment via script, instead of placing GameObjects. Then make sure each go through their Awake>Start>OnEnable>Update series of functions to be ready. Then call the methods, and await confirmation of success/fail. Which wouldn't be sooooo bad, but the IEnumerator will only accept
    yield return null
    , or atleast when I tried back then, making writing tests arduous work. In some of these cases it's about 10x the time it takes to make the feature lol. Is there a quicker way to handle tests like this? Or could it become quicker?

    It might be a matter of expectations being different, as the example above isn't exactly a unit test. It's more of a integration, system, or smoke test. However my goal is to test composite systems, and confirm each work individually, as well as together.
     
    Last edited: Mar 1, 2019
  4. Warnecke

    Warnecke

    Unity Technologies

    Joined:
    Nov 28, 2017
    Posts:
    60
    Maybe you could achieve this by loading a scene in your PlayMode test. Then your scene could contain everything you want to happen in the test. You can use SceneManager.LoadScene for this.
     
    Nigey likes this.
  5. Nigey

    Nigey

    Joined:
    Sep 29, 2013
    Posts:
    1,115
    Yeah that's not a bad shout to be fair. I might look into that, thanks. Do you think there's a chance Unity will cover this usage gap sometime?
     
    Arkade likes this.
  6. superpig

    superpig

    Quis aedificabit ipsos aedificatores? Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,342
    I think it's going to make sense for us to document how to set up this kind of test, but in terms of functionality, I believe everything needed to do it is already in the framework.
     
    Nigey likes this.
unityunity