Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle test task failing following update to Xcode 8 #296

Closed
adil-hussain-84 opened this issue Sep 15, 2016 · 19 comments
Closed

Gradle test task failing following update to Xcode 8 #296

adil-hussain-84 opened this issue Sep 15, 2016 · 19 comments

Comments

@adil-hussain-84
Copy link

adil-hussain-84 commented Sep 15, 2016

I have an iOS Framework project that is composed of the main Framework target as well as a static library target. I've been running the gradle test task on this project with Xcode 7 installed and the tests in the test target having been running as expected. Following my update of Xcode yesterday to the latest version (8), the tests run fine within Xcode but fail when run via the gradle test task.

I see that the gradle test task does manage to launch the simulator but the task fails subsequently with a linking error as follows:

ERROR - Linking: Build/sym/Debug-iphonesimulator/MySDK.framework/MySDK
Testing failed:
"_AbstractTicketDecoder_initialize", referenced from:
"_AccountConverters_initialize", referenced from:
...

The classes that it's complaining of are those that reside in the static library target.

Is anyone else having problems running their tests via the Gradle plugin?

@renep
Copy link
Contributor

renep commented Sep 15, 2016

I have also problems with one project that the tests do not execute.

I have the following error in the Session-Tests log:
2016-09-15 12:33:07.921 xcodebuild[94655:387847] Error Domain=IDETestOperationsObserverErrorDomain Code=5 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}

(You find the Sesson-Test log the the Derived Data directory when you view the ouput in the Console.app)

I don't know it this is releated to your issue...

@adil-hussain-84
Copy link
Author

Hey @renep, this is what I see in the log file in my Derived Data directory:

...
12:49:09.206 xcodebuild[14819:145675] Waiting for test process to launch.
12:49:22.565 xcodebuild[14819:145675] Test operation failure: Test operation was canceled.
12:49:22.565 xcodebuild[14819:145675] _finishWithError:Error Domain=IDETestOperationsObserverErrorDomain Code=3 "Test operation was canceled." UserInfo={NSLocalizedDescription=Test operation was canceled.} didCancel: 1

I suspect the test operation was cancelled for me because of the linking error as pasted in my question earlier but I'm not certain. I'll try running my tests from the command line using the xcodebuild test ... command instead of the Gradle task. Will let you know if that reports the same linking error or not.

@adil-hussain-84
Copy link
Author

Just tried running my tests with this command...

xcodebuild test -workspace MySDK.xcworkspace -scheme MySDK -destination 'platform=iOS Simulator,name=iPhone 6,OS=9.3'

... and the tests ran successfully. Not sure what's going wrong with the Gradle plugin?

@renep
Copy link
Contributor

renep commented Sep 15, 2016

I'm wondering...
You say you use Xcode8, but you run the tests with the iOS 9 simulator.

@adil-hussain-84
Copy link
Author

Hey @renep, sorry, I should have said: I tried running the tests via the Gradle plugin against the iOS 10.0 Simulator also and got the same linking error.

The reason I ran the xcodebuild test ... command against the iOS 9.3 Simulator is because my tests are failing when run against the iOS 10.0 Simulator but that's for reasons independent of the Gradle plugin.

@renep
Copy link
Contributor

renep commented Sep 15, 2016

Have you tried the 0.14.2-develop version?

@renep
Copy link
Contributor

renep commented Sep 26, 2016

@hennykat can you run the gradle command with -debug and post (or mail me) the last part of the log output, so that I can see what is wrong.

@renep
Copy link
Contributor

renep commented Sep 27, 2016

Looks like that the simulator can be launched or crashes.
Can you try to shut down the simulator first and then run a "gradle simCreate" so that all the simualtors are recreated and try the build again.

@renep
Copy link
Contributor

renep commented Sep 27, 2016

And using Xcode 8 compiling and running the unit tests works?

What does the log file say that in derivedData/Logs/Test...

@adil-hussain-84
Copy link
Author

Hi @renep, I just tried using the current development version of the plugin but unfortunately I'm seeing the same error message as describe earlier in this thread.

@renep
Copy link
Contributor

renep commented Oct 5, 2016

Does this issue also occur when you create a new project?

If not can you create example project that has this problem.

My problem is that I cannot reproduce this issue, therefor it is hard to guess what the problem is.

@adil-hussain-84
Copy link
Author

@renep: Sure, I'll make a new project that demonstrates the problem. Watch this space.

@wujood
Copy link

wujood commented Nov 4, 2016

I'm having the same issue. Last week everything worked fine. Now that i have Unit-Tests in Swift instead of obj-C the test won't run. Any update?

@renep
Copy link
Contributor

renep commented Nov 4, 2016

As I said, I cannot reproduce this issue. If someone provide an example project where I can reproduce this issue, I can work on it.

@adil-hussain-84
Copy link
Author

Apologies for the delay in putting together a project that demonstrates this error. It's on my todo list.

@CodeStage
Copy link

FYI: I had the following error when running a test target on Jenkins, but not when running it directly in Xcode. As it turns out, you need to copy your frameworks in a copy files phase for test targets...

xcodebuild[75962:9097252] Error Domain=IDETestOperationsObserverErrorDomain Code=5 "Early unexpected exit, operation never finished bootstrapping - no restart will be attempted" UserInfo={NSLocalizedDescription=Early unexpected exit, operation never finished bootstrapping - no restart will be attempted}

@adil-hussain-84
Copy link
Author

@CodeStage: good to hear you got it working! What values did you put in for "Destination", "Subpath" etc in the "Copy Files" Build Phases setting that you added?

I've attached a screenshot of my project structure (see below). As you can see, my test target links to the "ShardCode" and "TestContracts" static library targets by by means of the "Link Binary With Libraries" Build Phase. And my test target links to the "JustRideSDK" target by means of the "Compile Sources" Build Phase. The tests run and pass when run in Xcode. I get linker errors however when running the tests by means of the Xcode Gradle plugin.

(I am yet to compose a small example of the problem. Watch this space!)

screen shot xcode project

@CodeStage
Copy link

Destination: Frameworks
Rest: blank

I had to add the dynamic frameworks (e.g. Swift frameworks) in a copy files phase.

You don't need to copy static libraries for test targets AFAIK, because they are already linked to your app. So you might have another issue there...

@adil-hussain-84
Copy link
Author

Good news: I've just tried this on Xcode 9.0 with the latest development version of this plugin and it appears to be working again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants