Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make TimeZone tests more reliable. #5566

Merged
merged 1 commit into from
Feb 10, 2021
Merged

Conversation

dellis1972
Copy link
Contributor

@dellis1972 dellis1972 commented Jan 29, 2021

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. This
is to stop them tripping over each other when setting the timezone. Next up we will add a Retry attribute
to 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.

RunAdbCommand ($"shell am force-stop --user all {proj.PackageName}");
RunAdbCommand ($"shell am kill --user all {proj.PackageName}");

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 that
when setting the date time via adb that broadcast does NOT get fired. It only fires when the timezone
is 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.

@dellis1972 dellis1972 changed the title Get More info on TimeZone Failures Make TimeZone tests more reliable. Feb 9, 2021
@dellis1972 dellis1972 marked this pull request as ready for review February 9, 2021 21:27
@jonpryor jonpryor merged commit 7189f77 into dotnet:master Feb 10, 2021
@dellis1972 dellis1972 deleted the timezoneinfo branch February 10, 2021 10:42
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants