Xcode Test not detect my class

@testable import MyApp should work fine. Just remember to set appropriate configurations within Debug for your UITest target.

enter image description here


Xcode 7 adds the @testable import statement to simplify unit testing. At the top of your unit test class files, add the following statement:

@testable import MyApp

Where MyApp is the name of your iOS app. Now the unit test target should be able to find the classes in your app and run the tests. If you get link errors saying that Xcode cannot find your app classes, make sure the Product Module Name build setting's value matches the name you use in the @testable import statement, MyApp in this example.

If @testable import does not work for you, a workaround is to make your app classes members of the unit test target. You can set the target membership of a file in Xcode using the file inspector.


I also encountered this issue, what worked for me is reloading my test file and retyping the

@testable import FoodTracker

then at that point, it detected my FoodTracker classes (Meal class) and errors are gone.