Klitos Kyriacou
07/20/2023, 10:24 AMwithData usage, but I've also seen people using forAll , table and row , for example at https://proandroiddev.com/data-driven-testing-with-kotlintest-a07ac60e70fc. Are the latter not recommended, perhaps superseded by withData ? Or is it that forAll etc are too new to be documented but may replace withData in the future?wasyl
07/20/2023, 11:53 AMforAll due to performance issues caused by reflectively determining parameters names https://github.com/kotest/kotest/blob/3646c5eee03e8807f6e3cd7415bf61ac49182ccd/kotest-assertions/kotest-assertions-shared/src/commonMain/kotlin/io/kotest/data/forAll2.kt#L6-L7wasyl
07/20/2023, 11:55 AMTable though? In any case, I don't know about Kotest guidelines, but at $work we just went with a listOf(OurCustomTestCaseDataClass).forEach { describe("description" { } }. It's not a lot more overhead to write, IDE support is faster (less generics compared to Row), and we can clearly name arguments in custom data class.Emil Kantis
07/21/2023, 7:05 PMwithData , but beware the slight but significant inconsistency regarding lifecycle hooks which currently exists (addressed by #3300) between tests created by withData vs a regular test.
I assumed that withData was intended do replace forAll (which clashes naming-wise with the prop.testing function, as well as the collection inspection), but I haven't seen any moves to deprecate forAll so not sure if it's actually planned.