Generating and running a default test script class
Unity can create a default C# test script for you, thereby enabling you to quickly start creating and executing tests on your project. In this recipe, we will add the Unity Test Framework to a project and use it to automatically generate a default test script for us. This will be the basis for several of the following recipes:
Figure 19.7: Tests passing (indicated by green ticks)
How to do it...
To generate a default test script class, follow these steps:
- Create a new 3D Unity project.
- Display the Test Runner panel by going to Window | General | Test Runner.
Figure 19.8: The Test Runner panel
- Ensure that the EditMode button is selected in the Test Runner panel.
- In the Test Runner panel, click the Create EditMode Test Assembly Folder button. You’ll now see a folder called
Tests
that’s been created in the Project panel. - Select the
Tests
folder.
...