Skip to content

Add tests for foreground notifications#6902

Merged
grzesiek2010 merged 29 commits intogetodk:masterfrom
seadowg:foreground-service-test
Nov 12, 2025
Merged

Add tests for foreground notifications#6902
grzesiek2010 merged 29 commits intogetodk:masterfrom
seadowg:foreground-service-test

Conversation

@seadowg
Copy link
Member

@seadowg seadowg commented Sep 22, 2025

Follow up to #6900

This adds tests as well as fixing the bugs fixed in #6900 within the new structure.

Why is this the best possible solution? Were any other approaches considered?

Now, foreground service work manager jobs are run using real WorkManager infrastructure in tests. Deferred work still just runs on a standard background thread, but that seems like a fair trade-off for being able to control when they run still.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

There's been some changes made to how background jobs work in general, so I think testing repeated jobs (like match exactly) as well as manually syncs (again with match exactly) is a good idea.

Before submitting this PR, please make sure you have:

  • added or modified tests for any new or changed behavior
  • run ./gradlew connectedAndroidTest (or ./gradlew testLab) and confirmed all checks still pass
  • added a comment above any new strings describing it for translators
  • added any new strings with date formatting to DateFormatsTest
  • verified that any code or assets from external sources are properly credited in comments and/or in the about file.
  • verified that any new UI elements use theme colors. UI Components Style guidelines

@seadowg seadowg changed the base branch from master to v2025.3.x September 22, 2025 17:01
@seadowg seadowg changed the base branch from v2025.3.x to master September 22, 2025 17:02
@seadowg seadowg marked this pull request as ready for review October 8, 2025 10:34
@seadowg seadowg force-pushed the foreground-service-test branch from 2f9bbcf to 37f6db7 Compare October 8, 2025 10:38
@seadowg seadowg marked this pull request as draft October 8, 2025 10:52
@seadowg seadowg requested a review from grzesiek2010 October 8, 2025 11:49
@seadowg seadowg marked this pull request as ready for review October 8, 2025 11:50
@seadowg seadowg force-pushed the foreground-service-test branch from a302b6a to 343f2bb Compare November 6, 2025 17:59
@seadowg seadowg force-pushed the foreground-service-test branch from cdc1a61 to c135d8a Compare November 7, 2025 13:52
@seadowg seadowg force-pushed the foreground-service-test branch from 15f1c71 to 99752cb Compare November 7, 2025 14:22
@seadowg seadowg force-pushed the foreground-service-test branch from 44e2561 to 26f4853 Compare November 7, 2025 15:05
@seadowg seadowg requested a review from grzesiek2010 November 7, 2025 15:44
@@ -0,0 +1,7 @@
package org.odk.collect.androidshared.utils

class RuntimeUniqueIdGeneratorTest : UniqueIdGeneratorTest() {
Copy link
Member

Choose a reason for hiding this comment

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

This should be called InMemUniqueIdGeneratorTest

@seadowg seadowg requested a review from grzesiek2010 November 10, 2025 09:22
@grzesiek2010 grzesiek2010 merged commit 6d05d87 into getodk:master Nov 12, 2025
7 checks passed
@WKobus
Copy link

WKobus commented Nov 14, 2025

Tested with success

Verified on Android 16

Verified cases:

  • Match exactly and previously downloaded forms settings
  • Manually refreshing forms with match exactly
  • Different update frequencies
  • Notifications for form updates

@dbemke
Copy link

dbemke commented Nov 14, 2025

Tested with success

Verified on Android 10

@seadowg seadowg deleted the foreground-service-test branch November 17, 2025 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants