The documentation for <data-driven-testing> fails ...
# kotest
The documentation for data-driven-testing fails to mention that
is only available in a container scope, so If a user tries to experiment using a
, they will be met with a compilation error and left puzzled, as it just happened to me ­čśä
Once we get to Kotest 6, StringSpec will be deprecated as FreeSpec will do it all.
StringSpec will stay as an alias to FreeSpec
Ok good to know. But I think the documentation problem will remain. Even using FreeSpec I can write this:
Copy code
class DataDrivenTest : FreeSpec({
    "parametric test" {
        withData(/*values*/) { ... ->
            // test code
now the class compiles but I get a runtime error:
Cannot add a root test after the spec has been instantiated:
which isn't very clear to be honest. Still, the docs fail to explain that you need to be inside a container scope to use withData(). And this applies to all the styles, that have both container and terminal scopes. Yes, the provided example shows that FunSpec's
is used, but I believe it may not be immediately evident for library users, especially when starting out, and it should be explained in the docs.
I'll clarify the docs when I have a chance
Thank you, just wanted to let you know, to benefit all library users. I love Kotest, thanks for your outstanding work!
Thank you ­čÖé