Home > Software design >  JUnit 5 testReporter Kotlin Android doesn't print anything in report
JUnit 5 testReporter Kotlin Android doesn't print anything in report

Time:09-06

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

CodePudding user response:

If you‘re running your tests with Gradle, then this issue may be the reason for your frustration: https://github.com/gradle/gradle/issues/4605

More lobbying to resolve this (allegedly simple) issue might help, but it also might not.

  • Related