Scrungepipes
Scrungepipes

Reputation: 37581

How do you configure the XCode Jenkins plugin to run tests?

The instructions for running tests with the Jenkins XCode plugin say to set the test target (which I've done), the SDK (which I've done) and the configuration (which I tried with nothing, Debug, and Test).

However I keep getting "...is not configured for running".

How do I actually get it to run tests?

This is the output:

+ xcodebuild -workspace /Users/MyDir/.Jenkins/jobs/MyTests/workspace/folder/MyWorkspace.xcworkspace -scheme MyTestScheme clean
xcodebuild: error: Failed to build workspace MyWorkspace with scheme MyTestScheme.
    Reason: Scheme "MyTestScheme" is not configured for running.

If within XCode for MyTestScheme if I choose Product/Run then I get the same error message, but if I choose Product/Test then the test code executes successfully. The output from a sucessful run in Xcode is:

2013-08-28 11:10:25.828 otest[65917:303] Unknown Device Type. Using UIUserInterfaceIdiomPhone based on screen size
Test Suite 'Multiple Selected Tests' started at 2013-08-28 18:10:26 +0000
Test Suite '/Users/MyDir/Library/Developer/Xcode/DerivedData/MyWorkspace-ctngidolzdhijvbymvghygtoaiiw/Build/Products/Debug-iphonesimulator/MyTestScheme.octest(Tests)' started at 2013-08-28 18:10:26 +0000
Test Suite 'MyTests' started at 2013-08-28 18:10:26 +0000
Test Case '-[MyTests test1]' started.
2013-08-28 11:10:26.029 otest[65917:303] MDN: (null)
Test Case '-[MyTests testA1]' passed (0.346 seconds).

Upvotes: 3

Views: 3018

Answers (3)

coffeebreaks
coffeebreaks

Reputation: 3817

XCode plugin maintainer here. I don't know the answer, but I would love to help you out.

Have you tried fiddling with the destination argument ?

E.g. -destination 'OS=8.0,name=iPhone' or -destination 'platform=iOS Simulator,OS=8.0,name=iPhone 6s'

(adjust depending on your needs)

If that doesn't work, please try to copy the output generated by the run of the tests from XCode itself.

Upvotes: 2

anavarroma
anavarroma

Reputation: 1382

To configure the Xcode plugin for unit testing you need to write "test" in the "Custom xcodebuild arguments" field inside the "Advanced Xcode build options".

Upvotes: 2

ndis1
ndis1

Reputation: 164

For me the problem was using the test schema. The debug schema should be used instead.

Upvotes: 4

Related Questions