-
Notifications
You must be signed in to change notification settings - Fork 37
/
step.yml
317 lines (260 loc) · 11.7 KB
/
step.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
title: Xcode Test for iOS
summary: |-
Runs your project's pre-defined Xcode tests on every build.
description: |-
This Steps runs all those Xcode tests that are included in your project.
The Step will work out of the box if your project has test targets and your Workflow has the **Deploy to Bitrise.io** Step which exports the test results and (code coverage files if needed) to the Test Reports page.
This Step does not need any code signing files since the Step deploys only the test results to [bitrise.io](https://www.bitrise.io).
### Configuring the Step
If you click into the Step, there are some required input fields whose input must be set in accordance with the Xcode configuration of the project.
The **Scheme** input field must be marked as Shared in Xcode.
### Troubleshooting
If the **Deploy to Bitrise.io** Step is missing from your Workflow, then the **Xcode Test for iOS** Step will not be able to export the test results on the Test Reports page and you won't be able to view them either.
The xcpretty output tool does not support parallel tests.
If parallel tests are enabled in your project, go to the Step's **xcodebuild log formatting** section and set the **Log formatter** input's value to `xcodebuild` or `xcbeautify`.
If the Xcode test fails with the error `Unable to find a destination matching the provided destination specifier`, then check our [system reports](https://stacks.bitrise.io) to see if the requested simulator is on the stack or not.
If it is not, then pick a simulator that is on the stack.
### Useful links
- [About Test Reports](https://devcenter.bitrise.io/testing/test-reports/)
- [Running Xcode Tests for iOS](https://devcenter.bitrise.io/testing/running-xcode-tests/)
### Related Steps
- [Deploy to Bitrise.io](https://www.bitrise.io/integrations/steps/deploy-to-bitrise-io)
- [iOS Device Testing](https://www.bitrise.io/integrations/steps/virtual-device-testing-for-ios)
website: https://github.com/bitrise-steplib/steps-xcode-test
source_code_url: https://github.com/bitrise-steplib/steps-xcode-test
support_url: https://github.com/bitrise-steplib/steps-xcode-test/issues
project_type_tags:
- ios
- cordova
- ionic
- react-native
- flutter
type_tags:
- test
is_always_run: false
is_skippable: false
toolkit:
go:
package_name: github.com/bitrise-steplib/steps-xcode-test
inputs:
- project_path: $BITRISE_PROJECT_PATH
opts:
title: Project path
summary: Path of the Xcode Project (`.xcodeproj`), Workspace (`.xcworkspace`) or Swift package (`Package.swift`)
description: |-
Xcode Project (`.xcodeproj`) or Workspace (`.xcworkspace`) path.
The input value sets xcodebuild's `-project` or `-workspace` option.
If this is a Swift package, this should be the path to the `Package.swift` file.
is_required: true
- scheme: $BITRISE_SCHEME
opts:
title: Scheme
summary: Xcode Scheme name.
description: |-
Xcode Scheme name.
The input value sets xcodebuild's `-scheme` option.
is_required: true
- destination: platform=iOS Simulator,name=Bitrise iOS default,OS=latest
opts:
title: Device destination specifier
summary: Destination specifier describes the device to use as a destination.
description: |-
Destination specifier describes the device to use as a destination.
The input value sets xcodebuild's `-destination` option.
In a CI environment, a Simulator device called `Bitrise iOS default` is already created.
It is a compatible device with the selected Simulator runtime, pre-warmed for better performance.
If a device with this name is not found (e.g. in a local dev environment), the first matching device will be selected.
is_required: true
- test_plan:
opts:
title: Test Plan
summary: Run tests in a specific Test Plan associated with the Scheme.
description: |-
Run tests in a specific Test Plan associated with the Scheme.
Leave this input empty to run the default Test Plan or Test Targets associated with the Scheme.
The input value sets xcodebuild's `-testPlan` option.
# Test Repetition
- test_repetition_mode: retry_on_failure
opts:
category: Test Repetition
title: Test Repetition Mode
summary: Determines how the tests will repeat.
description: |-
Determines how the tests will repeat.
Available options:
- `none`: Tests will never repeat.
- `until_failure`: Tests will repeat until failure or up to maximum repetitions.
- `retry_on_failure`: Only failed tests will repeat up to maximum repetitions.
- `up_until_maximum_repetitions`: Tests will repeat up until maximum repetitions.
The input value together with Maximum Test Repetitions (`maximum_test_repetitions`) input sets xcodebuild's `-run-tests-until-failure` / `-retry-tests-on-failure` or `-test-iterations` option.
value_options:
- none
- until_failure
- retry_on_failure
- up_until_maximum_repetitions
- maximum_test_repetitions: 3
opts:
category: Test Repetition
title: Maximum Test Repetitions
summary: The maximum number of times a test repeats based on the Test Repetition Mode (`test_repetition_mode`).
description: |-
The maximum number of times a test repeats based on the Test Repetition Mode (`test_repetition_mode`).
Should be more than 1 if the Test Repetition Mode is other than `none`.
The input value sets xcodebuild's `-test-iterations` option.
is_required: true
- relaunch_tests_for_each_repetition: "no"
opts:
title: Relaunch Tests for Each Repetition
category: Test Repetition
summary: If this input is set, tests will launch in a new process for each repetition.
description: |-
If this input is set, tests will launch in a new process for each repetition.
By default, tests launch in the same process for each repetition.
The input value sets xcodebuild's `-test-repetition-relaunch-enabled` option.
value_options:
- "yes"
- "no"
# xcodebuild configuration
- xcconfig_content: COMPILER_INDEX_STORE_ENABLE = NO
opts:
category: xcodebuild configuration
title: Build settings (xcconfig)
summary: Build settings to override the project's build settings, using xcodebuild's `-xcconfig` option.
description: |-
Build settings to override the project's build settings, using xcodebuild's `-xcconfig` option.
You can't define `-xcconfig` option in `Additional options for the xcodebuild command` if this input is set.
If empty, no setting is changed. When set it can be either:
1. Existing `.xcconfig` file path.
Example:
`./ios-sample/ios-sample/Configurations/Dev.xcconfig`
2. The contents of a newly created temporary `.xcconfig` file. (This is the default.)
Build settings must be separated by newline character (`\n`).
Example:
```
COMPILER_INDEX_STORE_ENABLE = NO
ONLY_ACTIVE_ARCH[config=Debug][sdk=*][arch=*] = YES
```
- perform_clean_action: "no"
opts:
category: xcodebuild configuration
title: Perform clean action
summary: If this input is set, `clean` xcodebuild action will be performed besides the `test` action.
value_options:
- "yes"
- "no"
is_required: true
- xcodebuild_options: ""
opts:
category: xcodebuild configuration
title: Additional options for the xcodebuild command
summary: Additional options to be added to the executed xcodebuild command.
description: |-
Additional options to be added to the executed xcodebuild command.
Prefer using `Build settings (xcconfig)` input for specifying `-xcconfig` option. You can't use both.
# xcodebuild log formatting
- log_formatter: xcbeautify
opts:
category: xcodebuild log formatting
title: Log formatter
summary: Defines how xcodebuild command's log is formatted.
description: |-
Defines how xcodebuild command's log is formatted.
Available options:
- `xcbeautify`: The xcodebuild command's output will be beautified by xcbeautify.
- `xcodebuild`: Only the last 20 lines of raw xcodebuild output will be visible in the build log.
- `xcpretty`: The xcodebuild command's output will be prettified by xcpretty.
The raw xcodebuild log will be exported in all cases.
value_options:
- xcbeautify
- xcodebuild
- xcpretty
is_required: true
- xcbeautify_options:
opts:
category: xcodebuild log formatting
title: Additional options for the xcbeautify command
summary: Additional options to be added to the executed xcbeautify command.
- xcpretty_options: --color --report html --output "${BITRISE_DEPLOY_DIR}/xcode-test-results-${BITRISE_SCHEME}.html"
opts:
category: xcodebuild log formatting
title: Additional options for the xcpretty command
summary: Additional options to be added to the executed xcpretty command.
# Caching
- cache_level: none
opts:
category: Branch-based (legacy) caching
title: Enable collecting cache content
summary: Defines what cache content should be automatically collected. Use key-based caching instead for better performance.
description: |-
Defines what cache content should be automatically collected. Use key-based caching instead for better performance.
Available options:
- `none`: Disable collecting cache content.
- `swift_packages`: Collect Swift PM packages added to the Xcode project.
With key-based caching, you only need the Restore SPM cache and the Save SPM cache Steps to cache your Swift packages.
[See devcenter for more information.](https://devcenter.bitrise.io/en/dependencies-and-caching/managing-dependencies-for-ios-apps/managing-dependencies-with-spm.html#caching-swift-packages)
value_options:
- none
- swift_packages
# Debugging
- verbose_log: "no"
opts:
category: Debugging
title: Enable verbose logging
summary: If this input is set, the Step will print additional logs for debugging.
value_options:
- "yes"
- "no"
- collect_simulator_diagnostics: never
opts:
category: Debugging
title: Collect Simulator diagnostics
summary: If this input is set, the simulator verbose logging will be enabled and the simulator diagnostics log will be exported.
value_options:
- always
- on_failure
- never
- headless_mode: "yes"
opts:
category: Debugging
title: Run the simulator in headless mode
summary: In headless mode the simulator is not launched in the foreground.
description: |-
In headless mode the simulator is not launched in the foreground.
If this input is set, the simulator will not be visible but tests (even the screenshots) will run just like if you run a simulator in foreground.
value_options:
- "yes"
- "no"
outputs:
- BITRISE_XCODE_TEST_RESULT:
opts:
title: Test result
description: Result of the tests. 'succeeded' or 'failed'.
value_options:
- succeeded
- failed
- BITRISE_XCRESULT_PATH:
opts:
title: The path of the generated `.xcresult`
description: |-
The path of the generated `.xcresult`.
- BITRISE_XCRESULT_ZIP_PATH:
opts:
title: The path of the zipped `.xcresult`
description: |-
The path of the zipped `.xcresult`.
- BITRISE_XCODE_TEST_ATTACHMENTS_PATH:
opts:
title: The full, test attachments zip path
description: |-
This is the path of the test attachments zip.
- BITRISE_XCODEBUILD_BUILD_LOG_PATH:
opts:
title: xcodebuild build command log file path
description: |-
If `single_build` is set to false, the step runs `xcodebuild build` before the test,
and exports the raw xcodebuild log.
- BITRISE_XCODEBUILD_TEST_LOG_PATH:
opts:
title: xcodebuild test command log file path
description: |-
The step exports the `xcodebuild test` command output log.