Test 01

During the development of this test, we created the “Create” button, the cube prefab and the component CubeManager. Inside the component, we just added the public property CubePerefab and the method OnCreate():

public void OnCreate()


           Transform cube = Instantiate(CubePerefab, transform);

           cube.name = "object for test";


If you what to compare this version of the method with the final version, you can see that something is missing. It is because, during the development of the first test, the only requirement was that pressing the “Create” button “ an object named “object for test” has to appear on the scene”.

The corresponding Acceptance Criteria was “When I press the button “Create” I expect to see a new object in the scene.


In this requirement, there is no clue about the need to avoid to have more than one object at a time. Yes, usually we already know all the acceptance criteria at once, and the third one asks us to limit the creation of the cube to one object at a time, but we have to keep in mind one of the objectives of this type of development: we have to code only what the requirement ask. One of the most insidious pitfalls for a developer is to lose the scope of what he is developing, indulging in developing a big infrastructure because it “could” be useful in the future.


Back to: BDD in action: Having a look at CubeManager class Read next: Test 02


© 2017 Hud Dimension. All Rights Reserved.