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?

shortstuffsushi
  • 2,271
  • 19
  • 33
  • maybe it is a bug in xcode5, maybe some user config that ignored by git was changed – Bryan Chen Sep 25 '13 at 00:02
  • 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... – shortstuffsushi Sep 25 '13 at 18:22
  • 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. – shortstuffsushi Oct 07 '13 at 16:11
  • I see it a few times - but I've just filed a radar and ignored it. – Abizern Oct 07 '13 at 16:29
  • Filing a radar -- that would have been a good idea. Thanks for the reminder. – shortstuffsushi Oct 07 '13 at 17:15
  • In my case, it happened while targeting an iOS simulator earlier than iOS 7. http://stackoverflow.com/a/18986278/239408. Could it be that you changed the scheme's destination? – xverges Jan 20 '14 at 10:05
  • 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. – shortstuffsushi Jan 20 '14 at 15:18
  • @Abizern What's your Radar # for this? And can you clone the bug's info to [openradar](http://openradar.appspot.com/page/1)? – cbowns Feb 07 '14 at 00:34
  • I filed it during beta so it's not on open radar. However, it's fixed in a soon to be released update – Abizern Feb 07 '14 at 09:12

6 Answers6

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.

shortstuffsushi
  • 2,271
  • 19
  • 33
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

Community
  • 1
  • 1
tracy
  • 384
  • 5
  • 8
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.

JP Hribovsek
  • 6,707
  • 2
  • 21
  • 26
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.

KoCMoHaBTa
  • 1,519
  • 15
  • 16
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.

Pellet
  • 2,254
  • 1
  • 28
  • 20
  • 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? – shortstuffsushi Feb 21 '14 at 00:33
  • 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. – Pellet Feb 21 '14 at 02:12
  • 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? – shortstuffsushi Feb 21 '14 at 17:51
  • ok, [freopen()](https://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man3/freopen.3.html) 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) – Pellet Feb 24 '14 at 01:58
  • 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. – shortstuffsushi Feb 24 '14 at 18:59
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.