"No such module" when using @testable in Xcode Unit tests

Suragch picture Suragch · Aug 14, 2015 · Viewed 85.4k times · Source

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 @testable import myModuleName line.

enter image description here

I tried

  • cleaning the project with Option Clean Build Folder
  • checking that "Enable Testability" (debug) was set to Yes in the Build Options
  • deleting the tests target and then re-adding the iOS Unit testing bundle

None of this worked for this project (but I have gotten testing to work in another project). Has anyone else had this problem and solved it?

Answer

Voda Ion picture Voda Ion · Sep 29, 2015

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