Skip to main content

// Acceptance testing for Kotlin and Java

Output for everyone who didn’t write the test.

Given, When, Then in the test. Nothing else to keep in sync. The report is generated from the test that ran, with real values, every message between services, and an interactive sequence diagram.

Apache 2.0 · Kotlin 2.x · Java 17+ · JUnit 5 / 6 · Kotest · TestNG
In production acceptance tests at a large UK telco.

The FeasibilityServiceTest method 'address is serviceable by both suppliers' in the Kensa report: a sequence diagram between Customer, FeasibilityService, OpenNetwork and FibreVision, then the Given, When, Then sentences with their values

// See it in action

Write this. Get this.

A real test from the Clearwave example, in Kotlin or Java, and the report it produced, embedded live from the latest run. The method names become the words; the values come from the run.

No .feature files. No step definitions. No glue to keep in sync. The test is the spec. The report is the evidence.

OrderServiceTest.kt
@Test
fun `voice and broadband order is successfully completed`() {
given(openNetworkWillCompleteTheOrder())
and(fibreVisionWillCompleteTheOrder())

whenever(aVoiceAndBroadbandOrderIsPlaced())

then(theOrderConfirmation(), shouldBePending())
thenEventuallyAllNotifications(
shouldShowBothSuppliersCompletedSuccessfully(
voiceSupplier = fixtures[voiceSupplier],
broadbandSupplier = fixtures[broadbandSupplier],
)
)
}
The OrderServiceTest method 'voice and broadband order is successfully completed' in the Kensa report: a sequence diagram between Customer, OrderService, OpenNetwork and FibreVision, then the Given, When, Then sentences with the supplier values

// Install

Two blocks in the build file.

The dependencies alone give you the sentences, every captured message and the sequence diagram. The Gradle plugin adds the Kotlin compiler plugin behind @RenderedValue and @ExpandableSentence, and site mode across sourcesets. A Java project needs only the dependencies.

build.gradle.kts
plugins {
id("dev.kensa.gradle-plugin") version "0.9.18"
}

dependencies {
testImplementation(platform("dev.kensa:kensa-bom:0.9.5"))
testImplementation("dev.kensa:kensa-framework-junit6")
testImplementation("dev.kensa:kensa-assertions-kotest")
}

// Who it is for

One report, three readers.

For the people who can’t read the code

Testers, analysts and product owners get a report that says what the system did: Given–When–Then sentences with this run’s real values, every message that crossed between services, and a sequence diagram drawn from them. Open any interaction and read the payload.

For the developer writing it

Ordinary Kotlin or Java on JUnit 5 & 6, Kotest or TestNG, with the assertions you already use. No feature files, no step definitions, nothing to keep in sync. Refactor and the report follows, because the report is generated from the test that ran.

For the system you actually ship

Built for acceptance tests that sit outside a deployed application. Push a message in, watch what comes out, and let the report show the traffic. Link each test to its ticket with @Issue and the specification, the test and the evidence are one thing.

// Embed

Put the report where the decision is made.

Any test, at a stable URL. Drop it into a Confluence page, a Jira story, a design doc or a service catalog. The page shows what the system did, and it stays current with every run.

Embedding a report →
Acceptance criteria·CW-214 Voice and broadband bundle

When a customer places a combined order, both suppliers must confirm before the order is marked complete.

voice and broadband order is successfully completed
Givenopen network will complete the order
Whena voice and broadband order is placed
Theneventually all notifications should show both suppliers completed successfully
kensa · OrderServiceTest · latest runpassed

Plugins & Integrations

Surface Kensa output where your team already works. The report is static HTML, so any CI can publish it; these go further.

IntelliJ Plugin

Open reports from your IDE

Open any Kensa test report in your browser directly from IntelliJ IDEA.

  • Gutter icons on test functions
  • Links in test console output
  • Test toolbar actions
TeamCity Plugin

Reports inside your CI

Embed Kensa reports, GWT test names, and failure narratives directly in TeamCity builds.

  • Kensa Report tab on every build
  • Given-When-Then test display names
  • Failure summaries with captured state
Gradle & Maven

Reports from your build

Site mode aggregates every module’s reports into one browsable site, published from CI.

  • One site across subprojects
  • Run markers and live counts
  • Gradle Plugin Portal and Maven Central