@@ -123,6 +123,31 @@ smoke_test_steps: &smoke_test_steps
123
123
name : Validate
124
124
command : ./Smoke\ Test/scripts/validate_scheme.sh "${SMOKE_TEST_SCHEME}"
125
125
126
+ # Run Unit tests for speicified $DESTINATION and $TEST_PLAN
127
+ unit_tests : &unit_tests
128
+ steps :
129
+ - checkout
130
+ - << : *setup_ruby
131
+ - << : *setup_bundler
132
+ - attach_workspace :
133
+ at : .
134
+ - run :
135
+ name : Unit tests
136
+ command : xcodebuild test-without-building -sdk iphonesimulator -destination "$DESTINATION" -xctestrun DerivedData/Build/Products/Unit\ Tests_${TEST_PLAN}*.xctestrun -only-test-configuration "$CONFIGURATION" -resultBundlePath UnitTestResults.xcresult | bundle exec xcpretty
137
+ - run :
138
+ name : Generate Test Reports
139
+ command : bundle exec fastlane upload_test_reports
140
+ when : always
141
+ - store_test_results :
142
+ path : UnitTestResults.xml
143
+ - run :
144
+ name : Zip Test Results
145
+ command : zip -r UnitTestResults.zip UnitTestResults.xcresult
146
+ when : on_fail
147
+ - store_artifacts :
148
+ path : UnitTestResults.zip
149
+ - << : *store_crash_logs
150
+
126
151
127
152
# Define the each of the jobs used for building and testing the iOS SDK
128
153
version : 2.1
@@ -219,34 +244,26 @@ jobs:
219
244
- Rakefile
220
245
- IntercomSDK/Supporting Files/IntercomSDK-Common.xcconfig
221
246
222
- # Run Unit tests
223
- unit_tests :
247
+ # Build the Test App used for Unit testing and save it to the workspace so that it can be used by multiple jobs
248
+ build_unit_test_app : &build_unit_test_app
224
249
<< : *macos_config
225
250
steps :
226
251
- checkout
227
252
- << : *setup_ruby
228
253
- << : *setup_bundler
229
254
- << : *restore_dependencies_cache
230
255
- << : *update_dependencies_if_needed
256
+ - attach_workspace :
257
+ at : .
231
258
- run :
232
259
name : Build
233
260
command : xcodebuild -derivedDataPath DerivedData -workspace IntercomSDK.xcworkspace -scheme "Unit Tests" -sdk iphonesimulator -destination "$DESTINATION" build-for-testing | bundle exec xcpretty
234
- - run :
235
- name : Test
236
- command : xcodebuild -derivedDataPath DerivedData -workspace IntercomSDK.xcworkspace -scheme "Unit Tests" -sdk iphonesimulator -destination "$DESTINATION" test -resultBundlePath Unit_TestResults.xcresult | bundle exec xcpretty
237
- - run :
238
- name : Generate Test Reports
239
- command : bundle exec fastlane upload_test_reports
240
- when : always
241
- - store_test_results :
242
- path : Unit_TestResults.xml
243
- - run :
244
- name : Zip Test Results
245
- command : zip -r Unit_TestResults.zip Unit_TestResults.xcresult
246
- when : on_fail
247
- - store_artifacts :
248
- path : Unit_TestResults.zip
249
- - << : *store_crash_logs
261
+ - persist_to_workspace :
262
+ root : .
263
+ paths :
264
+ - " DerivedData/Build/Products/Unit\ Tests_*.xctestrun"
265
+ - " DerivedData/Build/Products/Debug-iphonesimulator/IntercomSDKTests.xctest"
266
+ - " DerivedData/Build/Products/Debug-iphonesimulator/Intercom.framework"
250
267
environment :
251
268
- DESTINATION : " platform=iOS Simulator,name=iPhone 11 Pro,OS=15.2"
252
269
@@ -335,6 +352,32 @@ jobs:
335
352
path : build/reports
336
353
- << : *store_crash_logs
337
354
355
+
356
+ # Unit tests
357
+
358
+ standard_unit_tests :
359
+ << : *macos_config
360
+ << : *unit_tests
361
+ environment :
362
+ - DESTINATION : " platform=iOS Simulator,name=iPhone 11 Pro,OS=15.2"
363
+ - TEST_PLAN : " Unit"
364
+ - CONFIGURATION : " Configuration 1"
365
+
366
+ ltr_snapshot_tests :
367
+ << : *macos_config
368
+ << : *unit_tests
369
+ environment :
370
+ - DESTINATION : " platform=iOS Simulator,name=iPhone 11 Pro,OS=15.2"
371
+ - TEST_PLAN : " Snapshot"
372
+ - CONFIGURATION : " LTR"
373
+
374
+ rtl_snapshot_tests :
375
+ << : *macos_config
376
+ << : *unit_tests
377
+ environment :
378
+ - DESTINATION : " platform=iOS Simulator,name=iPhone 11 Pro,OS=15.2"
379
+ - TEST_PLAN : " Snapshot"
380
+ - CONFIGURATION : " RTL"
338
381
339
382
# UI tests for iPhone 8 (15.2) devices. One test for each test bucket.
340
383
@@ -571,11 +614,26 @@ workflows:
571
614
- lint_objectiveC :
572
615
<< : *run_always
573
616
574
- - unit_tests :
617
+ - build_unit_test_app :
575
618
<< : *run_always
576
619
requires :
577
620
- dependencies
578
621
622
+ - standard_unit_tests :
623
+ << : *run_always
624
+ requires :
625
+ - build_unit_test_app
626
+
627
+ - ltr_snapshot_tests :
628
+ << : *run_always
629
+ requires :
630
+ - build_unit_test_app
631
+
632
+ - rtl_snapshot_tests :
633
+ << : *run_always
634
+ requires :
635
+ - build_unit_test_app
636
+
579
637
- release_deployment_tests :
580
638
<< : *run_always
581
639
requires :
@@ -696,7 +754,9 @@ workflows:
696
754
- upload_to_testfairy :
697
755
<< : *run_on_master
698
756
requires :
699
- - unit_tests
757
+ - standard_unit_tests
758
+ - ltr_snapshot_tests
759
+ - rtl_snapshot_tests
700
760
- UI_1_iphone_8
701
761
- UI_2_iphone_8
702
762
- UI_3_iphone_8
@@ -714,7 +774,9 @@ workflows:
714
774
requires :
715
775
- build_xcframework
716
776
- lint_objectiveC
717
- - unit_tests
777
+ - standard_unit_tests
778
+ - ltr_snapshot_tests
779
+ - rtl_snapshot_tests
718
780
- release_deployment_tests
719
781
- UI_1_iphone_8
720
782
- UI_2_iphone_8
0 commit comments