I did not find a way to unit test an internal swift class that is inside a framework. It only works if I set the class scope to public. Is there a way around it ?
Here is what I have now:
In the framework:
class InternalClass {}
In the tests:
import XCTest
@testable import MyFramework
class InternalClassTests: XCTestCase {
let sut = InternalClass() //ERROR HERE Use of unresolved identifier 'InternalClass'
}
You can use the @testable
before your framework import in your unit test file like
@testable import MyFramework
which give you access to at least your internal
method and classes in your framework.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With