简体   繁体   中英

@testable import “projectName” isn't importing all files into test cases

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?

发现问题所在后,在框架中就有了要被调用的函数的类型别名,一旦我调用了这些类型别名而不是framework.functionName,它就可以正常工作。

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM