Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Writing tests

Write Unity tests for Edit mode or Play mode code with the Unity Test Framework C# APIs.
Read time 1 minuteLast updated 12 days ago

Use the Unity Test Framework APIs to write tests specially adapted to the unique features of the Unity Editor and runtime.

Topic

Description

Performing actions before and after testsPerform pre-test setup and post-test cleanup to ensure your tests run in the right conditions.
Asserting and comparingPerform assertions with constraints and compare the values of custom Unity types in your tests.
Yield instructions for the EditorYield instructions for the Unity Editor from your Edit mode tests, using either a set of pre-defined common instructions or defining your own.
Writing parameterized testsWrite parameterized tests for data-driven testing.
Writing asynchronous testsWrite asynchronous tests with the .NET Task asynchronous programming model.

Additional resources