[英]JUnit 5 testReporter Kotlin Android doesn't print anything in report
我正在嘗試在 JUnit5 中實現 testReporter,在 Android 項目中使用 Kotlin,但我在測試報告中沒有得到任何東西......
我的代碼是這樣的:
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)
}
}
我使用的依賴項是:
// 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")
但我總是得到這個......
如果您使用 Gradle 運行測試,那么這個問題可能是您感到沮喪的原因: https://github.com/gradle/gradle/issues/4605
更多游說來解決這個(據稱很簡單)問題可能會有所幫助,但也可能沒有。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.