https://kotlinlang.org logo
#ios
Title
# ios
f

fcosta

01/23/2020, 4:42 PM
Hi! Any idea how can I run ios tests in my common module with cocoapoads from xcode?
b

basher

01/23/2020, 4:49 PM
Can you clarify more what you're trying to do?
f

fcosta

01/23/2020, 6:50 PM
Yes! I have a shared module that exports the native code through Cocoapods and this module is consumed by xcode. There are some tests there it can’t run with a simple Gradle task due to this integration.
I can’t run something like below in a simple command line
Copy code
./gradlew runiOStests
I will give a example
This task will fail because of cocoapods integration
I would like to know if there is a way to run them 🙂
b

basher

01/23/2020, 6:56 PM
I'm not sure you can expose tests to be run from an Xcode project. @kpgalligan?
k

kpgalligan

01/23/2020, 7:23 PM
Sort of. We’ve done it in the past. You can pass
-tr
to the kotlin native compiler, which will create the actual test runner: https://github.com/JetBrains/kotlin-native/blob/76e3ad7a5c4482e499fb200a45ad99cb78d00048/backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt#L25
Then you can call that test runner entry point from Xcode, or more specifically an XCtest
However, I haven’t set that up with the cocoapods plugin
f

fcosta

01/23/2020, 7:25 PM
i’m gonna try that!
k

kpgalligan

01/23/2020, 7:25 PM
Would need to dig for a while to find the test runner call, although the bigger job is doing be getting the test build to make an actual framework that you can use
f

fcosta

01/27/2020, 9:44 PM
Yeah, i decided to remove CocoaPods integration in order to have some tests running. Thanks!
2 Views