Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 912 Bytes

File metadata and controls

51 lines (35 loc) · 912 Bytes

Native Image Testing (Gradle)

Contents

  • JUnit dependencies
  • Running native tests
  • Custom test suites

JUnit Dependencies

dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
    testImplementation 'junit:junit:4.13.2'
}

test {
    useJUnitPlatform()
}

Running Native Tests

./gradlew nativeTest

The output binary is located at: build/native/nativeTestCompile/<imageName>

Custom Test Suites

Register additional test binaries for integration tests or other test source sets:

graalvmNative {
    registerTestBinary("integTest") {
        usingSourceSet(sourceSets.integTest)
        forTestTask(tasks.named('integTest'))
    }
}

This creates two tasks:

  • nativeIntegTestCompile — builds the native test binary
  • nativeIntegTest — runs it