A showcase project demonstrating Kensa — BDD testing for Kotlin & Java — running on TestNG.
This is the TestNG counterpart of clearwave-example (JUnit 6). Same domain, same Given-When-Then DSL, same per-test tracking-id pattern, same auto-published Kensa report — only the test runner differs.
The domain is a fictional telecoms provider ("Clearwave") with two services under test:
-
FeasibilityService — checks whether a broadband service can be delivered to a given address
-
OrderService — places a broadband order and coordinates with external network and tracking systems
-
System View — auto-generated component diagram showing the relationships across all services exercised in tests. Available as a top-level page in the report sidebar.
Tests are written using the Kensa Given-When-Then DSL with http4k stubs standing in for downstream APIs. The HTML report generated from these tests is published as a live example at:
kensa-dev.github.io/clearwave-testng-example
./gradlew testRuns the http4k-driven FeasibilityServiceTest and OrderServiceTest (plus the field DSL example and the
two Java equivalents). The report is written to build/kensa-output.
To open the report:
kensa --dir build/kensa-outputThe Kensa lifecycle listener dev.kensa.testng.KensaTestNgListener is auto-discovered via ServiceLoader,
so the test classes only need to register the project's own listener:
@Listeners(ClearwaveTestNgListener::class)
@UseSetupStrategy(SetupStrategy.Grouped)
abstract class ClearwaveTest : KensaTest, WithKotestClearwaveTestNgListener is an ISuiteListener — stubs start in onStart(suite) and stop in onFinish(suite).
This project serves two roles:
- Showcase — a realistic example of Kensa tests on TestNG that visitors to kensa.dev can explore.
- Canary — run as part of Kensa's CI on every commit to master, building against the latest snapshot to catch regressions early.
| Library | Role |
|---|---|
| Kensa | BDD test framework |
| http4k | HTTP client & stub server |
| Kotest | Assertions (Kotlin) |
| Hamcrest | Assertions (Java) |
| TestNG | Test runner |