6

I ran into an issue with Xcode 6.1.1 not detecting a unit test file. I ran the scheme it was associated with and the file was found at runtime and ended up with an 'rT' icon next to it in the unit test navigator. That led me to this question but none of the answers are working for me. No amount of deleting my derived data or restarting Xcode is helping. The only thing that came close to working was deleting my derived data folder while Xcode was running -- when it reindexed it discovered all of the test files in one of my three schemes.

All these tests had been detected in the past -- I think this all broke during reindexing.

Has anyone seen this and found a solution? I would like my tests to be detected before runtime so I can easily run them individually.

Community
  • 1
  • 1
Ben Flynn
  • 18,524
  • 20
  • 97
  • 142
  • Repeatedly deleting the derived data method while Xcode is running has helped. Does not seem like a dependable solution... – Ben Flynn Dec 17 '14 at 17:18

3 Answers3

11

I've run into this too but deleting the Derived Data worked for me:

  1. Close Xcode
  2. Terminal: cd ~/Library/Developer/Xcode/DerivedData/
  3. Terminal: rm -Rf *
  4. Open Xcode and wait for it to re-index the project.

However, you've stated this isn't completely working for you. Perhaps you should also try deleting the Xcode cache directory?

  1. Close Xcode
  2. Terminal: cd ~/Library/Caches/com.apple.dt.Xcode/
  3. Terminal: rm -Rf *
  4. Open Xcode and wait for it to re-index the project.
Adam Zielinski
  • 401
  • 3
  • 8
1

This happened to me on Xcode 7.2 too. I performed the following steps to fix the issue:

  1. I deleted the Derived Data by selecting Window -> Project -> clicking the arrow next to the Derived Data path and deleting all files in the folder.
  2. Quit and relaunched Xcode.

It took some time to index the files and then all the tests appeared under Test navigator.

techraf
  • 64,883
  • 27
  • 193
  • 198
sheona h
  • 31
  • 5
0

I also have the same issue in 6.1.1.

A workaround that I found is to create a new test target. When a test case disappears, select it in the navigator and move it out of the original test target, into the new one, and then back again (possibly with a pause before moving it back - not sure if this is really necessary though). Does not always work but often seems to trigger XCode into remembering the test case - if it fails first time a repeat usually does it.

I will give deleting derived data a go too - note that this can be done from within Xcode (Window / Organiser / Projects - press Delete next to derived data) - may be quicker but a restart may still be necessary - needs some more experimentation.

Ali

Ali Beadle
  • 4,486
  • 3
  • 30
  • 55
  • Simpler even, deselect the test target in the right panel for the problematic file, wait a few seconds, then select it again. Only thing that worked for me, no need to delete the hell of out folders or restarting XCode. – aledalgrande May 20 '15 at 17:45
  • @aledalgrande Actually not seen this problem in a long while - Xcode 6.3.2 has improved things a lot. – Ali Beadle May 20 '15 at 18:57
  • I was in this thread because I had this problem today, with XCode 6.3.2 :) – aledalgrande May 20 '15 at 19:05
  • @aledalgrande Ah, Inconsistent bugs - my favourite ;) – Ali Beadle May 21 '15 at 18:16