We have written two rich GUI applications using Kotlin and in-house web framework. So far we have managed without writing any unit-tests (thanks to the fact that Kotlin is such a great language), but they are sometimes greatly missed.
Is there anyone who knows a way to unit-test Kotlin code, without writing the tests in pure JS against Kotlin-generated JS?
For sure you can use Karma and kotlin’s built-in qunit support. Works well with Maven 1.0.x and gradle plugin 1.1 latest snapshots. Which one do you use?
Hi again! I’ve now finally started to test this out.
I’m now using Kotlin 1.0.6
I’ve created test code under src/test/kotlin and have karma setup files in src/test/karma, as in your kotlinx project.
The tests run, when I use maven, however when I try to compile the project through intelliJ, then the compiler does not recognise references to code in src/main/kotlin (production code) in the src/test/kotlin (test code).
Would you know what’s wrong? Known problem?
I also noticed that you’re kotlinx project does not compile in IntelliJ either (only using maven). Is that a known problem too? Or a setup problem on my side?
After struggling a lot with this (and not owning IntelliJ Ultimate Edition, so I can’t use test-runners like Karma), I finally gave up and made a very hacky solution: I now use a Junit5 dynamic test that calls qunit-cls on the compiled tests and parses it’s output: