文档

Unity Engine

Unity Engine

Writing tests

Write Unity tests for Edit mode or Play mode code with the Unity Test Framework C# APIs.
阅读时间1 分钟最后更新于 25 天前

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