Xcode no longer recognizes tests

I have been looking for this problem for several days and I have all the problems.

I used unit testing in Xcode and it worked great. Suddenly, Xcode no longer recognizes my tests. If I go to the test panel, it shows that I have zero tests. I actually have 13.

The ability to run individual tests or specific classes is now missing. It does not show buttons in the gutter area of ​​the editor.

I can still run all my tests if I click the button to the right of "0 tests" on the test panel. When I click on it, it starts to fill in all my tests, and they still work fine. However, now that the tests are displayed in the test panel, they are still not related to my tests in the classes. Usually, if you click on the test, it will lead you to it in the file in which it lives. This functionality is missing.

I opened another old project that I saved, and it has the same problem. However, I started a new project and it works great and does not show any problems.

Any ideas on what I could do? Here I found several other topics, but none of them received useful answers, and at least a few months ago. In the hope that creating a new thread will cause this again.

My next thought is to run the project again and copy my files. Not sure what else to do.

+5
source share
1 answer

I had the same problem and all my methods have a test prefix.

So the problem seems to be related to Xcode indexing, as some targets can see all tests, and some can't. To create a new index, follow these steps:

  • Quit Xcode
  • Go to ~/Library/Developer/Xcode/DerivedData/
  • Delete this folder. You can use rm -rf YourProjectDir

Done! When you open the project, wait until it is re-indexed and the tests should appear as usual.

+6
source

Source: https://habr.com/ru/post/1208717/


All Articles