I'm experiencing failures while running xctool build. My command is as follows:
xctool clean build run-tests -only 'MyApp KIF Tests' -workspace MyApp.xcworkspace/ -scheme 'Debug' -destination "platform=iOS Simulator,name=iPhone 6,OS=latest" -sdk iphonesimulator -reporter junit -reporter plain
The build fails with the following error:
Failed to query the list of test cases in the test bundle: Test bundle not found at: /Users/myusername/Library/Developer/Xcode/DerivedData/MyApp-blbvnisblktossbxwcmnxafkngts/Build/Products/Debug-iphonesimulator/MyApp KIF Tests.xctest
I looked up the MyApp KIF Tests.xctest
in the path specified in the error message, and indeed I couldn't find that file. However, this file does exist under a different path:
/Users/myusername/Library/Developer/Xcode/DerivedData/MyApp-blbvnisblktossbxwcmnxafkngts/Build/Products/Debug-iphoneos/MyApp KIF Tests.xctest
The only difference between these two paths is that one is under Debug-iphonesimulator
, and the other is under Debug-iphoneos
.
I also noticed that under target -> Build Settings -> Build Locations -> Per-configuration Build Products Path -> Debug, the value is $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
, which was evaluating to build/OktaVerify.build/Debug-iphoneos
. So the first question is: why does $(EFFECTIVE_PLATFORM_NAME)
evaluate to Debug-iphoneos
? What config do I need to change to make it evaluate to Debug-iphonesimulator
so that xctool can find it?
Next, I hardcoded the value of $(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
to Debug-iphonesimulator
, wishing to see it working. However, I got the same error. My second question is, why does the xctest file appear under Debug-iphoneos
folder even the build products path specifies Debug-iphonesimulator
? What setting is specifying Debug-iphoneos
?
Environment is Xcode 7.2 and xctool version 0.2.8.
I solved the issue by removing "-sdk iphonesimulator" from the xctool command. This way it'll automatically choose the appropriate sdk depending on the target type.