Skip to content

GitLab CI Kotlin DSLopensavvy.gitlab.ciArtifactsjunit

junit

fun junit(path: String)

Collects JUnit test reports to display test results in GitLab's UI.

The JUnit report provides detailed information about test execution, including passed, failed, and skipped tests. GitLab displays this information in merge requests and pipeline views.

Example

val test by job {
    script {
        shell("./gradlew test")
    }

    artifacts {
        junit("build/test-results/test/TEST-*.xml")
    }
}

Example: Maven project

val test by job {
    script {
        shell("mvn test")
    }

    artifacts {
        junit("target/surefire-reports/TEST-*.xml")
    }
}

External resources