Android Library seemingly can't filter Instrumented tests via @Tag
See original GitHub issueI’m trying to prototype a simple Hello World gradle android library project to get the @Tag
filtering working with some tests. After some amount of hunting around, I got this working with unit tests (though as an aside, https://github.com/mannodermaus/android-junit5/wiki/Migrating-from-1.0.x is a bit obscure and should probably be pulled into the main wiki pages, e.g. android.testOptions.junitPlatform.filters.tags.include
having been moved to <...>.filters.includeTags
was a pain point). Thus running e.g. ./gradlew clean test
is now successfully only running tests tagged with @Tag('sampleTag')
.
However, instrumentation tests are still all being run regardless of the filter, e.g. ./gradlew clean connectedAndroidTest
runs both tests regardless of the @Tag('sampleTag')
The following is my build.grade:
and my project is laid out with unit tests in src/test/java
and instrumentation tests in src/androidTest/java
. This is the current instrumentation test file I’m running:
Is this not currently supported, or am I missing some separate place where filters on instrumentation tests need to be defined, or a gradle dependency, etc?
Please and thanks for any help!
EDIT: Sorry Tom g, didn’t mean to tag you.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
I’ve seen this as well, but debugging the events sent to the
RunNotifier
, there are no superfluous messages sent to the build tool. As far as I know, this should be an IDE issue, unfortunately.Thanks again for providing the sample info! This should be helpful for others seeking to be at the forefront of this stuff as well.
There’s a couple of tweaks I’d like to apply to the new support (in terms of DSL) before submitting the final release. No hard promises, but I’m aiming for the end of this week ~ I’ll keep you posted!
Unfortunately not from the perspective of preventing these logs from being emitted. You could raise the log level of Logcat or apply a filter to the output, I suppose.
This has been released with Gradle Plugin
1.5.0.0
and android-test-runner1.1.0
. Note that you need to update both coordinates to make use of this, and also I’d like to reiterate that the filtering only works for@Tag
-based filters for now. Feel free to open a new issue if you run into any problems!