Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

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

Discussion in 'Editor & General Support' started by LuckyWonton, Dec 12, 2020.

  1. LuckyWonton

    LuckyWonton

    Joined:
    Feb 28, 2014
    Posts:
    19
    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.

    Code (csharp):
    1.  
    2. {
    3.     "name": "Tests",
    4.     "rootNamespace": "",
    5.     "references": [
    6.         "Unity.Entities",
    7.         "Unity.Entities.Tests",
    8.         "Game",
    9.         "UnityEngine.TestRunner",
    10.         "UnityEditor.TestRunner"
    11.     ],
    12.     "includePlatforms": [
    13.         "Editor"
    14.     ],
    15.     "excludePlatforms": [],
    16.     "allowUnsafeCode": true,
    17.     "overrideReferences": true,
    18.     "precompiledReferences": [
    19.         "nunit.framework.dll"
    20.     ],
    21.     "autoReferenced": false,
    22.     "defineConstraints": [
    23.         "UNITY_INCLUDE_TESTS"
    24.     ],
    25.     "versionDefines": [],
    26.     "noEngineReferences": false
    27. }
    I am strictly including Unity.Entities.Tests, but in my test script...

    upload_2020-12-12_15-22-49.png

    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?
     
  2. LuckyWonton

    LuckyWonton

    Joined:
    Feb 28, 2014
    Posts:
    19
    After hours of messing with this I found the answer here:
    https://forum.unity.com/threads/how-to-unit-test-where-is-the-unity-entities-tests-namespace.540251/

    In manifest.json, manually append this value and allow Unity Editor to recompile.
    Code (csharp):
    1.  
    2.   "testables" : [
    3.     "com.unity.entities"
    4.   ]
    5.  
    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.
     
    Last edited: Dec 12, 2020
    psuong likes this.