https://developer.apple.com/documentation/xcode-release-notes/xcode-13_3-release-notes
-testProductsPath argument for xcodebuild exists in Xcode 13.3 beta 2. It helps to split xcodebuild for testing. xcodebuild already has build-for-testing and test-without-building. This argument enhances the usage more.
In Appium/WDA build already has some helpful methods to run WDA fast. appium:useXctestrunFile, appium:usePrebuiltWDA and appium:derivedDataPath. This testProductsPath helps appium:useXctestrunFile way to make it simple.
So,
xcodebuild build-for-testing -project /path/to/WebDriverAgent.xcodeproj -scheme WebDriverAgentRunner -destination id=6CAF873C-78B9-41ED-9C3F-27F684FC2A50 IPHONEOS_DEPLOYMENT_TARGET=15.4 GCC_TREAT_WARNINGS_AS_ERRORS=0 COMPILER_INDEX_STORE_ENABLE=NO -testProductsPath ./example
Then, the command generates example.xctestproducts. Then,
xcodebuild test-without-building -destination id=6CAF873C-78B9-41ED-9C3F-27F684FC2A50 -testProductsPath ./example
It starts as below:
% xcodebuild test-without-building -destination id=6CAF873C-78B9-41ED-9C3F-27F684FC2A50 -testProductsPath ./example
Command line invocation:
/Applications/Xcode-beta.app/Contents/Developer/usr/bin/xcodebuild test-without-building -destination id=6CAF873C-78B9-41ED-9C3F-27F684FC2A50 -testProductsPath ./example
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Testing started
2022-02-09 22:19:11.451960-0800 WebDriverAgentRunner-Runner[4690:76286] Running tests...
Test Suite 'All tests' started at 2022-02-09 22:19:12.006
Test Suite 'WebDriverAgentRunner.xctest' started at 2022-02-09 22:19:12.012
Test Suite 'UITestingUITests' started at 2022-02-09 22:19:12.016
t = nans Suite Set Up
Test Case '-[UITestingUITests testRunner]' started.
t = 0.00s Start Test at 2022-02-09 22:19:12.111
t = 0.01s Set Up
2022-02-09 22:19:12.118798-0800 WebDriverAgentRunner-Runner[4690:76286] Built at Feb 9 2022 22:11:15
2022-02-09 22:19:12.141459-0800 WebDriverAgentRunner-Runner[4690:76286] ServerURLHere->http://192.168.4.20:8100<-ServerURLHere
2022-02-09 22:19:12.142526-0800 WebDriverAgentRunner-Runner[4690:76331] Using singleton test manager
2022-02-09 22:19:13.253207-0800 WebDriverAgentRunner-Runner[4695:76360] Running tests...
Restarting after unexpected exit, crash, or test timeout in -[UITestingUITests testRunner]; summary will include totals from previous launches.
Test Suite 'Selected tests' started at 2022-02-09 22:19:13.446
Test Suite 'WebDriverAgentRunner.xctest' started at 2022-02-09 22:19:13.451
Test Suite 'UITestingUITests' started at 2022-02-09 22:19:13.452
t = nans Suite Set Up
Test Suite 'UITestingUITests' failed at 2022-02-09 22:19:13.514.
Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.061) seconds
Test Suite 'WebDriverAgentRunner.xctest' failed at 2022-02-09 22:19:13.515.
Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.064) seconds
Test Suite 'Selected tests' failed at 2022-02-09 22:19:13.516.
Executed 1 test, with 1 failure (0 unexpected) in 0.000 (0.069) seconds
This step helps to make xcodebuild fast without other tools.