-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
org.junit.runners.model.InvalidTestClassError starting with Android Studio Dolphin | 2021.3.1 #284
Comments
I have same problem,, it was totally fine with previous version, but it seems broken at newer version of android studio. |
@mannodermaus Any thoughts on this one? It will start to fallback even further as more Android Studio releases go out + now we are restricted to using "com.android.tools.build:gradle:7.2.0" due to the older Android Studio version (2021.2.1.14). |
I can reproduce the problem on my end as well, but only if "Run Android Instrumented Tests using Gradle" is unchecked, as outlined in the original post. I'm wondering, why would you turn this off? Do other libraries or tests not work with the setting enabled? Some more context on this: Basically, the setting must be enabled so that the JUnit 5 bridge for Android tests can register its custom Historically, it has not been possible to inject arguments into the test instrumentation runner from within a Gradle plugin - that's why the README still forces users to add the |
Instrumentation tests were running just fine without that checkbox being check and before the latest Android Studio (Dolphin edition) got released. Why is there a sudden need to turn it on? And yes, we need to turn it off on our project due to the following error that is always happening when the checkbox is checked (--stacktrace option):
|
As well as this errors (with that option checked) using --scan option:
|
Instrumentation tests are sent to a physical device, Google Pixel 3 XL running Android 12. |
It would be good to know what the reason for the process crash is in that first trace you posted. I wonder if it's related to this plugin. Do you also get the same outcome if you remove JUnit 5 from the project and do check the "Run Tests With Gradle" checkbox? If so, it might be unrelated to the presence of JUnit 5 and should be investigated in isolation. As for "Why is there a sudden need to turn it on?", I cannot say how the internals of Android Studio releases change across versions as I am not part of the Android Studio team. I do know that recent versions of the Android Gradle Plugin have made advancements towards the behavioral alignment and predictability of instrumentation tests, and any of those could have had an impact here. Personally, I have never touched that checkbox either and it's been checked ever since, without any problems. |
I have tried to get more details from the runs but I haven't been able to pull more data out of the instrumentation runs. Yeah I was curious to find out if there's something that your plugin might be leaning on something specific from Android Studio and that's why it needs to have that checkbox turned on now or in general and it was a "fluke" until the latest version that it worked without it checked. |
With previous version Android Studio 2021.2.1.14 it works fine, with the latest stable one every single time I try to run a local instrumented test class it throws the following exception:
Tested also with beta & canary and got the same result.
Android Studio -> Preferences -> Build, Execution, Deployment -> Testing -> Run Android Instrumented Tests using Gradle is UNCHECKED
Jupiter 5.9.0
de.mannodermaus.junit5:android-test-core:1.3.0
de.mannodermaus.junit5:android-test-runner:1.3.0
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.8.2.1")
The text was updated successfully, but these errors were encountered: