Quick answer: Your test asmdef must have Test Assembly checked and must reference UnityEngine.TestRunner and UnityEditor.TestRunner. For Play Mode specifically, either add Platform constraints to include Play Mode or enable “Enable Play Mode Testing for all assemblies” in Test Runner.
Here is how to fix Unity Play Mode tests not running. You open the Test Runner window, click the Play Mode tab, and see either nothing at all, only some of your tests, or the tests show but clicking Run Tests does nothing. Edit Mode tests might work fine. Test discovery in Unity depends on assembly definition files, Test Runner flags, and a setting buried in the Test Runner window itself. Each of those can silently break test execution.
The Symptom
In the Test Runner window (Window > General > Test Runner), the Play Mode tab shows one of: no tests listed, tests listed but “Run All” does nothing, tests appear to run but no results show, or tests pass locally but fail with “No tests found” in CI. Edit Mode tests work correctly.
From the command line with -runTests -testPlatform PlayMode, Unity exits with zero tests executed and no errors. The XML results file shows an empty test suite.
What Causes This
Missing Test Assembly flag. The asmdef holding your tests must have “Test Assembly” checked in the Inspector. This flag does two things: it tells Unity the assembly is tests (so it is excluded from builds), and it unlocks the reference dropdown to include test runner assemblies. Without this flag, your [Test] attributes are syntactically valid but Unity does not scan them.
Missing TestRunner references. The asmdef must reference UnityEngine.TestRunner and UnityEditor.TestRunner. If you are using NUnit attributes directly, you also need nunit.framework.dll. Test Assembly mode adds these references automatically when you enable it, but if you created the asmdef manually they may be missing.
Platform constraint excludes Play Mode. The asmdef has a platform constraint dropdown. If “Editor” is the only platform selected, tests only run in Edit Mode. For Play Mode tests, you need either “Any Platform” selected or a specific list that includes your target platforms.
“Enable Play Mode Testing for all assemblies” toggle. In the Test Runner window, click the three-dot menu and check this setting. When unchecked, Unity only runs Play Mode tests from assemblies that have a matching test asmdef reference. Enabling it makes every test-marked method eligible for Play Mode execution.
Scene not in Build Settings. If your Play Mode tests load scenes via SceneManager.LoadScene, the scenes must be in Build Settings. During test runs Unity uses the build scene list, and scenes not in it fail to load silently or throw an exception that kills the test.
Using [Test] instead of [UnityTest]. Play Mode tests that need to yield (wait for a frame, wait for a coroutine) must use [UnityTest] and return IEnumerator. A [Test] method in Play Mode runs synchronously in one frame, which is fine for pure logic tests but breaks for anything time-dependent.
The Fix
Step 1: Create a proper test asmdef. Right-click in your test folder, Create > Assembly Definition. Name it something like MyGame.Tests. In the Inspector, check “Test Assembly” at the bottom. Notice that the References field becomes editable and that UnityEngine.TestRunner, UnityEditor.TestRunner, and nunit.framework.dll can now be added.
Add references to:
UnityEngine.TestRunnerUnityEditor.TestRunner(for Edit Mode, harmless in Play Mode)- Your production code asmdef (whatever you want to test)
nunit.framework.dll(in Precompiled Assembly References)
Step 2: Write tests with the correct attribute. Use [UnityTest] for Play Mode tests that need to wait for frames or coroutines.
using System.Collections;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
public class PlayerMovementTests
{
[UnityTest]
public IEnumerator Player_Moves_Forward_Over_Time()
{
var go = new GameObject("Player");
var player = go.AddComponent<Player>();
Vector3 startPos = player.transform.position;
yield return new WaitForSeconds(0.5f);
Assert.Greater(player.transform.position.z, startPos.z);
Object.Destroy(go);
}
}
Notice the yield return new WaitForSeconds — this is the whole reason to use Play Mode tests. In Edit Mode, time does not advance and WaitForSeconds does not work.
Step 3: Toggle the global flag. In the Test Runner window, click the three-dot dropdown in the top-right corner and enable “Enable Play Mode Testing for all assemblies.” Restart Unity. Your tests should appear in the Play Mode tab.
This flag writes to ProjectSettings/ProjectSettings.asset, so it commits to version control and CI inherits the setting.
Step 4: Run from CI correctly. Use the batch-mode test command:
Unity -batchmode -projectPath . \
-runTests -testPlatform PlayMode \
-testResults ./test-results.xml \
-logFile ./unity-test.log
Unity exits 0 if tests pass, non-zero if they fail. Read test-results.xml with any NUnit-compatible parser (GitHub Actions’ JUnit reporter works). If zero tests run, check the log for asmdef compilation errors — a single compile error in production code prevents test assembly from loading.
Debugging Missing Tests
If a specific test does not appear, right-click in Test Runner and choose “Enable playthrough filtering” to see which tests are excluded and why. Unity logs reasons like “assembly not marked as test assembly” or “platform constraint excludes current platform.”
Another technique: create a minimal failing test at the class level and see if it appears. If a trivially-named [Test] public void Foo() { Assert.Fail(); } does not show up, the asmdef setup is wrong, not the test code.
Test Setup and Teardown
Play Mode tests should clean up scene objects in teardown. Unity does not reset the scene between Play Mode tests by default — a test that creates GameObjects and does not destroy them leaks state into the next test. Use [TearDown] to destroy test objects, or load a fresh scene in [SetUp].
“Test Runner is not silent. Every ‘nothing happens’ has a reason — usually in the asmdef or the global toggle. Read the Test Runner menus carefully.”
Related Issues
For regression testing patterns, see How to Write Regression Tests. For automating builds and tests in CI, Setting Up Automated Regression Tests covers the full pipeline.
Test Assembly checkbox, TestRunner references, global toggle. Three switches — all must be flipped.