Skip to content

test(android): pin Robolectric tests to SDK 35 in robolectric.properties - #727

Merged
dcalhoun merged 3 commits into
trunkfrom
test/android-robolectric-sdk-properties
Sep 24, 2026
Merged

dcalhoun merged 3 commits into
trunkfrom
test/android-robolectric-sdk-properties

Conversation

@dcalhoun

@dcalhoun dcalhoun commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

What?

Colocate Robolectric tests configuration. Bump to SDK 35.

Why?

Address feedback in #723 (comment). Avoid cryptic CI failures when tests pass locally.

How?

Pin Robolectric tests to SDK 35 in robolectric.properties.

Testing Instructions

N/A, no user-facing changes.

Accessibility Testing Instructions

N/A, no user-facing changes.

Screenshots or screencast

N/A, no user-facing changes.


AI-generated details

Problem: Follow-up to #723 review feedback. Each Robolectric test class pins @Config(sdk = [28]) individually. A new class that omits it defaults to the manifest's targetSdk (36), which needs Java 21, so it passes locally and fails on CI (as SvgIconCacheTest did).

Fix: Pin the SDK once in android/Gutenberg/src/test/resources/robolectric.properties and drop the per-class SDK annotations. The pin also moves from the arbitrary 28 to 35, the newest SDK CI's JVM can run (36 needs Java 21), which is closer to WordPress-Android's target of 36 and covers code gated on newer APIs (e.g. BlockPickerDialog's Android 12+ branch). Test resources aren't packaged in the AAR, so consumers like WordPress-Android are unaffected.

Testing: CI's :android: Test Android Library passes, confirming CI's JVM supports SDK 35. Locally, make test-android-library-unit; temporarily setting sdk=9999 in the properties file makes the suites fail with UnknownSdk, confirming Robolectric reads it.

🤖 Generated with Claude Code

A test class missing the per-class `@Config(sdk = [28])` defaults to
compileSdk 36, which needs Java 21, so it passes locally and fails on CI.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Sep 24, 2026
@wpmobilebot

wpmobilebot commented Sep 24, 2026 •

Copy link
Copy Markdown

XCFramework Build

This PR's XCFramework is available for testing. Add the following to your Package.swift:

.package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/727")

Built from d9e9454

SDK 28 was an arbitrary default. 35 is the newest SDK CI's JVM can run
and covers code gated on newer APIs, closer to WordPress-Android's
target of 36.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@dcalhoun dcalhoun changed the title test(android): pin the Robolectric SDK once in robolectric.properties test(android): pin Robolectric tests to SDK 35 in robolectric.properties Sep 24, 2026
@dcalhoun
dcalhoun marked this pull request as ready for review September 24, 2026 14:52
@dcalhoun
dcalhoun requested a review from nbradbury September 24, 2026 14:52
@@ -0,0 +1,2 @@
# Robolectric otherwise defaults to compileSdk, which requires a newer JVM than CI runs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this matters, but according to Claude:

The comment in robolectric.properties says Robolectric falls back to compileSdk. It actually falls back to the manifest’s targetSdk, which happens to be 36 here. Only the wording is off.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the note. Addressed in d9e9454.

@nbradbury nbradbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left one nit but we're good to :shipit:

Robolectric reads the manifest's targetSdk, not compileSdk; both are 36
today, which hid the difference.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@dcalhoun
dcalhoun enabled auto-merge (squash) September 24, 2026 16:28
@dcalhoun
dcalhoun merged commit 3db5ed9 into trunk Sep 24, 2026
26 checks passed
@dcalhoun
dcalhoun deleted the test/android-robolectric-sdk-properties branch September 24, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants