org.junit.runners.model.InvalidTestClassError
See original GitHub issueMy instrumented tests run just fine on a real devices and emulators. However, when running the tests on Firebase Test Lab I get the following error each time:
org.junit.runners.model.InvalidTestClassError: Invalid test class 'com.myapp.ui.MainInstrumentedTest':
1. No runnable methods
at org.junit.runners.ParentRunner.validate(ParentRunner.java:525)
at org.junit.runners.ParentRunner.<init>(ParentRunner.java:92)
at org.junit.runners.BlockJUnit4ClassRunner.<init>(BlockJUnit4ClassRunner.java:74)
at androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner.<init>(AndroidJUnit4ClassRunner.java:43)
at androidx.test.internal.runner.junit4.AndroidJUnit4Builder.runnerForClass(AndroidJUnit4Builder.java:65)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
at androidx.test.internal.runner.AndroidRunnerBuilder.runnerForClass(AndroidRunnerBuilder.java:153)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
at androidx.test.internal.runner.TestLoader.doCreateRunner(TestLoader.java:73)
at androidx.test.internal.runner.TestLoader.getRunnersFor(TestLoader.java:105)
at androidx.test.internal.runner.TestRequestBuilder.build(TestRequestBuilder.java:804)
at androidx.test.runner.AndroidJUnitRunner.buildRequest(AndroidJUnitRunner.java:575)
at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:393)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2209)
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
InvalidTestClassError (JUnit API)
org.junit.runners.model. Class InvalidTestClassError ... Thrown by Runner s in case the class under test is not valid. Its message conveniently lists all of...
Read more >Java Junit4 Supporting extended base class - Stack Overflow
Does it mean JUnit 4 does not support Test classes extending a base class? The idea behind this was to create a single...
Read more >org.junit.runners.model Class InvalidTestClassError - javadoc.io
Thrown by Runner s in case the class under test is not valid. Its message conveniently lists all of the validation errors. Since:...
Read more >org.junit.runners.model.InvalidTestClassError java code ...
Thrown by org.junit.runner.Runners in case the class under test is not valid. Its message conveniently lists all of the validation errors.
Read more >[groovy-user] JUnit4 and "No runnable methods"
(http://groovy.codehaus.org/Using+JUnit+4+with+Groovy) - "No runnable methods". I have imported org.junit. ... org.junit.internal.runners.MethodValidator.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve been recently in contact with the Firebase Support team and they suggested that I try running the tests on a Physical Device instead of a Virtual Device on FTL. Following are the results:
With coreLibraryDesugaringEnabled on, the tests failed.
With coreLibraryDesugaringEnabled off, the tests passed.
@mannodermaus as you suggested, it appears that, desugaring with instrumentation tests on FTL has been the cause of the issue.
I’ve also reported the same results to the Firebase Support team and will report back here of any outcomes.
Thanks a lot.
Both of you seem to execute the tests on API 29, whereas the default integration currently uses 28 - can you already tell I set this up a while ago? I’m wondering if it has something to do with the OS version. Would you mind re-running this on an API 28 device, please? I don’t have immediate resources to attend to this right away but it might be good to gather as much info as possible.
Also, @IAmDarush, that
NoSuchMethodError
seems to indicate you’re using core library desugaring, is that correct? It seems to look forj$.util.concurrent.ConcurrentHashMap
and failing. I vaguely remember reading somewhere that desugaring & instrumentation tests on FTL don’t work together very well, but I’m unable to find this resource again.