Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set up Unity Test Tools on Unity 5

I'm trying to figure out how to make it work. The documentation is slim to say the least on this important topic.

The small amount of tutorials I found make reference to options not even present when I open the tool. I don't see the Unit Test Runner, just the Integration Test runner. (version 5.3.1f1)

How to add a test? How to run it?

Integration Test runner allows you to add a test, but I was unable to find how to write the actual test.

It's sad that there's almost no documentation on this anywhere, or at least I haven't found it.

like image 315
javydreamercsw Avatar asked Jan 07 '16 16:01

javydreamercsw


People also ask

How do I add a test in Unity?

Setting up a unit test in Unity is so simple that you don't even have to type anything. Right-click in the project window and select Create > Testing > EditMode Test C# Script. This will automatically add two fully functional tests to your project. Before editing them, fire up the test runner and see them in action.

What version of NUnit does Unity use?

About Unity Test Framework Net languages. UTF currently uses NUnit version 3.5. For more information about NUnit, see the official NUnit website and the NUnit documentation.


1 Answers

The Unity Test Tools are already included in Unity starting with Version 5.3. Even without downloading the Unity Test Tools from the Asset Store you should be able to find the "Editor Test Runner" in the Window menu. This is basically the Unit Test runner. For other features such as Assertions, Integration tests etc. you still need the Unity Test Tools bundle from the Asset Store.

The test tools use NUnit internally, so you can write tests using the standard NUnit API as described here http://www.nunit.org/index.php?p=quickStart&r=2.6.3. There is also a Unity tutorial video here: https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/test-tools. Make sure to put your Tests into an Editor folder.

Also note that some features like Assertions are not supported for Windows Store Apps and you won't even be able to build for this platform as long as you have those libraries in your project.

like image 102
Thomas Hilbert Avatar answered Sep 21 '22 14:09

Thomas Hilbert