TestDslMarker

annotation class TestDslMarker

DSL marker annotation for Wow testing framework.

This annotation marks DSL (Domain Specific Language) interfaces and classes used in the Wow testing framework to provide type-safe, hierarchical test specifications. By applying this marker, the Kotlin compiler restricts implicit receiver access, preventing accidental method calls across different DSL levels.

Purpose

The @TestDslMarker marker ensures that:

  • Test DSLs maintain clear hierarchical boundaries

  • Child DSL contexts cannot accidentally call parent DSL methods

  • IDE provides accurate code completion and error highlighting

  • Test code remains readable and maintainable

Usage

Apply this annotation to all DSL interfaces in the testing framework:

@TestDslMarker
interface AggregateDsl<S : Any> {
fun on(block: GivenDsl<S>.() -> Unit)
}

@TestDslMarker
interface GivenDsl<S : Any> {
fun whenCommand(command: Any, block: ExpectDsl<S>.() -> Unit)
}

@TestDslMarker
interface ExpectDsl<S : Any> {
fun expectEvent(type: KClass<*>)
}

Benefits

  • Type Safety: Prevents calling methods from incorrect DSL contexts

  • Better IDE Support: Improved code completion and error detection

  • Cleaner APIs: Clear separation between different testing phases

  • Maintainability: Easier to understand and modify test DSLs

See also

for the underlying Kotlin compiler support

for aggregate testing DSL

for saga testing DSL