确定现在选择的是存放目录(我这里是Tests)按下 Test Runner 窗口的 Create (PlayMode|EditMode) Test Assembly Folder
5. 创建测试脚本
测试脚本 必须跟 单元测试程序集 在同一个目录下
using System.Collections;using System.Collections.Generic;using NUnit.Framework;using UnityEngine;using UnityEngine.TestTools;publicclassMyTestScript{// A Test behaves as an ordinary method[Test]publicvoidMyTestScriptSimplePasses(){// Use the Assert class to test conditions
Debug.Log(nameof(MyTestScriptSimplePasses));}// A UnityTest behaves like a coroutine in Play Mode. In Edit Mode you can use// `yield return null;` to skip a frame.[UnityTest]publicIEnumeratorMyTestScriptWithEnumeratorPasses(){// Use the Assert class to test conditions.// Use yield to skip a frame.yieldreturnnull;