Are there any plans to include documentation on testing Kotlin Native libraries/programs? With Kotlin Native libraries/programs targeting linuxX64 for instance there is no documentation available that covers the following:
1. How to setup testing at the build level (via Gradle)
2. What types of testing are supported by Kotlin Native
3. Which testing libraries/frameworks are available that provide Kotlin Native support
4. Key issues/pitfalls to be aware of when testing a Kotlin Native library/program
5. Basic testing examples covering a Kotlin Native library/program
6. How to test concurrency (covering Workers/Coroutines) in a Kotlin Native library/program
👍 2
o
olonho
02/17/2020, 11:40 AM
testing documentation indeed needs to be improved, and we're working on that. At the moment please refer to existing kotlinx libraries (kotlinx.coroutines, ktor) and their testing infrastructure
👍 1
n
napperley
02/18/2020, 1:49 AM
Managed to get testing working for the linuxX64 target simple smile . Below is a project that shows how to do testing with a Kotlin Native library: https://gitlab.com/kotlin-metrics/kmetrics-core
napperley
02/18/2020, 1:55 AM
Turns out that doing testing for a Kotlin Native library targeting linuxX64 is reasonably straightforward. The most confusing part is the output generated by the test runner. Did have a situation where the kotlin.NotImplemented message would appear without any reason being included. In the end it was found that isInitialized isn't supported by Kotlin Native.
s
sean
02/18/2020, 3:20 AM
Have you got junit xml / reporting working via gitlab ci/cd? I've been digging into multi platform libs, and trying to get test output. Linux x64 had a junit xml option, but ddidn't seem to do anything
n
napperley
02/18/2020, 6:43 AM
Been using the allTests Gradle task which will provide a link to the Unit testing report (as part of the output to stdout) in HTML format, when one or more tests fail. It is a bit strange that the link isn't provided when all the tests pass, have to deliberately cause one of the tests to fail in order to get the link. Haven't tried using GitLab CI/CD for test automation.
napperley
02/18/2020, 6:49 AM
Using kotlin.test as the software testing library, which has Kotlin MPP support (including Kotlin Native). JUnit won't work with Kotlin MPP since it is JVM only.