Skip to main content

API Overview

Kensa's public API is organised around a few core concepts. Start here, then dive into the reference pages below.

Core Concepts

ConceptWhat it does
ConfigurationGlobal setup — output directory, issue tracker URL, custom renderers, and more
FixturesType-safe, lazily-created test data shared across given, whenever, and then
Captured OutputsStore and retrieve values produced during the action under test
AnnotationsControl what appears in the HTML report — rendered values, notes, issues, and more

DSL at a Glance

All framework integrations expose the same DSL via KensaTest:

MethodContext typePurpose
given(action)Action<GivensContext>Set up fixtures and initial state
and(action)Action<GivensContext>Chain additional setup steps
whenever(action)Action<ActionContext>Exercise the system under test
then(collector, matcher)StateCollector<T>Assert on extracted state
then(collector) { block }StateCollector<T>Assert using a lambda block

Framework Integration

FrameworkArtifactRegistration
JUnit 5kensa-junitAutomatic via ServiceLoader
Kotestkensa-kotestManual — add KensaKotestListener in ProjectConfig
TestNGkensa-testngAutomatic via ServiceLoader

Assertion Library Mixins

Mix one or more interfaces alongside KensaTest to gain assertion methods:

InterfaceLibrary
WithKotestKotest matchers
WithAssertJAssertJ
WithHamcrestHamcrest (Java)
WithHamkrestHamKrest (Kotlin)