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.
- Click Window on the top navigation bar.
- Click Test Runner.
- Click on PlayMode and then Run All.
- Click on EditMode and then Run All.
These tests will automatically run on the GitLab CI Pipeline once a commit has been pushed.