I've created a branch with a new DSL for specs whi...
# kotlintest-devs
s
I've created a branch with a new DSL for specs which allow us to configure a spec by invoking functions rather than overriding functions. This is the current style from https://github.com/kotlintest/kotlintest/blob/feature/spec-dsl/kotlintest-tests/kotlintest-tests-core/src/jvmTest/kotlin/com/sksamuel/kotlintest/specs/funspec/FunSpecExample.kt
Copy code
class FunSpecExample : FunSpec() {

   private val linuxTag = Tag("linux")
   private val jvmTag = Tag("JVM")

   override fun tags(): Set<Tag> = setOf(jvmTag, linuxTag)

   override fun beforeTest(testCase: TestCase) {
      println("Starting test ${testCase.description}")
   }

   override fun beforeSpec(spec: Spec) {
      println("Starting spec ${spec.description()}")
   }

   override fun afterSpec(spec: Spec) {
      println("Completed spec ${spec.description()}")
   }

   override fun afterTest(testCase: TestCase, result: TestResult) {
      println("Test ${testCase.description} completed with result $result")
   }

   override fun isolationMode(): IsolationMode? = IsolationMode.InstancePerLeaf

   override fun listeners(): List<TestListener> =
      listOf(LocaleTestListener(Locale.CANADA_FRENCH), TimeZoneTestListener(TimeZone.getTimeZone("GMT")))

   override fun testCaseOrder(): TestCaseOrder? = TestCaseOrder.Random

   init {
      test("this is a test") {
         // test here
      }
      test("this test has config").config(invocations = 1, enabled = true) {
         // test here
      }
   }
}