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):

    named("androidHostTest") { // (1)!
        dependencies {
            implementation("de.infix.testBalloon:testBalloon-framework-core:$testBalloonVersion")
            implementation("junit:junit:$junit4Version")
        }
    }
    
    1. Using the com.android.kotlin.multiplatform.library plugin.
    named("androidDeviceTest") { // (1)!
        dependencies {
            implementation("de.infix.testBalloon:testBalloon-framework-core:$testBalloonVersion")
            implementation("androidx.test:runner:$androidxRunnerVersion")
        }
    }
    
    1. Using the com.android.kotlin.multiplatform.library plugin.
    dependencies {
        testImplementation("de.infix.testBalloon:testBalloon-framework-core:$testBalloonVersion")
        testImplementation("junit:junit:$junit4Version")
    }
    
    dependencies {
        androidTestImplementation("de.infix.testBalloon:testBalloon-framework-core:$testBalloonVersion")
        androidTestImplementation("androidx.test:runner:$androidxRunnerVersion")
    }
    

    Info

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

  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.