Author and run the Unity game-engine Test Framework (`com.unity.test-framework`, currently v1.8). Distinct from the ThrowTheSwitch Unity C testing library at throwtheswitch.org/unity - the two tools share only a name. Covers package install via Package Manager, the EditMode vs PlayMode split, the [Test] / [UnityTest] / [SetUp] / [TearDown] / [UnityPlatform] attributes, assembly-definition setup (Editor folder vs asmdef with `includePlatforms` / `optionalUnityReferences: [TestAssemblies]`), Test Runner window, command-line batch invocation with `-runTests` / `-testPlatform` / `-testResults` / `-testFilter` / `-testCategory`, NUnit 3.5 assertion API, and CI integration. Use when the unit under test is C# Unity code that needs to exercise the Unity runtime or editor.
70
88%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Low
Low-risk findings worth noting
Batch-mode flags and the exit-code caveat for unity-test-framework, per the command-line reference.
| Flag | Effect |
|---|---|
-runTests | "Executes tests within the project." |
-batchmode | "Removes the need for manual user inputs when running tests from the command line." |
-projectPath <path> | Project root. |
-testResults <path> | "Designates where Unity stores the result file (XML format per NUnit standards). If unspecified, results are saved in the project root." |
-testPlatform EditMode|PlayMode|<BuildTarget> | "Default: EditMode if not specified." BuildTarget (e.g. StandaloneWindows64, Android) runs tests on a built player for that platform. |
-testFilter "Pattern" | "Accepts a semicolon-separated list or regex pattern to match test names. Supports negation with !." |
-testCategory "Smoke;Critical" | "Accepts a semicolon-separated list or regex pattern for category matching. Also supports negation with !." |
-assemblyNames "MyGame.Tests.PlayMode" | Limit to specific test assemblies. |
-runSynchronously | Run on the main thread synchronously (EditMode only). |
-orderedTestListFile, -randomOrderSeed, -retry, -repeat, -playerHeartbeatTimeout, -testSettingsFile | "Control test execution order, failure handling, timing, and settings configuration" per the same page. |
Unity \
-batchmode \
-projectPath "$PWD" \
-runTests \
-testPlatform PlayMode \
-testResults artifacts/playmode-results.xml \
-testCategory "Smoke" \
-logFile artifacts/unity.logWindows equivalent: invoke
"C:\Program Files\Unity\Hub\Editor\<version>\Editor\Unity.exe"
with the same flags.
Per the command-line reference: "There is currently no common definition for
exit codes reported by individual Unity components under test. Error messages
and stack traces in results provide better diagnostic information." Treat the
produced -testResults XML as the source of truth in CI rather than the
process exit code.