Can't run Kiwi tests (XCTest) in xcodebuild (Xcode 6)

437 Views Asked by At

I'm trying to run my tests using the CLI tools. After following various guides, I came up with this command:

xcodebuild -workspace myworkspace.xcworkspace -scheme testsScheme -sdk iphonesimulator -arch i386 -configuration Debug TEST_AFTER_BUILD=YES clean build

The error I'm getting is:

The following build commands failed:
    Ld /Users/<my name>/Library/Developer/Xcode/DerivedData/<project name>-gqrdtdiypfxjrbbjaqofxcjdckcg/Build/Products/Debug-iphonesimulator/<target or schema name>.xctest/<target or schema name> normal i386

I have no idea why the build fails as the error message is not very giving.

As for my pre-configuration, I've followed some guides and did the following: I've added a test-only scheme which targets my tests target (like I've seen in many guides), and also set it's executable to be the .app file (the default settings has no executable which results in an error that the app file is not found).

I'm using Cocoapods, and still not using the standard architecture (arm7, arm64) in my project (I'm dependent on a 3rd party that still hasn't upgraded, so currently my setting is $(ARCHS_STANDARD_32BIT)).

I've also checked that the "${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests" run script appears and happens last in the build phases.

Note that running the tests using CMD+U works as intended.

EDIT: Apparently, The .app file wasn't created after a clean (so removing the clean or pre-building the app worked). Nevertheless (even though I need to solve this as well). I'm now getting this error:

PhaseScriptExecution Run\ Script /Users/shay/Library/Developer/Xcode/DerivedData/<name>-gqrdtdiypfxjrbbjaqofxcjdckcg/Build/Intermediates/<name>.build/Debug-iphonesimulator/<test schema>.build/Script-48FB07F617A93C57006E5E2A.sh

I've read that might happen when the iOS simulator is opened, but it happens even if I kill it before running the script.

1

There are 1 best solutions below

0
On BEST ANSWER

After sleeping on it, I solved my issue by running:

xcodebuild -workspace <name>.xcworkspace -scheme <scheme> -sdk iphonesimulator -arch i386 -configuration Debug clean build test

Where the scheme is the original one, and not a specially-created one for the tests.