orchestr7 / ktoml

Kotlin Multiplatform parser and compile-time serializer/deserializer for TOML format (Native, JS, JVM) based on KxS
https://akuleshov7.github.io/ktoml
MIT License
443 stars 23 forks source link

Switch the testing framework to Kotest? #123

Open NightEule5 opened 2 years ago

NightEule5 commented 2 years ago

Currently kotlin.test is used for testing. Have you considered Kotest instead? Like Kotlin's test framework, it's built on JUnit on the JVM, but tests are written in a more idiomatic way. There's also an IntelliJ plugin that can display the tests being run in real time, rather than producing a report at the end.

Here's an example of one style it provides:

object ExampleTest : StringSpec({
    "Test string length should be 11" {
        test().shouldHaveLength(11)
    }
})

// ...

fun test() = "test string"

This is, in my opinion, way easier to read than:

class ExampleTest {
    @Test
    fun testStringLength() {
        assertEquals(
            test().length,
            11
        )
    }
}

// ...

fun test() = "test string"

Transitioning would take some effort, but I think it's worth considering. Thoughts?

orchestr7 commented 2 years ago

Good idea, we can try it. But actually you should know, that several people in JetBrains do not like this framework :) Everyone is familiar with Junit wrappers and do not want to try something new. But we can try it.

Unfortunately I am busy right now with the support for Custom deserialisers and Inline (VALUE) classes, so won't be able to make it in the nearest future... :(

orchestr7 commented 2 years ago

@bishiboosh @petertrr what do you think about kotest?

sksamuel commented 2 years ago

Good idea, we can try it. But actually you should know, that several people in JetBrains do not like this framework :)

@akuleshov7 I would be interested to know why some people in Jetbrains do not like the framework? :)

NightEule5 commented 2 years ago

I would be interested to know why some people in Jetbrains do not like the framework? :)

As do I. It's great

NightEule5 commented 2 years ago

Unfortunately I am busy right now with the support for Custom deserialisers and Inline (VALUE) classes, so won't be able to make it in the nearest future... :(

Understandable :)

petertrr commented 2 years ago

@bishiboosh @petertrr what do you think about kotest?

I haven't tried kotest myself just yet, but I've read about it. Indeed, API looks nice and more kotlin-idiomatic. I was a little bit concerned about multiplatform support and IDE support, though.

As they say in kotest docs, IDE support for multiplafrom is limited and tests can't be run from IDE directly (though, it usualy doesn't work with kotlin.test too :| ).

I think it's worth a shot, and their library for property-based testing can be useful for testing ktoml, where there are a lot of similar test scenarios for different input data.