This question is similar to: XCode run all the tests (even the disabled ones)
But different in that I'm not disabling any tests. I'm just pressing the single test icon next to a test function or test case:
A friend of mine is running KIF in a Swift project just like I am and has no problem with this. I'm guessing it's something to do with my setup:
I have a main xcworkspace
file that contains my main target, a unit tests target, and an automated tests target (which contains the KIF tests). The workspace also has the pods project, using frameworks. That's it. Here's my scheme setup:
I've experienced this issue in all released versions of Xcode 6.
I found a workaround for the time being.
You have to modify each of your test classes (white space changes are fine). This will trigger Xcode to index those files and to recognize the tests and test cases and generate symbols & icons for them in the test navigator. (It's recommended to delete derived data first to remove any "ghost tests".)
If you don't do this for each test case class, all the unrecognized test case classes will always run, even if you only select one test to run.
Once you force Xcode to recognize all the test classes, you can successfully run a single test. (or a single test case, if you choose that instead.)
I also noticed while trying to fix this issue that the symbols and indexing for the default UnitTests
target works fine. So there's something wrong with either a) having a second test target or b) my second test target meta info is corrupt or c) I set my second test target up incorrectly.
The test icon next to the class is not for a single test.
Unlike the method test icon (which only tests itself), the class test icon runs all the tests in the test class.
Delete your project's Derived Data. You can do this by closing the project, opening Window->Projects, then selecting your project. Click the Delete button to the right of the Derived Data path.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.