First steps

  1. Add the TestBalloon Gradle plugin to your build script:

    plugins {
        id("de.infix.testBalloon") version "$testBalloonVersion"
    }
    
  2. Add a dependency for the TestBalloon framework core library:

    commonTest {
        dependencies {
            implementation("de.infix.testBalloon:testBalloon-framework-core:$testBalloonVersion")
        }
    }
    
    dependencies {
        implementation("de.infix.testBalloon:testBalloon-framework-core:$testBalloonVersion")
    }
    

    Info

    The repository contains a Multiplatform configuration example.

  3. Add extra dependencies for Android (optional):

    androidUnitTest {
        dependencies {
            implementation("de.infix.testBalloon:testBalloon-framework-core-jvm:$testBalloonVersion")
        }
    }
    
    androidInstrumentedTest {
        dependencies {
            implementation("androidx.test:runner:$androidxRunnerVersion")
            implementation("de.infix.testBalloon:testBalloon-framework-core:$testBalloonVersion")
        }
    }
    
    dependencies {
        testImplementation("de.infix.testBalloon:testBalloon-framework-core-jvm:$testBalloonVersion")
    }
    
    dependencies {
        androidTestImplementation("androidx.test:runner:$androidxRunnerVersion")
        androidTestImplementation("de.infix.testBalloon:testBalloon-framework-core:$testBalloonVersion")
    }
    

    Info

    The repository contains configuration examples for Android, Multiplatform with Android and Multiplatform library with Android.

    Note

    Google is deprecating the com.android.application plugin in favor of com.android.kotlin.multiplatform.library. Android-KMP integration is currently a moving target and there are multiple issues, so please test if it meets your needs.

  4. Add a dependency for the assertions library of your choice:

    implementation(kotlin("test"))
    
    implementation("de.infix.testBalloon:testBalloon-integration-kotest-assertions:$testBalloonVersion")
    
  5. Write a test:

    val MyFirstTestSuite by testSuite {
        test("string length") {
            assertEquals(8, "Test me!".length)
        }
    }
    
  6. Run tests via the familiar Gradle test tasks.

  7. Install the TestBalloon plugin for IntelliJ IDEA from the JetBrains Marketplace to run individual tests or test suites via the editor’s gutter icons.