BDD Framework: How to create your own dynamic test

A BDD integration test is an actual Unity Test Tools Integration Test.

You are going to start the creation of your test. You can do it in two ways:

  • Select from the menu: "Unity Test Tools" -> "BDD Extension Framework" -> "Create BDD Test": the test is going to appear in your Hierarchy window with the name "New Test". 
  • Creating a normal integration test in the Unity Test Tools Integration Panel. It creates a new object in your Hierarchy window named “New Test”. Its inspector shows just the Test Component script attached to the game object. To make this integration test a BDD Integration Test you have to add the component named “BDD Extension Runner”




After adding it, the framework checks the Integration Test for errors. At the very beginning, we are going to have an empty inspector saying: "Please, add your BDD Components and enjoy BDD.". It means, obviously, that we have to add a BDD Component before starting to configure the scenario. If you have not yet the right class to add, you first have to create it. You can just use the empty template called “TemplateDynamicBDD.cs” by copying it in your script folder and renaming the name of the file and the class name.

Now you have to create your BDD Methods. First of all, you have to have the test scenario written in the Given-When-Then format. After that, you can replicate the sentences in your scenario into the BDD Methods.

Now you can add your new script to the integration test:



After adding the component, the combo boxes on the runner inspector are not set to any value, for two reasons: first there is not yet a BDD Component in your test, and second, the BDD Framework cannot know which methods you want to set. Instead of the scenario sentences, the BDD Framework shows the writing “### Please, choose a method or delete the row. ###". It is just a reminder to set up your test properly, otherwise, you cannot run it.


Back to: BDD Framework: how to use it and avoid mistakes Read next: BDD Framework: How to create your own static test


© 2017 Hud Dimension. All Rights Reserved.