Repository navigation
test(android): Use fewer Robolectric SDK levels in core and replay - #6544
Merged
Merged
Conversation
Robolectric starts a new sandbox for each SDK level a test JVM uses, and downloads one android-all jar per level. Move pinned levels to the nearest shared level that takes the same code branch: 23/25 -> 24, 26 -> 30, 31/34 -> 33. Level 28 stays because ReplaySmokeTest and AndroidConnectionStatusProviderTest behave differently at 30. Core and replay now use 6 levels instead of 11. Locally, core Robolectric tests go from about 82s to 71s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 10, 2026
📲 Install BuildsAndroid
|
romtsn
marked this pull request as ready for review
November 11, 2026 12:50
romtsn
requested review from
0xadam-brown and
runningcode
and removed request for
a team
November 11, 2026 12:50
runningcode
approved these changes
Nov 11, 2026
romtsn
enabled auto-merge (squash)
November 11, 2026 12:51
auto-merge was automatically disabled
November 11, 2026 13:53
Pull request was closed
romtsn
enabled auto-merge (squash)
November 11, 2026 13:53
3 of 9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
Moves pinned Robolectric SDK levels in
sentry-android-coreandsentry-android-replaytests to a smaller set of shared levels. Each test still takes the same code branch. The levels go from 11 to 6: 21, 24, 28, 30, 33 and 35.N_MR1)N)<= N_MR1M)N)SDK_INTchecks on these paths are>= Mand< O. The other checks use a mockedBuildInfoProviderO)>= O. Between 26 and 30, the code under test has no branch that changes what they assertS), 34TIRAMISU)>= S, and the "below API 35" tests need< VANILLA_ICE_CREAMLevel 28 stays:
ReplaySmokeTesttimes out at 30, andAndroidConnectionStatusProviderTestgets a different network state at 30. One test name changes from "on API 23" to "on API 24".💡 Motivation and Context
Robolectric makes a new sandbox for each SDK level that a test JVM uses, and the first use of a level is expensive. A trivial test at a new level takes ~1.3s locally, and the same test at a level that is already loaded takes ~0.01s. Each level also needs one android-all jar (100-200 MB), which Robolectric downloads at test runtime on CI.
💚 How did you test it?
All core and replay unit tests pass (2187 tests).
CI benchmark: a temporary workflow (not part of this PR) ran only
:sentry-android-core:testReleaseUnitTest+:sentry-android-replay:testReleaseUnitTest. Each job ranmainand this PR in turns on the same runner, so the runner hardware does not affect the comparison. Warm jars, 3 rounds per job:main→ this PRmain→ this PRSo core is about 28s (16%) faster and replay about 10s (10%) faster. Locally (1 fork, 3 rounds), core went from 80-85s to 71s and replay from 47-48s to 45-46s.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
🤖 Generated with Claude Code
#skip-changelog