To create and execute a simple unit test, follow these steps:
- Create a new 3D Unity project.
- In the Package Manager window, ensure you have the latest version of the Test Framework package installed.
- Display the Test Runner window by going to Window | General | Test Runner.
- Ensure that the EditMode button is selected in the Test Runner window.
- In the Test Runner window, click the Create EditMode Test Assembly Folder button. You'll now see a folder called Tests in the Project window.
- Select the Tests folder.
- In the Test Runner window, click the Create Test Script in Current Folder button. Rename the script class SimpleTester.cs and replace its contents with the following:
using NUnit.Framework;
class SimpleTester
{
[Test]
public void TestOnePlusOneEqualsTwo()
{
...