The scene

One of the most important guidelines for using the Unity Tools Integration Tests is about the scenes: you have not to put integration tests inside the scene that you are going to publish; you have to, instead, have a separate test scene where you are going to code your integration tests.

For this reason, you are going to use prefabs to assure that your test scene has the same objects of the original one.

Creating at least one Integration Test by pressing the button "Create" in the Integration Test Runner window, you are going to have one additional object in the scene, called "TestRunner". It is added by the Unity Test Tools to configure the scene properly for the execution of the integration tests: just ignore it, you are not going to use it directly.

One of the most important concepts about the scene in the integration tests is the scope of the objects inside the scene: In fact, if you have more than one integration test in the scene, and you execute more than one integration test at a time, you could experiment some unexpected behaviour.

We can have two scopes:

  • Internal: every object inside the hierarchy of an integration test GameObject is internal to it. Every modification of the objects inside its hierarchy is made inside a sandbox. When the execution of that particular integration test finishes, every change is reset to the original state.
  • Global: every object outside the hierarchy of an integration test GameObject has a Global scope. Every change of the objects with this scope during the execution of an integration test still remains during the execution of the other integration tests, and it is reset to the original state when the last integration test execution finishes.


It is important avoiding to put objects outside the integration tests that might change their status during the execution of any integration test because it can cause unexpected behaviours of the other integration test executions. You can usually put fixed objects in the scene, like walls or the terrain. If you put an object outside the integration test that could, for example, change position, you have to be careful.  


Back to: The inspector Read next: How to run an Integration Test


© 2017 Hud Dimension. All Rights Reserved.