I've been troubleshooting this for a few days and am all out of ideas.
I was using unit testing in Xcode and it was working great. All of a sudden Xcode no longer recognizes my tests. If I go to the tests panel, it shows that I have zero tests. I actually have 13.
The ability to run individual tests or certain classes is now gone. It doesn't show the buttons in the gutter of the editor area.
I am still able to run all of my tests if I click the button to the right of the "0 Tests" in the test panel. When I click this it then starts populating all of my tests and they still appear to run properly. However, now that the tests are shown in the tests panel, they still are not linked to my tests in the classes. Usually if you click on a test, it will take you to it in the file where it lives. This functionality is gone.
I opened up another old project I had saved and it is having the same issue. However, I started a new project and it is working just fine and is showing no signs of any problems.
Any ideas as to what I may have done? I've found a few other threads out there about this on here, but none of them have gotten any helpful responses and are at least a number of months old. Hoping maybe creating a new thread will bump this again.
My next thought is to start the project over again and copy my files over. Not sure what else to do.
I had the same problem, and all my methods have the test prefix.
So, the problem seems to be with Xcode indexing, as some targets could see all tests and some could not. To create a fresh index follow these steps:
~/Library/Developer/Xcode/DerivedData/
rm -rf YourProjectDir
Done! When you open the project wait for reindexing and the tests should appear as usual.
All test method begin with "test":
func testValidateStudent()
{
// your code
}
make sure that your test methods begin with "test".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With