https://kotlinlang.org logo
#kotest
Title
# kotest
g

Gilles Barbier

11/14/2023, 11:34 AM
Hi, I'm using Kotest and I'am happy with it. Now, I'd like to run my tests multiple times with different configurations. How can I do that without hard copying the tests? E.g. my tests typically look like this - any hints would be great!
Copy code
class Tests : StringSpec(
      {
        val client = // client definition from a resource file - I'd like to do the same tests with another resource file
 
        "my test" {
          ... test implementation using client
        }
g

Gilles Barbier

11/14/2023, 11:42 AM
oh - nice. Thx. I'll have a look
o

Oliver.O

11/14/2023, 12:29 PM
Don't overlook that you can always be explicit – using normal Kotlin, without learning another abstraction layer:
Copy code
class Tests : StringSpec(
    {
        for (client in listOf(def1, def2, ...) {
            "my test" {
                ... test implementation using client
            }
        }
    }
)
👀 1
🎉 1
2 Views