Skip to content

Testing

Creating or editing tests

For Unity, there are two testing methods; Play Mode and Edit Mode. Edit mode tests are in the following folder:

/Assets/Scripts/Editor/EditModeTests/

Play mode tests are in the following folder:

/Assets/Tests/

To create a test script, navigate to the corresponding folder and right-click in the project window (normally at the bottom of the screen). Go to Create > Testing > (Test Mode) Test C# Script. This will create script in that directory and simply double click to edit the script.

Running tests

Tests can be run within the Unity UI directly.

  1. Click Window on the top navigation bar.
  2. Click Test Runner.
  3. Click on PlayMode and then Run All.
  4. Click on EditMode and then Run All.

These tests will automatically run on the GitLab CI Pipeline once a commit has been pushed.