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.

Edit Mode Tests

Edit Mode tests are currently NOT used in this project. But this can easily be added back into the project when needed by adding the following into the .gitlab-ci.yml file:

test-editmode:
  <<: *test
  variables:
    TEST_PLATFORM: editmode

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.