Hi,
I'm pretty sure I messed up something in my configuration of my android app but I couldn't find out yet what the problem could be.
If I start a BehaviorSpec from my (jvm) tests (not android instrumentation tests) I get the following error:
org.junit.platform.launcher.core.DefaultLauncher handleThrowable
WARNUNG: TestEngine with ID 'kotlintest' failed to discover tests
java.lang.RuntimeException: Method isLoggable in android.util.Log not mocked. See http://g.co/androidstudio/not-mocked for details.
at android.util.Log.isLoggable(Log.java)
at org.slf4j.impl.AndroidLoggerAdapter.isLoggable(AndroidLoggerAdapter.java:543)
at org.slf4j.impl.AndroidLoggerAdapter.log(AndroidLoggerAdapter.java:537)
at org.slf4j.impl.AndroidLoggerAdapter.debug(AndroidLoggerAdapter.java:195)
at io.kotlintest.runner.junit5.KotlinTestEngine.discover(KotlinTestEngine.kt:45)
at io.kotlintest.runner.junit5.KotlinTestEngine.discover(KotlinTestEngine.kt:25)
at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:168)
at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:155)
at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:120)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:52)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
I'm using the latest version of kotlin test and have also configured it as I did in other projects (android libraries) before and there it works seamlessly. My config looks like this:
apply plugin: "de.mannodermaus.android-junit5"
android {
...
testOptions {
unitTests.all {
useJUnitPlatform()
}
}
}
dependencies {
// (Required) Writing and executing Unit Tests on the JUnit Platform
testImplementation "org.junit.jupiter:junit-jupiter-api:5.4.2"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.4.2"
// (Optional) If you need "Parameterized Tests"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.4.2"
// (Optional) If you also have JUnit 4-based tests
testImplementation "junit:junit:4.12"
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:5.4.2"
testImplementation 'io.kotlintest:kotlintest-runner-junit5:3.3.2'
}
Any idea where I could start looking at or how to debug it?
change the library implementation from junit5 to junit4.
testImplementation 'io.kotlintest:kotlintest-runner-junit4:3.3.2'
Yea, it seems that this solves the prbolem, thanks.
However, now I face another problem that the test is actually crashing somehow silently while setting up things but somehow makes the BehaviorSpec as not ran. I can actually attach a debugger to my BehabiorSpec and step throught it, but I havent fully figured out why and where it crashes. Any idea how to start?
Does it work with other specs, like FunSpec or WordSpec ?
On Mon, 1 Jul 2019 at 07:15, Hannes Dorfmann notifications@github.com
wrote:
Yea, it seems that this solves the prbolem, thanks.
However, now I face another problem that the test is actually crashing
somehow silently while setting up things but somehow makes the
BehaviorSpec as not ran. I can actually attach a debugger to my
BehabiorSpec and step throught it, but I havent fully figured out why and
where it crashes. Any idea how to start?—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/kotlintest/kotlintest/issues/856?email_source=notifications&email_token=AAFVSGVPEKARKBI3W7IOMFTP5HYMRA5CNFSM4H2TXP2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODY55Z7Q#issuecomment-507239678,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAFVSGWW5G4HBEZGZNDCTRDP5HYMRANCNFSM4H2TXP2A
.
Update it seems that the tests are actually executed (all kind of tests like BehaviorSpec, Funpec, WordSpec ...) but the result somehow doesn't get propagated properly. I.e. if a WordSpec has an assertion that fails, the whole test task in gradle still passes ... Have to look deeper into it but I guess it's not related to this project (kotlin-test) ...
Thanks for your help
I had the same problem and followed the advice to change to kotlintest-runner-junit4, but I also end up with unresolved tests Tests passed: 0 of 1 test.
Why should we change to junit4 anyway?
Jfyi I wasnt able to solve this issue yet.
Michał Klimczak notifications@github.com schrieb am Di., 23. Juli 2019,
15:14:
I had the same problem and followed the advice to change to
kotlintest-runner-junit4, but I also end up with unresolved tests Tests
passed: 0 of 1 test.
Why should we change to junit4 anyway?—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/kotlintest/kotlintest/issues/856?email_source=notifications&email_token=AAEOPLTCTVQ574ZNJYLX4I3QA372RA5CNFSM4H2TXP2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2TCEEA#issuecomment-514204176,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAEOPLXDVFIB3DVQGVOTI2DQA372RANCNFSM4H2TXP2A
.
Does anyone have a working configuration for android?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
Does anyone have a working configuration for android?