Unable to include Unity.Entities.Tests for Unity ECS Testing

Hello,

I am consistently having problems including new assembly references in my Unit Tests. In the 2020 builds, getting Unit Testing up has been nightmarishly difficult.

This is my Tests.asmdef.

{
    "name": "Tests",
    "rootNamespace": "",
    "references": [
        "Unity.Entities",
        "Unity.Entities.Tests",
        "Game",
        "UnityEngine.TestRunner",
        "UnityEditor.TestRunner"
    ],
    "includePlatforms": [
        "Editor"
    ],
    "excludePlatforms": [],
    "allowUnsafeCode": true,
    "overrideReferences": true,
    "precompiledReferences": [
        "nunit.framework.dll"
    ],
    "autoReferenced": false,
    "defineConstraints": [
        "UNITY_INCLUDE_TESTS"
    ],
    "versionDefines": [],
    "noEngineReferences": false
}

I am strictly including Unity.Entities.Tests, but in my test script…

ECSTestsFixture cannot be found, and the assembly reference is missing.

I have tried completely rebooting Unity and .net, deleting Tests/ and obj/, toggling certain assembly features on and off. Nothing, absolutely nothing, is getting this reference in .net.

Any ideas?

After hours of messing with this I found the answer here:

In manifest.json, manually append this value and allow Unity Editor to recompile.

  "testables" : [
    "com.unity.entities"
  ]

You will see Unity.X.dlls in the EditMode unit tester and your assembly references will magically work.

Edit: This does not seem to cause .NET to recognize the file and while it will compile, .NET will throw squiggles on everything.

1 Like