Skip to content

test: add JVM unit and composable integration tests using android-maps-robolectric - #1001

Draft
dkhawk wants to merge 1 commit into
mainfrom
feature/robolectric-tests
Draft

dkhawk wants to merge 1 commit into
mainfrom
feature/robolectric-tests

Conversation

@dkhawk

@dkhawk dkhawk commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

This draft PR introduces JVM-based unit and Jetpack Compose integration tests for :maps-compose leveraging the exploratory android-maps-robolectric shadow library (com.google.android.maps.robolectric:shadows:1.0.0).

Note

CI is expected to fail resolution for com.google.android.maps.robolectric:shadows:1.0.0 until the library is published to Maven Central. This PR is intended for early review and exploration of the testing ergonomics and coverage potential.

Test Suites Included

  1. CameraPositionStateTest: tests unbound state, map synchronization, instantaneous move(), coroutine animate(), and screen coordinate projection round-trip.
  2. MapApplierTest: tests Compose node hierarchy mutation, MarkerNode insertion & MarkerState binding, click events, drag interactions, and circle callbacks.
  3. GoogleMapTest: tests full Compose UI lifecycle (<GoogleMap> rendering with markers/circles, marker clicks mutating Compose state, dynamic recomposition additions/removals).

Local Coverage Metrics

Across these 14 fast JVM tests (~7.4s execution time), :maps-compose test coverage reached:

  • GoogleMapKt: 69.6%
  • CameraPositionState: 69.8%
  • MapClickListenersKt: 88.1%
  • CircleKt: 78.7%
  • Overall :maps-compose: 32.1% instruction coverage (up from 0.0%)

Reviewers: @kikoso, @LoyalAbbas

@dkhawk
dkhawk force-pushed the feature/robolectric-tests branch from 0985765 to 34f2003 Compare September 15, 2026 21:09
@github-actions

Copy link
Copy Markdown

Coverage (unit tests)

Compared against a24cc53 on main (#1000).

Module Line % Change Branch % Change
maps-compose 36.56% 🔺 +36.56 10.32% 🔺 +10.32
maps-compose-utils 2.04% no change 0.49% no change
maps-compose-widgets 0.00% no change 0.00% no change
TOTAL 27.47% 🔺 +27.05 8.24% 🔺 +8.15

Line and branch coverage from unit test reports. History is recorded in coverage/history.csv after each merge to main.

@googlemaps-bot

Copy link
Copy Markdown
Contributor

Code Coverage

Overall Project 24.59%

There is no coverage information present for the Files changed

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.

2 participants