Execute with TestBalloon¶
Execute Prepared tests with the TestBalloon framework.
Configuration¶
Add the TestBalloon Gradle plugin and a dependency on this library:
plugins {
kotlin("multiplatform")
id("de.infix.testBalloon") version "VERSION" //(1)
}
kotlin {
// …
sourceSets.commonTest.dependencies {
implementation("dev.opensavvy.prepared:runner-testballoon:VERSION") //(2)
}
}
Usage¶
To declare a Prepared suite using the TestBalloon runner, simply declare a top-level variable initialized using the preparedSuite helper:
val MyTestSuite by preparedSuite {
test("Hello world!") {
assert(3 == 3)
}
suite("My suite") {
test("First") { /* … */ }
test("Second") { /* … */ }
}
}
If you are already using TestBalloon and want to use Prepared features within an existing suite, use the withPrepared helper:
val MyMixedTestSuite by testSuite {
// Here, we're using TestBalloon syntax
test("Foo") { /* … */ }
testSuite("Bar") { /* … */ }
withPrepared {
// Here, we're using Prepared syntax
test("Foo") { /* … */ }
suite("Bar") { /* … */ }
}
}
IntelliJ plugin¶
The TestBalloon IntelliJ plugin can be configured to recognize Prepared tests and suites.
Once you installed the plugin, open “jetbrains://idea/settings?name=Tools--TestBalloon“, open “Discovery settings”. In the field “Test discoverable annotations“, add opensavvy.prepared.suite.annotations.TestEntrypoint to the end, using a space character to separate it with existing values. Save your settings. You may need to reload your build.
You should see the typical green triangles in the margin of Prepared tests and suites, allowing to run or debug a single test.