Multiple annotations passed in am command not working as expected

Open
#1,794 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
android, java

Research direction

Start at the AndroidJUnitRunner entry point and reproduce the issue with the supplied adb shell am instrument command using two annotations. Compare the single-annotation and multiple-annotation runs; done means the multiple-annotation command runs only tests carrying either specified annotation rather than the full suite.

Written by the indexing model from the issue text.

Description

Description

If we pass multiple annotations in the am command, it runs all the tests instead of running only the tests with annotation.
Espresso documentation for multiple annotations - https://developer.android.com/reference/androidx/test/runner/AndroidJUnitRunner

Steps to Reproduce
  1. Add annotations to your test functions ( @Annotation1, @Annotation2 )
  2. Run the am instrument command
  3. adb shell am instrument -w -e annotation com.android.foo.Annotation1,com.android.foo.Annotation2 com.android.foo/androidx.test.runner.AndroidJUnitRunner
Expected Results

It should only run functions with the annotations. So if have 10 tests in total and we added annotation to only 2 , it should run 2/9 tests

Actual Results

It runs all the tests in the testsuite

AndroidX Test and Android OS Versions

com.android.foo/androidx.test.runner.AndroidJUnitRunner`
Android OS - 13

Note

This works fine with single annotation param

adb shell am instrument -w -e annotation com.android.foo.Annotation1 com.android.foo/androidx.test.runner.AndroidJUnitRunner

Link to a public git repo demonstrating the problem:
Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
1d 14h
Merged PRs (30d)
5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from android/android-test

All issues in android/android-test

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.