1. Unity Technologies
  2. Unity
  3. UnityTestTools

Wiki

Clone wiki

UnityTestTools / Home

Unity Test Tools Documentation

Documentation in Japanese

Integration Test Framework

Integration Tests allow you to automate the verification process of your assets directly in a scene. They are designed to be used on existing content, directly within the Editor, to build tests which verify the behaviour of single assets or the interaction between them.

How to use the Integration Test Framework

Assertion component

The Assertion Component is used to setup invariants on GameObjects. Setting up the component doesn't require writing any code - it's all done in the Editor UI. It is easily extensible, customizable, and can be configured for your own needs. 

How to use the Assertion Component

Using Assertion Component with Integration Tests

Unit Test Runner

NOTE: Since Unity 5.3 the Unit Tests Runner is a part of the Editor and was removed from the Unity Test Tools package. For more reference, look at the Editor Tests Runner section in the documentation.

The integration of the NUnit Framework in the Editor allows you to execute unit tests from inside Unity. This means you can instantiate GameObjects and operate on them which would not be possible outside of Unity. We provide an integrated test runner that runs the tests and reports results.

How to use Unit Test Runner Editor Tests Runner

NSubstitute library

NSubstitute is shipped with the Unity Test Framework. Please use its documentation for help: http://nsubstitute.github.io/help.html 

Examples

Examples provided with the framework

Examples

General Q&A

Which version of Unity is the framework compatible with?
The framework is compatible with Unity 4.X.

Can I write unit test only in C#?
Although we focus on C# there should be no problems with writing tests in UnityScript or Boo.

Can I move the tools to any subfolder?
Yes.

Why the framework doesn't work when I move it to Standard Assets folder?
The current folder structure design will not work with the way Standard Assets folder is handled. However, with a little bit of work, you can move it to Standard Assets. Simply move all editor-dependant code to "Standard Assets/Editor" and place the rest under "Standard Assets"

What are the currently known issues and limitations?
The limitations are as follows:

- NSubstitute that comes with the framework is not threadsafe.
- Windows Apps store (Metro) does not support Assertion Component or Integration Tests framework due to limitations in functionality
- Result won't be send when running integration tests for WebPlayer

Updated