Dmitry Kandalov
06/21/2018, 11:11 AMassertEquals()
works in main
but not sure how to run tests with CLion test runner (or gradle or cmake).thevery
06/21/2018, 11:12 AMDmitry Kandalov
06/21/2018, 11:24 AMCalculatorTest
runs on jvm, not native. And I’m trying to run tests in kotlin native without jvm (or multiplatform).thevery
06/21/2018, 11:50 AMthevery
06/21/2018, 11:51 AMgildor
06/21/2018, 11:57 AMsrc/test/kotlin
dir.
Also this config works with tests from common moduleDmitry Kandalov
07/06/2018, 10:38 AMthevery
07/06/2018, 11:40 AMthevery
07/09/2018, 5:56 AMKonstantin Petrukhnov
07/09/2018, 6:00 AMKonstantin Petrukhnov
07/09/2018, 6:01 AMthevery
07/09/2018, 6:59 AMKonstantin Petrukhnov
07/09/2018, 7:07 AMthevery
07/09/2018, 7:09 AMKonstantin Petrukhnov
07/09/2018, 7:09 AMnicola.de.fiorenze
07/09/2018, 8:07 AMtestCompile "org.jetbrains.kotlin:kotlin-test-common:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlin_version"
in the common module build.gradle file
After this, to run them,
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
into the build.gradle of the android module and
konanArtifacts {
//... STUFF ...
program('NativeTest') {
srcDir 'src/test/kotlin'
commonSourceSet 'test'
libraries {
artifact 'NativeLib'
}
extraOpts '-tr'
}
}
task test(dependsOn: 'compileKonanNativeTestIos_x64', type: Exec) {
def textExecutable = tasks["compileKonanNativeTestIos_x64"].artifactPath
commandLine("xcrun", "simctl", "spawn", "iPhone 8", textExecutable)
}
into the build.gradle of the iOS module.
To run the tests ./gradlew :kotlinLibrary:android:test
or ./gradlew :kotlinLibrary:ios:test
😉
Here the full description: https://github.com/defio/KotlinNativeExperiments#unit-tests-in-the-common-modulethevery
07/09/2018, 8:20 AMthevery
07/09/2018, 8:20 AMDmitry Kandalov
07/13/2018, 11:04 PM