question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nested Test Names broken in in Kotest 5 (worked in Kotest 4)

See original GitHub issue

Which version of Kotest are you using 5.3.1

Nested test names are broken in Kotest 5+:

class `Level 0` : FreeSpec({
    "Level 1" - {
        "Level 2" - {
            "Level 3.1" {
            }
            "Level 3.2" {
                fail("")
            }
        }
    }
})

image

In Gradle it looks like this:
> Task :tests:test

Level 0 > Level 0 > Level 0 > Level 3.2 FAILED
    java.lang.AssertionError at KotestBroken.kt:10
        Caused by: java.lang.AssertionError at KotestBroken.kt:10

It does not matter which Testing Style (that supports nesting) I use. I would expect the test report to reflect the hierarchy, as it did in Kotest 4.6.3 (only “failed” (yellow) vs “error” (red) could have been more consistent): image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sksamuelcommented, Aug 29, 2022

We’re unlikely to add a workaround for a bug in gradle 6.x due to the age of that release and the number of junit bugs it contains.

0reactions
Kantiscommented, Nov 3, 2022

@stengvac please test with latest version of kotest and raise a new issue if the problem persists, since this turned out to relate to a gradle 6.x bug. Preferably along with a screenshot showing the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

For nested tests, the report uses an incomplete test name
I can confirm from #3068 that it's broken in Gradle 6 but works in Gradle 7 with otherwise similar dependencies (io.kotest:kotest-runner-junit5: ...
Read more >
Changelog
Duplicated test names no longer throw an automatic error, but now mangle the name. So two tests of name 'foo' will appear as...
Read more >
Nested Data Tests
Kotest's data testing is extremely flexible and allows to unlimited nesting of data test constructs.
Read more >
Testing Styles
Kotest offers 10 different styles of test layout. Some are inspired from other popular test frameworks to make you feel right at home....
Read more >
Data Test Names
Data Test Names. By default, the name of each test is simply the toString() on the input row. This typically works well for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found