It’s pretty simple to run a test project from the command line. Here is an example in Windows:
Unity.exe -runTests -batchmode -projectPath PATH_TO_YOUR_PROJECT -testResults C:\temp\results.xml -testPlatform PS4
For more information, see Command line arguments.
Runs Unity in batch mode and ensures no pop-up windows appear to eliminate the need for any human intervention.
Don't save your current Project into the Unity launcher/hub history.
Runs tests in the Project.
A semicolon-separated list of test categories to include in the run. If using both testFilter
and testCategory
, then tests only run that matches both. This argument supports negation using '!'. If using '!MyCategory' then no tests with the 'MyCategory' category will be included in the run.
A semicolon-separated list of test names to run, or a regular expression pattern to match tests by their full name. This argument supports negation using '!'. If using the test filter '!MyNamespace.Something.MyTest', then all tests except that test will be run.
The platform you want to run tests on. Available platforms are EditMode and PlayMode.
Note: If unspecified, tests run in Edit Mode by default.
Platform/Type convention is from the BuildTarget enum. Supported platforms are:
A semicolon-separated list of test assemblies to include in the run.
The path where Unity should save the result file. By default, Unity saves it in the Project’s root folder.
The time, in seconds, the editor should wait for heartbeats after starting a test run on a player. This defaults to 10 minutes.
If included, the test run will run tests synchronously, guaranteeing that all tests runs in one editor update call. Note that this is only supported for EditMode tests, and that tests which take multiple frames (i.e. [UnityTest]
tests, or tests with [UnitySetUp]
or [UnityTearDown]
scaffolding) will be filtered out.
Path to a TestSettings.json file that allows you to set up extra options for your test run. An example of the TestSettings.json file could look like this:
{
"scriptingBackend":2,
"Architecture":null,
"apiProfile":0
}
The .Net compatibility level. Set to one of the following values:
Sets option for automatic signing of Apple devices.
Sets the team ID for the apple developer account.
Target architecture for Android. Set to one of the following values:
Set to one of the following values:
Set to one of the following values: