I’m trying to run my test with Xcode generating a ...
# kotlin-native
f
I’m trying to run my test with Xcode generating a test framework. I’m using cocoapods. Is the configuration below correct? I can’t find any framework with name test in my build folder 😞
Copy code
kotlin {
    targets {
        final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") ? presets.iosArm64 : presets.iosX64

        fromPreset(iOSTarget, 'ios') {
            binaries {
                framework('client')
                framework('test') {
                    compilation = compilations.test
                    linkerOpts += ['-framework', 'UIKit']
                }
            }
        }
    }
    cocoapods {
        // Configure fields required by CocoaPods.
        summary = "chat-client"
        homepage = "<https://github.com/felipehjcosta>"

        pod('SocketRocket', '0.5.1')
        pod('OHHTTPStubs')
    }
}
l
Do you use a CocoaPods dependency from XCode to use it? Using the CocoaPods makes it build and import framework automatically without having you to do it (it also removes the ability to do so manually).
f
Besides that, is it possible to use a dependency from Cocoapods in tests only?
I think I figured out 2 ways to integrate KN unit tests with xcode and cocoapods. In the first one, I created an podspec which calls the
iosTest
task imported into test target in my
Podfile
which is on master branch of my project: https://github.com/felipehjcosta/chat-app The other way was generating a test framework, importing this framework with Cocoapods into Xcode and calling the tests in my Swift class. Unfortunately, the tests fail to run 😞 I created a branch for this case here: https://github.com/felipehjcosta/chat-app/tree/runiOSTestWithXcode How do you guys run your uni tests?