Unity: Showing Tests from Packages in Test Runner

Symptoms

Assuming the tests and their assembly definition have been correctly configured, Test Runner still shows no test from my package.

Solution

Unless it’s an embedded package located in the Packages folder, the tests in packages are not included in the Test Runner by default.

To let Test Runner include those tests, we need to add the package in testables in Packages/manifest.json.

{
  "dependencies": {
    "com.unity.some-package": "1.0.0",
    "com.unity.other-package": "2.0.0",
    "com.unity.yet-another-package": "3.0.0",
  },
  "testables": [
    "com.mycompany.mypackage"
  ]
}

In this case, tests in package com.mycompany.mypackage will be showed in the Test Runner after the editor refreshes.

Reference

Leave a Comment