Xcode 5 -- Test target did not finish
Asked Answered
D

6

9

Since earlier today, I cannot get my tests to pass when running them from Xcode 5. I know all the tests are passing, because I can run them from command line (well, a CI Job) and they're all passing there.

Have I accidentally changed some project setting or something to cause this? I can't figure out any way to get back to a good state -- I've tried dropping back several versions in our Git history, so I know it's not a code change...

Edit: After uninstalling and re-installing the application, all of the tests are running to completion, but my question still remains -- How did it get to this state?

Descriptive answered 24/9, 2013 at 21:53 Comment(9)
maybe it is a bug in xcode5, maybe some user config that ignored by git was changedBev
I had thought about the potential of it being an ignored User Config, but wasn't able to find anything unfortunately. Still haven't reproduced it...Descriptive
Managed to accidentally reproduce it several more times. I still have no idea what caused it, though. I tried upgrading to XCTest, which I had seen elsewhere as a suggestion, which temporarily fixed the problem, only to have it happen again the next day.Descriptive
I see it a few times - but I've just filed a radar and ignored it.Stillbirth
Filing a radar -- that would have been a good idea. Thanks for the reminder.Descriptive
In my case, it happened while targeting an iOS simulator earlier than iOS 7. https://mcmap.net/q/467443/-xcode-5-throws-quot-library-not-loaded-quot-error-when-adding-a-test-target. Could it be that you changed the scheme's destination?Elute
Hmm. We're using the 7 simulator, but I don't think our minimum targeted version was set to 7 (probably 6 or 6.1). If I could reproduce it again, I'll see what my settings are.Descriptive
@Stillbirth What's your Radar # for this? And can you clone the bug's info to openradar?Multidisciplinary
I filed it during beta so it's not on open radar. However, it's fixed in a soon to be released updateStillbirth
D
3

Without receiving a better answer after a couple weeks, I'm going to answer my own question with the solution that seems to have worked for me.

A simple uninstall/reinstall from the simulator seems to fix the problem, though I've yet to determine what causes it, or why this fixes it.

Descriptive answered 7/10, 2013 at 16:9 Comment(0)
P
2

I also had this issue. For me, the change that fixed it was to convert the Wrapper Extension in Build Settings from octest to xctest, as @owenfi answered here: XCTest did not finish in Xcode 5

Primateship answered 30/12, 2013 at 20:17 Comment(1)
I had actually tried that (one of my comments above), but it unfortunately didn't fix it for me.Descriptive
K
1

I was having the same problem, in my case the problem arised after creating multiple targets/renaming targets.

To solve it, I had to select the test target in the 'target browser'(whatever the name is for that), then on the 'General' tab there is a single dropdown box labeled 'target'. Mine was set to 'none', which caused nothing to be tested. I had to re-set it to one of my valid targets for the tests to run.

Keener answered 13/12, 2013 at 18:7 Comment(1)
In my case, I hadn't done any renaming. Thanks for the suggestion, though.Descriptive
M
1

For me, it appeared to be an issue with 64-bit Simulator. None of the tests could run on 64-bit, but when i switched to 32-bit, they started to run.

Miniature answered 5/3, 2014 at 8:58 Comment(0)
D
0

I managed to fix this by removing my call to the freopen() function which was redirecting the logs to a file. I also fixed it for a test by removing a couple of NSLog() calls which were printing large amounts of data to the console. Xcode must read the log as it is coming in to the window for checking if a test has finished or not and the huge amount of data being printed out must have broken its parser.

Dogfish answered 20/2, 2014 at 0:7 Comment(5)
I don't think we had any NSLog's in our tests to begin with, but am I understanding correctly that you were rerouting your NSLog outputs to a file? Or did you fix it by preventing it Xcode from doing that?Descriptive
Yeah I fixed the tests by removing the call to freopen(). One test in particular however was still giving 'test target did not finish', this was due to the log being spammed by printing out a couple of huge strings. The problem dissapeared once I removed the huge NSLog() output.Dogfish
I'm still not sure if the freopen was something you had added, or something that Xcode does by default. Could you clarify on that?Descriptive
ok, freopen() is a call I added in, it's not in there by default. it can be used to redirect your stderr to a file. My call looked like this: freopen([logPath fileSystemRepresentation],"a+",stderr)Dogfish
Interesting, hadn't seen that before. Also interesting that it also causes the tests to fail. It seems a number of things can cause it. I had it happen to me again today for the first time in months.Descriptive
G
0

Maybe a little late now, but this is what worked for us : Go to build settings and under code signing - Set Debug and Release to "Don't Code sign" if you do not have a valid developer certificate.

Grease answered 14/3, 2014 at 5:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.