orchestr7/ktoml

Switch the testing framework to Kotest?

Open

#123 opened on Mar 14, 2022

View on GitHub
 (6 comments) (3 reactions) (0 assignees)Kotlin (34 forks)auto 404
enhancementgood first issuehuge task

Repository metrics

Stars
 (561 stars)
PR merge metrics
 (PR metrics pending)

Description

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?

Contributor guide