1
votes

It appears the "@testable import" isn't importing all the files in the original project. An outside framework's files were added to the original project as individual files and none of them seem to be accessible for the test cases unless the "target membership" is checked for unit tests. It's strange because other functions in the unit tests that use these framework's files can be tested but the framework's files themselves can't be tested directly. I thought it might be related to this:

no-such-module-when-using-testable-in-xcode-unit-tests

but I tried the solutions to that answer (enable testability, etc. ) but I still can't access the files to test unless I check the target membership box explicitly. Any idea on how to get the @testable import to include these files?

2
JD did you find any solution for this?Venu Gopal Tewari
Yes, check out the answer.SwiftyJD
can you elaborate little bit more that answer? my issue is Project classes are not available in Test Cases even after using @testable import.Venu Gopal Tewari
Did you at them to the test targets?SwiftyJD
i dont want to add them in Test Targets thats why i am using @testable import statement.Venu Gopal Tewari

2 Answers

0
votes

Found out what the issue was, there were type aliases for the functions to be called in framework, once I called those type aliases instead of the framework.functionName it worked fine.

0
votes

If you're using cocoapods make sure to add your the pods needed for tests to your Test target in your podfile.

target "AppTests" do
  pod 'Pod', '~> 1.0'
end