Make TimeZone tests more reliable. #5566
Merged
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.
The Timezone tests have been very unreliable recently. We speculate that this is down to the emulator not
running as fast as it used to on the CI system.
This PR attempts to make these tests more reliable.
Firstly we will make use of the
NonParallelizable
attribute to ensure that the tests run in sequence. Thisis to stop them tripping over each other when setting the timezone. Next up we will add a
Retry
attributeto at least re run a test once if it fails. This might help if the emulator is running slowly.
Next we introduce the following code both before and after the test.
These commands will force the application to stop, and face any background tasks the application has
to stop as well. This is the best way we could fine to completely kill the application. While we were
expecting the
TimeZoneChanged
notification to fire if the app was already running, it turns out thatwhen setting the date time via
adb
that broadcast does NOT get fired. It only fires when the timezoneis changed via the Settings screen. So killing the application completely and forcing a restart is the best
option. We should investigate to see if we can script the timezone change via the UI so we can test the
broadcast, but that should be done in a separate PR.