Missing namespace for unityEngine.TestTools and NUnit.Framework

Hi all, I am just begin to write some unit test for my game. The test script file showing me some errors regarding the missing namespace (“UnityEngine.TestTools/NUnit.Framework”). Currently i am using unity version 2018.2.6f1.

Do i need to install any asset or package to use the test runner and remove the compile errors?

Hi @khean
For having the nunit references you need to do something active. The reason is that we don’t want to include these assemblies in game builds.
You have two options:
-“Enable playmode tests for all assemblies” option, that you can enable in the test runner window menu drop down in the top left corner, that basically will add the references, but this has the side effect of you shipping those in a possible game.

  • Use Asmdef with enabled “Reference Test Assemblies”, this option will only include when you run tests, and will not end up in a possible game.

You can read all about it here: Unity - Manual: Unit Testing