Marc Reichelt
11/07/2022, 9:05 AMJohann Pardanaud
11/07/2022, 10:25 AMMarc Reichelt
11/07/2022, 10:34 AMJohann Pardanaud
11/07/2022, 10:57 AMvanniktech
11/07/2022, 11:00 AM./gradlew iosSimulatorArm64Test
is what I'm doing although its not perfect. Does not work with CC / sqldelightMarc Reichelt
11/07/2022, 2:14 PMjw
11/07/2022, 2:30 PMMarc Reichelt
11/07/2022, 2:47 PMjw
11/07/2022, 2:51 PMMarc Reichelt
11/07/2022, 3:01 PM./gradlew linkDebugTestIosArm64
, and it actually compiles a test.kexe
binary:
$ file build/bin/iosArm64/debugTest/test.kexe
build/bin/iosArm64/debugTest/test.kexe: Mach-O 64-bit executable arm64
Marc Reichelt
11/07/2022, 3:38 PMxcrun
or xcodebuild
Darron Schall
11/07/2022, 4:34 PMiosApp
. Write a test in the iOS application that exercises the shared library code, and launch via Xcode targeting a connected device.
The shared
library only supports running iOS tests via simctl
- https://github.com/JetBrains/kotlin/blob/8c2b2eb27816dcae23f284c02bd446a139f06a2c/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/gradle/targets/native/tasks/KotlinNativeTest.kt#L256 - which is not capable of launching on a connected device.
Conceptually, the shared
tests are unit tests in a KMM project. Neither the Android nor iOS targets are configured to run on real devices. The Android tests run on the JVM, and the iOS tests run on the simulator. To run Android tests on a device, there is androidAndroidTest
, but AFAIK there is no ready iOS equivalent. See https://touchlab.co/understanding-and-configuring-your-kmm-test-suite/ for further details.
If you do manage to figure out how to run the shared test binary on a non-jailbroken device, I'd be curious what the command was. I've been toying locally, but can't get xcodebuild
to create an archive of the test binary that I can sign/install on my device:
xcodebuild -exportArchive -archivePath ./shared/build/bin/iosArm64/debugTest -exportOptionsPlist ./shared/build/bin/iosArm64/debugTest/test.kexe.dSYM/Contents/Info.plist
error: archive at path '/Users/darron/Development/example-kmm/shared/build/bin/iosArm64/debugTest' is malformed