Welcome!¶
OpenSavvy Prepared helps declare isolated tests quickly with an expressive DSL, that can run on any Kotlin platform.
Let's take a sneak peek¶
The simplest test is declared as a simple function:
Tests can be organized into suites, which can be nested any number of times:
suite("My test suite") {
test("A first test") { /* … */ }
suite("A nested suite") {
test("A second test") { /* … */ }
test("A third test") { /* … */ }
}
}
Prepared's eponymous feature, prepared values, allow declaring coroutine-aware fixtures that are initialized once for each test they are mentioned in:
val database by prepared {
Database.connect()
}
test("Verify the connection") {
check(database().isConnected)
}
Additionally, Prepared exposes many other features:
- Shared test fixtures,
- Time control,
- Background task management¸
- Randomness control,
- Temporary filesystems,
- Easy test parametrization,
- Compatibility for Ktor, Arrow, Gradle…
- …and more.
Prepared isn't a test runner¶
The goal of Prepared is to simplify how we declare tests: how we go from a thought to code. Test runners are libraries that execute test batteries and report results to your build system. Prepared isn't a test runner, but it is compatible with a few existing ones.
Prepared isn't an assertion library¶
Assertion libraries provide utilities to compare values. Popular choices are Kotlin.test, Kotest Assertions, Strikt, AssertK, Atrium… just use the one you prefer!
Instead of any specific assertion libraries, we recommend using Power Assert, which is able to generate good error messages from regular Kotlin code, without needing an assertion library at all.
Prepared isn't an IntelliJ plugin¶
Prepared is a simple Kotlin library. It doesn't have a Gradle plugin, nor does it have an IntelliJ plugin.
If you use the TestBalloon runner, Prepared tests are supported by the TestBalloon IntelliJ plugin. Learn how to configure it.