android / android/android-test

Multiple annotations passed in am command not working as expected

Open
#1,794 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
11h 29m
Merged PRs (30d)
2

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:

Contributor guide

Open the contributing guide

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.