I thoroughly read the Unity Test Runner documentation.

It is said in the documentation that the button may be disabled only if the creation of the script will lead to an error.

This option is disabled if adding a test script would result in a compilation error.

But I do not understand this. How could a creation of the script possibly lead to an error?

I will be grateful for any help provided.

enter image description here

enter image description here

I found here a little bit more info, but it did not help me out.


To enable Create Test Script in current folder button you should change Project presentation to Two column layout.

enter image description here

Then choose Editor folder.

And then open or click Test Runner tab - it works!


That button is disabled to prevent you from creating a Test Script in an unsupported location.

According to the Unity Test Runner documentation you linked, tests need to be placed in a special folder such as an Editor folder. Valid locations:

  • Project Editor folder
  • Assembly Definition file that references test assemblies that are Editor-only
  • Precompiled assemblies that are in the Project’s Editor folder

A test script outside these valid locations would result in a compilation error (in Unity 2018.1) because UnityEngine.TestTools and NUnit.Framework namespaces which are required for test scripts would not be recognized.

To fix this issue, use that Test Runner window when you're in an Editor folder (or another valid location). The button will be enabled once you open or click on the Test Runner window while your Project is at a valid location.

For PlayMode tests, for that button to be enabled, you also need to make sure that "Enable playmode tests runner" has been toggled on in the Test Runner context menu. (The context menu button is at the top-right corner of the Test Runner window, just under the "x" button to close.) Once this is enabled and you re-open the Editor as prompted, the Test Runner window should look like this with the button enabled:


(Also, see Unity's documentation on Special folder names for more details about the Editor folder.)

  • \$\begingroup\$ I was in Editor folder when I tried this out. Did you manage to make the button enabled on your laptop? \$\endgroup\$ – Yaroslav Trofimov May 4 '18 at 21:26
  • \$\begingroup\$ I will update the question to show that the button is disabled even when I am in the Editor folder. \$\endgroup\$ – Yaroslav Trofimov May 4 '18 at 21:27
  • \$\begingroup\$ Yes it works for me. The button is enabled if I’m in the Editor folder. I had to click on the test runner window to get the button to refresh though. \$\endgroup\$ – sonny May 4 '18 at 21:32
  • \$\begingroup\$ @YaroslavTrofimov are you trying to create EditMode tests or PlayMode tests? Do they both not work with that button? \$\endgroup\$ – sonny May 4 '18 at 21:38
  • \$\begingroup\$ @YaroslavTrofimov for PlayMode tests, I've updated my answer to include that "Enable playmode tests runner" option should be toggled on in the Test Runner context menu (the menu is at the top-right of that window, under the "X") \$\endgroup\$ – sonny May 4 '18 at 22:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.