I recently updated to Xcode 7 beta 5. I tried adding a unit test to an earlier project, but I am getting the error message \"No such module [myModuleName]\" on the @te
Make sure under the test scheme's build setting, the test target is in the list.
Beside the play button, select the test scheme, then Edit scheme..., go to the Build section, click plus + and select the target you want to test against.
In my case, we have an internal target that we develop with (a few minor differences) and after a merge, it was removed from the test config.
My issue was that the class i wanted to test was supposed to be in a separate module (API Client), but the class was actually a member of the app target and not the framework target. Changing the target membership of the class made the import error go away!
XCode 12 Development Beta 3
The error fixed itself after I've built the project for the first time.
As described in this answer I was adding Swift tests to an Obj-C only project. The solution was to add a dummy Swift class, after which Xcode would prompt to add a bridging header, then removing the Swift class. All was fine after that.
Please check your Module Name that you try to import with @testable import "ModuleName"
. The module name should be the same on Target->Build Settings-> Product Module Name
I addition to the other things listed, I had to add the file with the class I was trying to test to my compile sources for the unit test module