Skip to content

loopguard: count Android's variant test tasks as test runs - #381

Open
y2k wants to merge 1 commit into
microsoft:mainfrom
y2k:loopguard-android-variant-test-tasks
Open

y2k wants to merge 1 commit into
microsoft:mainfrom
y2k:loopguard-android-variant-test-tasks

Conversation

@y2k

@y2k y2k commented Dec 3, 2026

Copy link
Copy Markdown

An Android project runs its tests through the Android Gradle plugin's variant tasks: ./gradlew :app:testDebugUnitTest for the unit tests (one test<Variant>UnitTest per build variant, such as testFreeReleaseUnitTest) and ./gradlew connectedAndroidTest or :app:connectedDebugAndroidTest for the instrumented ones. The Gradle alternative of VERIFY_RE (#284) takes only a task named test, so status_of_tests returned None for every one of them: in an Android repository no turn had a verification, and a failing run after the last edit left the turn counted as ended green.

Fix: after the optional subproject path, the task may also be test…UnitTest or connected…AndroidTest. Tasks that run no tests stay non-runs: testClasses, compileDebugUnitTestKotlin, assembleDebugAndroidTest, and a variant test task left out with -x (./gradlew build -x testDebugUnitTest).

Tests, in tests/test_loopguard_jvm_builds.py:

  • 5 Android test-task commands added to RUNS, each a verification, and a failing run after an edit is not ended green; all 5 fail on main;
  • 3 commands added to NOT_RUNS.
python -m pytest tests -q
1921 passed, 40 skipped

`./gradlew :app:testDebugUnitTest` and `./gradlew connectedDebugAndroidTest` run an Android
project's unit and instrumented tests, but the Gradle pattern took only a task named `test`,
so every turn in an Android repository read as one with no verification at all.
`testClasses`, `compileDebugUnitTestKotlin` and `-x testDebugUnitTest` still run no tests.
@y2k

y2k commented Dec 3, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant