Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Using filters with fork? #128

Open
zsperske opened this issue Sep 22, 2017 · 2 comments
Open

Using filters with fork? #128

zsperske opened this issue Sep 22, 2017 · 2 comments
Milestone

Comments

@zsperske
Copy link

Do filters work with fork? I was trying...

./gradlew --stacktrace --offline :main:Foo:forkProdDebugAndroidTest -Dfork.computed.sw=all=0 -Pis_visual_run -Dfork.test.size=large -Dfilter=com.foo.TestFilterer $@
@iordanis
Copy link
Member

iordanis commented Jan 2, 2018

Hi,

Could you provide any insights as to how this would work? I remember there used to be a way of passing annotation to the test runner to filter but I can no longer find it in: https://developer.android.com/studio/test/command-line.html

@iordanis
Copy link
Member

iordanis commented Jan 3, 2018

With a bit of digging, it turns out that this is something that can be supported by the test runner itself. The AndroidJUnitRunner API doc states:

Filter test run to tests with given annotation: adb shell am instrument -w -e annotation com.android.foo.MyAnnotation com.android.foo/android.support.test.runner.AndroidJUnitRunner
If used with other options, the resulting test run will contain the intersection of the two options. e.g. "-e size large -e annotation com.android.foo.MyAnnotation" will run only tests with both the LargeTest and "com.android.foo.MyAnnotation" annotations.

Spoon already supports that by adding the flag --e. It should be easy to do the same and pass a map through from the Gradle plugin configuration or the CLI through to the Fork configuration object and to the com.shazam.fork.runner.TestRun#execute method calling the com.android.ddmlib.testrunner.RemoteAndroidTestRunner#addInstrumentationArg method.

@iordanis iordanis added this to the 3.1.0 milestone Jan 3, 2018
@AndreiZaitcev AndreiZaitcev modified the milestones: 3.1.0, 3.3.0 Jan 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants