Jeef Jeef - 2 months ago 13
iOS Question

Xcode command line test execution issues

I'm in a strange situation where I can get

xctool
to run my test but I cant figure out the equivalent command line to get
xcodebuild
and/or fastlane
scan
to run my tests.
I have an iPad only application with a single scheme and two targets (otto and ottoTests)

Working XCTool Commandline



xctool -scheme otto \
-sdk iphonesimulator \
CODE_SIGN_IDENTITY=""\
CODE_SIGNING_REQUIRED=NO \
-reporter pretty\
-reporter junit:./test-reports/otto.xml\
build test


Xcodebuild - fail



xcodebuild -sdk iphonesimulator \
-scheme otto \
test CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO


I get this error that


A build only device cannot be used to run this target


enter image description here

So I'm kind of at a loss here exactly what is different between
xcodebuild
and whatever
xctool
is running.

Answer

AFAICS, you are missing the -destination argument in the xcodebuild command. Refer to this tutorial for sample code.

Comments