Unit tests
Enable and configure unit tests in Unity Build Automation to catch issues early and ensure code quality.
Read time 2 minutesLast updated 16 hours ago
Enable unit tests in your Build Target configuration to catch issues early, ensure code quality, and prevent regressions before deployment. Unity Build Automation (UBA) provides integrated support to run unit tests as part of the build process. UBA supports both Edit Mode and Play Mode tests, with options to control test execution and handle failures. Refer to more information on Edit Mode and Play Mode tests in the Unity Editor manual.
Enable unit tests
Enable and configure unit tests in the Unity Dashboard:- Select Build Automation > Configurations.
- Select the edit (pencil) icon to open the build target settings.
- Select Advanced Settings.
- Under the Tests section, select the test options that you want to enable.
- Select Save changes.
Assets/TestsTest configuration options
The following test options are available:Test Configuration Option | Description |
|---|---|
| Run my project's unit tests when building | Unit tests run when you run a build. |
| Run EditMode tests | Your Edit Mode tests run when you run a build. |
| Run PlayMode tests | Your Play Mode tests run when you run a build. |
| Mark build as failed if any test fails | UBA marks any build that fails a unit test suite as failed, even if the build is otherwise successful. |
Access and review test results
UBA provides test results in the build logs and artifacts. After a build completes:- Navigate to the Build History section in the Unity Dashboard.
- Select the completed build to view its details.
- Review the test summary to find the number of passed, failed, and skipped tests.
- Download detailed test reports for in-depth analysis.

UBA Unit Test View
- Check the Build logs for warnings or errors related to test execution.
- Check that you properly tagged and located your tests in recognized test folders.