You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -6,179 +6,195 @@ sidebar_label: Unity Test Task
6
6
7
7
# About the Unity Test Task
8
8
9
-
This task is used for running unit tests in your project. Test results will output into a test results file and the file path is provided for uploading and processing. You can find the task when editing your pipeline by searching for the name `Unity Test`.
9
+
This task is used for running unit tests in your project. Test results will output into a test results file and the file path is provided for uploading and processing.
10
10
11
-
---
11
+
## Syntax
12
12
13
-
## Inputs
13
+
```yaml
14
+
# Unity Get Project Version Task V1
15
+
# Get the project's Unity version
16
+
- task: UnityTestTask@1
17
+
inputs:
18
+
testMode: editMode
19
+
```
14
20
15
-
This task supports input variables for configuration.
| environmentVariable | Expects an environment variable `UNITYHUB_EDITORS_FOLDER_LOCATION` to exist on the agent and specifying where to find editor installations. |
47
-
| specify | Let's you specify a custom path where to lookup editor installations using the input `customUnityEditorsPath`.|
53
+
| specify | Let's you specify a custom path where to lookup editor installations using the input `customUnityEditorsPath` |
48
54
49
55
### customUnityEditorsPath
50
56
51
-
If you are using a custom buld agent you may want to specify a custom path to specify where to look for Unity installations. This input lets you do that.
52
-
Make sure to set `unityEditorsPathMode` to `specify` for this input to take effect.
57
+
Should you have configured `unityEditorsPathMode` to `specify`, this input is used to read your custom path.
53
58
54
-
**Required**: Yes, if `unityEditorsPathMode` set to `specify`
| `customUnityEditorsPath` | Editors folder location | Yes, if `unityEditorsPathMode` is `specify` | - |
55
62
56
-
**Default Value**: -
63
+
### versionSelectionMode
57
64
58
-
### unityProjectPath
65
+
This input defines how to determine the Unity version required to build the project on in the context of this task, which Unity editor version to install and / or actigvate a license with.
| project | Uses exactly the Unity version that the project was last opened with |
76
+
| specify | Let's you specify a Unity version to work with. See also input `version` |
59
77
60
-
Enter the directory path to the Unity project. If no value is entered, the project is assumed to be in the repository root.
78
+
### version
61
79
62
-
**Required**: No
80
+
The version of the Unity editor to work with, e.g. `6000.0.30f1`. You can determine the version for your project using the `ProjectVersion.txt` file within your project's `ProjectSettings` folder.
| `version` | Version | Yes, if `versionSelectionMode` is `specify` | - |
85
+
86
+
### unityProjectPath
87
+
88
+
Enter the directory path to the Unity project. If no value is entered, the project is assumed to be in the repository root. Use this input, if your Unity project is nested within subfolders within your repository.
If set, Unity runs in batch mode and disables any UI and popups to fully eliminate the need for human intervention. Note that you cannot use batch mode when testing UI.
Many command line arguments the build task will already set for you. If you find you are missing any advanced or custom command line arguments, only then you should
121
-
specify them using this input. For most use cases and projects you will not need to add any additional command line arguments.
| `additionalCmdArgs` | Command line arguments | No | - |
134
185
135
-
## Outputs
186
+
## Output variables
136
187
137
-
This task provides output variables.
188
+
This task defines the following output variables, which you can consume in downstream steps, jobs, and stages.
138
189
139
190
### testResultsOutputPathAndFileName
140
191
141
192
Path and File name of the test results in XML format.
142
193
143
-
### logsOutputPath
144
-
145
-
Path to the Unity editor log files generated while executing the task. Use this e.g. to upload logs in case of a failure.
146
-
147
-
---
148
-
149
-
## How to use
150
-
151
-
### YAML
152
-
153
-
In the simple YAML example below we are definiing the task a step in the pipeilne using `- task: UnityTestTask@1`. We are also giving the task a reference name using `name: unitytest`, so we can use it to refernce the output variables of the task in other tasks of the pipeline. E.g. we can output the value of the `testResultsOutputPathAndFileName` output variable to the console using `echo $(unitytest.testResultsOutputPathAndFileName)`. For `testMode` we specify that we want to run in `editMode`. Everything else we are leaving at the defaults.
The classic (visual) editor for Azure Pipelines provides input fields for configuring the task. In the simple example below, we set `Test mode` to `Edit Mode`, that means we are running tests that will also include the Unity Editor assembly and APIs. This is e.g. useful when testing editor extensions. We are also assigning a `Reference name` to the task, so we can use it to refernce the output variables in the variables list in other tasks of the pipeline. E.g. to get the value of the `testResultsOutputPathAndFileName` output variable and insert it into any other input field of a task we can then use `$(unitytest.testResultsOutputPathAndFileName)`. Everything else we are leaving at the defaults.
0 commit comments