Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch the testing framework to Kotest? #123

Open
NightEule5 opened this issue Mar 14, 2022 · 6 comments · May be fixed by #243
Open

Switch the testing framework to Kotest? #123

NightEule5 opened this issue Mar 14, 2022 · 6 comments · May be fixed by #243
Labels
enhancement New feature or request good first issue Good for newcomers huge task
Milestone

Comments

@NightEule5
Copy link
Collaborator

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?

@akuleshov7
Copy link
Owner

akuleshov7 commented Mar 15, 2022

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... :(

@akuleshov7
Copy link
Owner

@bishiboosh @petertrr what do you think about kotest?

@akuleshov7 akuleshov7 added enhancement New feature or request good first issue Good for newcomers huge task labels Mar 15, 2022
@akuleshov7 akuleshov7 modified the milestones: 0.2.12, 0.2.13 Mar 15, 2022
@sksamuel
Copy link

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
Copy link
Collaborator Author

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

As do I. It's great

@NightEule5
Copy link
Collaborator Author

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
Copy link

@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.

@ILikeYourHat ILikeYourHat linked a pull request Oct 18, 2023 that will close this issue
@nulls nulls linked a pull request Oct 19, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers huge task
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants