kotest / kotest

Powerful, elegant and flexible test framework for Kotlin with assertions, property testing and data driven tests.
https://kotest.io
Apache License 2.0
4.44k stars 647 forks source link

All tests fail when using the kotest-extensions-allure plugin #2320

Closed gmetal closed 3 years ago

gmetal commented 3 years ago

Using kotest version 4.6.0, and kotest-extensions-allure 1.0.0. I followed the instructions mentioned here. After running my test suite, all tests fail with the following error:

java.lang.NoSuchMethodError: 'void io.kotest.mpp.LoggerKt.log(java.lang.String)
    at io.kotest.extensions.allure.AllureWriter.startTestCase(AllureWriter.kt:54)
    at io.kotest.extensions.allure.AllureTestReporter.beforeTest(AllureTestListener.kt:20)
    at io.kotest.core.spec.LifecycleKt.invokeAllBeforeTestCallbacks(lifecycle.kt:76)
    at io.kotest.core.internal.TestCaseExecutor.executeActiveTest(TestCaseExecutor.kt:152)
    at io.kotest.core.internal.TestCaseExecutor.access$executeActiveTest(TestCaseExecutor.kt:57)
    at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1$1.invokeSuspend(TestCaseExecutor.kt:89)
    at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1$1.invoke(TestCaseExecutor.kt)
    at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1$1.invoke(TestCaseExecutor.kt)
    at io.kotest.core.internal.TestCaseExecutor.executeIfEnabled(TestCaseExecutor.kt:117)
    at io.kotest.core.internal.TestCaseExecutor.access$executeIfEnabled(TestCaseExecutor.kt:57)
    at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1.invokeSuspend(TestCaseExecutor.kt:89)
    at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1.invoke(TestCaseExecutor.kt)
    at io.kotest.core.internal.TestCaseExecutor$intercept$innerExecute$1.invoke(TestCaseExecutor.kt)
    at io.kotest.core.internal.TestCaseExecutor.intercept(TestCaseExecutor.kt:103)
    at io.kotest.core.internal.TestCaseExecutor.execute(TestCaseExecutor.kt:69)
... 

I believe that the plugin must be using a log method that has been removed from kotest. I managed to get my tests to run properly by adding a skeleton logger.kt file, in my test source set:

internal val isLoggingEnabled by lazy { false }

inline fun log(f: () -> String) { }

inline fun log(t: Throwable?, f: () -> String) { }

inline fun log(f:  String) { }
sksamuel commented 3 years ago

Yep good spot. I've released 1.0.1 which will work with any kotest version.