Search code examples
androidkotlinjunit5junit-jupiter

JUnit 5 testReporter Kotlin Android doesn't print anything in report


I'm trying to implement testReporter in JUnit5, using Kotlin in Android project, but i'm not getting anything in the test report...

my code is like that:

class TestReporterTest {
   
    @Test
    fun `Report Single Value`(testReporter: TestReporter) {
        testReporter.publishEntry("Testing my value")
    }
    
    @Test
    fun `Report Several value`(testReporter: TestReporter) {
        val myMap = hashMapOf<String, String>()
        myMap["name"] = "John"
        myMap["surName"] = "Doe"
        testReporter.publishEntry(myMap)
    }

}

the dependencies i use are these:

    // Aggregator dependency on JUnit api, engine, and params
    testImplementation("org.junit.jupiter:junit-jupiter:5.9.0")

    //Instrumented Tests
    // 4) Jupiter API & Test Runner, if you don't have it already
    androidTestImplementation("androidx.test:runner:1.4.0")
    androidTestImplementation("org.junit.jupiter:junit-jupiter-api:5.9.0")

    // 5) The instrumentation test companion libraries
    androidTestImplementation("de.mannodermaus.junit5:android-test-core:1.3.0")
    androidTestRuntimeOnly("de.mannodermaus.junit5:android-test-runner:1.3.0")

but I always get this...

enter image description here


Solution

  • I found a solution in the IntelliJ settings...

    just do it like this... since logging/reporting is an IntelliJ feature, it should run the rest not Gradle. now it works.

    enter image description here