I am working with Unit Testing in Xcode using XCTest provided by Xcode in objective C. I know how to import Module in Swift like below.
@testable import AppName
Whats the alternative in objective C.
I am working with Unit Testing in Xcode using XCTest provided by Xcode in objective C. I know how to import Module in Swift like below.
@testable import AppName
Whats the alternative in objective C.
@testable
overrides access rights in Swift, allowing you to test internal
methods in unit tests.
Objective-C has no such access modifiers, therefore you don't need @testable
and you just import the module normally.
If you need to unit test internal Swift methods, you will have to write your tests in Swift.
Note: @testable provides access only for “internal” functions; “private” declarations are not visible outside of their file even when using @testable.
–
Rankle In Objective C you can simply #import
them, as there are no such "internal" method access limitations as in Swift.
Also, On Xcode 6 your main target should be already linked to the test target. If not, try to check the "Allow testing Host Application APIs" checkbox inside Your Test Target > General > Testing. Take a look at this question for more information.
© 2022 - 2024 — McMap. All rights reserved.
#import
them? Or do you want to access private methods of Objective C? – Gapeworm