Behaviour Driven Development: how to organise the scenes

One of the guidelines for using the integration test of the Unity Test Tools is to develop the integration tests in a different scene, dedicated to the integration tests. This guideline is fully adopted by the BDD Framework.

If you are developing in BDD you should have a clean scene with only the pre-existing objects you need for the development process. You are going to create all the new objects in this scene during the development process and only the strictly necessary things that the requirements are asking for. We call this scene “Development Scene”.

Because the creation of the GameObjects is made in a different scene than the “official” scene, you have to work with prefabs. Every GameObject you are going to create in the BDD scene has to be brought back to the original scene, once you finish the development process.

So, the development scene should contain only the objects strictly involved by the requirements. At the first time do not add all the objects you think should be involved by all the requirements: add them once at a time, only when you are going to develop a requirement that asks explicitly to interact with it. This behaviour allows you to avoid a “crowded” scene with useless objects.

If you develop your classes using TDD, you should use mocked objects to develop your code and simulate the behaviour of classes that interact with your new code. The main example of mocked object is the persistence layer. It means that you develop your code in a protected and simulated environment.

In this case, you should need to develop and run the “Integration Tests” for your new code. This time “Integration Tests” stands for the tests with the scope to assure that your new code is going to work properly using the real objects that you were mocking during the development process.

We suggest developing the “Integration Tests” in the same development scene you were using for the BDD. This because the “Integration Tests” use the same scenarios already implemented during the BDD session. You could just copy the original tests and modify them for using the real objects.

So in our Development Scene, we have the BDD tests, the Integration Tests and, perhaps, the Unit Tests if you were coding using TDD.


What about the Regression Tests?

The regression tests are, by definition, tests that interact with all the software, in real and not simulated conditions. The scene where you are going to develop your regression tests will be an actual copy of the real scene you are going to release. You have to develop your regression tests inside the copy of the real scene.


Back to: BDD Extension Framework Guidelines Read next: Behaviour Driven Development: how to organise the BDD Components


© 2017 Hud Dimension. All Rights Reserved.