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

[ci] Improvements for emulator test jobs #7731

Merged
merged 1 commit into from
Mar 9, 2023
Merged

Conversation

pjcollins
Copy link
Member

@pjcollins pjcollins commented Jan 23, 2023

The setup execution time for non-device tests has been improved by
moving a handful of adb commands from BaseTest to DeviceTest setup.
These would run for nearly every test run and result in a lot of waiting
due to some RunProcess failures and timeouts.

The output from the shell command we run to check if a device is online
is now cached and only refreshed when required by certain tests/asserts.

The AssertHasDevices check has been consolidated into DeviceTest
setup, and removed from individual tests in most cases.

Attempts to restart the emulator if a test determines that it is
inaccessible have been fixed, and emulator data will not be reset in
this case.

I played around with a handful of emulator launch settings and found
that removing the no-boot-anim and headless UI options improved the
reliability of nightly LocalizationTests, and resulted in faster boot
times locally. These options are now disabled for those tests.

The DeploymentTest class has been replaced by TimeZoneInfoTests and
LocalizationTests, and the other tests in that class have been moved
to InstallAndRunTests. TimeZoneInfoTests and LocalizationTests
will now validate command line output rather than trying to press a
button and read a UI element. This should make them more reliable and
faster.

The TimeZoneInfoTests and LocalizationTests suites have been moved
into separate test stages in the nightly test job.

All nightly tests now run against our .NET build/test artifacts rather
than classic XA.

An issue that caused LocalizationTests nodes 11 and 12 to not contain
any tests has been fixed.

An issue that caused LocalizationTests node 1 to also run tests from
node 11 and node 12 has been fixed.

Test result attachments have been fixed for TimeZoneInfoTests and
LocalizationTests, ensuring that we capture the right logcat and build
files for each test variant.

An issue causing binlog files to be overwritten by tests that use
multiple build targets has been fixed by naming the binlog file after
the build log file.

Console output verbosity has been set to normal for dotnet test
invocations, which should help with debugging.

Test NUnit packages have been updated to their latest versions.

@pjcollins
Copy link
Member Author

@pjcollins pjcollins force-pushed the dev/pjc/nightly-locstage branch 4 times, most recently from 658d7ad to 71eec41 Compare February 2, 2023 23:34
@pjcollins pjcollins force-pushed the dev/pjc/nightly-locstage branch 7 times, most recently from 414890a to 8db7b56 Compare February 8, 2023 19:52
@pjcollins pjcollins changed the title [ci] Use more test stages in the nightly run [ci] Improvements for emulator test jobs Feb 8, 2023
@pjcollins pjcollins force-pushed the dev/pjc/nightly-locstage branch from 8db7b56 to 889f745 Compare February 9, 2023 19:36
@pjcollins pjcollins force-pushed the dev/pjc/nightly-locstage branch 6 times, most recently from 196ee80 to 0ffe290 Compare February 23, 2023 20:50
@pjcollins
Copy link
Member Author

@pjcollins pjcollins added the do-not-merge PR should not be merged. label Feb 23, 2023
@pjcollins pjcollins marked this pull request as ready for review February 23, 2023 20:52
@pjcollins
Copy link
Member Author

pjcollins commented Feb 23, 2023

I think this is getting pretty close so opening it up for some review. There are still reliability issues, but I think this is move in the right direction.

After moving all of the nightly tests to run against our .NET artifacts I've been seeing some SSL related issues on API 23 and below which may be real issues:
https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=7369649&view=ms.vss-test-web.build-test-results-tab&runId=69041435&resultId=100139&paneView=debug

@@ -71,8 +71,6 @@ public class XASdkDeployTests : DeviceTest
[TestCaseSource (nameof (DotNetInstallAndRunSource))]
public void DotNetInstallAndRun (bool isRelease, bool xamarinForms, string targetFramework)
{
AssertHasDevices ();
Copy link
Member

Choose a reason for hiding this comment

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

Some of these if I run them locally and forgot to attach a device, it would give a nice error message. Was there a reason to remove it?

Copy link
Member Author

@pjcollins pjcollins Feb 24, 2023

Choose a reason for hiding this comment

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

I moved this check into DeviceTest setup so we don't need to define it on every test. We will also attempt to acquire an android target during setup now as well if one is not available.

@dellis1972
Copy link
Contributor

This is all good stuff.

It might be nice however to keep at least one test which checks a Button Click? (If we removed them all). Since this helps to confirm that our Events works and possiblly that the CodeBehind stuff works.

@pjcollins
Copy link
Member Author

pjcollins commented Feb 24, 2023

It might be nice however to keep at least one test which checks a Button Click? (If we removed them all). Since this helps to confirm that our Events works and possiblly that the CodeBehind stuff works.

The DeploymentTests class that I replaced had two other tests that click a button, I've moved those into InstallAndRunTests. These will hopefully continue to provide this coverage, and we can add more here in the future as needed.

@pjcollins pjcollins force-pushed the dev/pjc/nightly-locstage branch 9 times, most recently from f2aad65 to 382b80f Compare February 28, 2023 17:50
@pjcollins
Copy link
Member Author

pjcollins commented Mar 2, 2023

Previous nightly was close to green with a re-run: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=7396250&view=results.

Queueing one more against this branch to see how it fairs:
https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=7411683&view=results

I think this is now in a place where it can be merged and we can continue to iterate on improvements.

@pjcollins pjcollins removed the do-not-merge PR should not be merged. label Mar 2, 2023
@pjcollins pjcollins requested a review from jpobst March 2, 2023 19:30
Copy link
Contributor

@jpobst jpobst left a comment

Choose a reason for hiding this comment

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

🤞 for more stable tests!

In future PRs, we can look at dotnet-test-slicer and start-stop-emulator.yaml as possible improvements.

@pjcollins pjcollins force-pushed the dev/pjc/nightly-locstage branch from 382b80f to 0cfe02a Compare March 2, 2023 23:50
@pjcollins pjcollins force-pushed the dev/pjc/nightly-locstage branch from 0cfe02a to 23e36e2 Compare March 7, 2023 16:04
The setup execution time for non-device tests has been improved by
moving a handful of adb commands from BaseTest to DeviceTest setup.
These would run for nearly every test run and result in a lot of waiting
due to some RunProcess failures and timeouts.

The output from the shell command we run to check if a device is online
is now cached and only refreshed when required by certain tests/asserts.

The AssertHasDevices check has been consolidated into DeviceTest setup,
and removed from individual tests in most cases.

Attempts to restart the emulator if a test determines that it is
inaccessible have been fixed, and emulator data will not be reset in this
case.

I played around with a handful of emulator launch settings and found
that removing the no-boot-anim and headless UI options improved the
reliability of nightly LocalizationTests, and resulted in faster boot
times locally. These options are now disabled for those tests.

The DeploymentTest class has been replaced by TimeZoneInfoTests and
LocalizationTests, and the other tests in that class have been moved to
InstallAndRunTests. TimeZoneInfoTests and LocalizationTests will now
validate command line output rather than trying to press a button and
read a UI element. This should make them more reliable and faster.

The TimeZoneInfoTests and LocalizationTests suites have been moved into
separate test stages in the nightly test job.

All nightly tests now run against our .NET build/test artifacts rather
than classic XA.

An issue that resulted in LocalizationTests nodes 11 and 12 not
containing any tests has been fixed.

An issue that would cause LocalizationTests node 1 to run tests from
node 11 and node 12 has been fixed.

Test result attachments have been fixed for TimeZoneInfoTests and
LocalizationTests, ensuring that we capture the right logcat and build
files for each test variant.

An issue causing binlog files to be overwritten by tests that use
multiple build targets has been fixed by naming the binlog file after
the build log file.

Console output verbosity has been set to normal for dotnet test
invocations, which should help with debugging.

Test NUnit packages have been updated to their latest versions.
@pjcollins pjcollins force-pushed the dev/pjc/nightly-locstage branch from 23e36e2 to d78f84b Compare March 8, 2023 22:40
@pjcollins pjcollins merged commit fa9b99f into main Mar 9, 2023
@pjcollins pjcollins deleted the dev/pjc/nightly-locstage branch March 9, 2023 19:29
grendello added a commit to grendello/xamarin-android that referenced this pull request Mar 10, 2023
* main:
  [ci] Improvements for emulator test jobs (dotnet#7731)
grendello added a commit to grendello/xamarin-android that referenced this pull request Mar 10, 2023
* main:
  [ci] Improvements for emulator test jobs (dotnet#7731)
grendello added a commit to grendello/xamarin-android that referenced this pull request Mar 10, 2023
* main:
  [ci] Improvements for emulator test jobs (dotnet#7731)
jonathanpeppers pushed a commit that referenced this pull request Mar 11, 2023
The following changes attempt to improve the reliability and performance
of our MSBuild test jobs. All nightly tests have been updated to run
against our .NET build/test artifacts rather than classic XA.

The setup execution time for non-device tests has been improved by
moving a handful of adb commands from BaseTest to DeviceTest setup.
These would run for nearly every test run and result in a lot of waiting
due to some RunProcess failures and timeouts.

The output from the shell command we run to check if a device is online
is now cached and only refreshed when required by certain tests/asserts.

The `AssertHasDevices` check has been moved into `DeviceTest` setup,
and removed from individual tests in most cases.

Attempts to restart the emulator if a test determines that it is
inaccessible have been fixed, and emulator data will not be reset in
this case.

I played around with a handful of emulator launch settings and found
that removing the no-boot-anim and headless UI options improved the
reliability of nightly launch tests, and resulted in faster boot
times locally. These options are now disabled for those tests.

The `DeploymentTest` class has been replaced by `TimeZoneInfoTests` and
`LocalizationTests`, and the other tests in that class have been moved
to `InstallAndRunTests`. `TimeZoneInfoTests` and `LocalizationTests`
will now validate command line output rather than trying to press a
button and read a UI element. This should make them more reliable and
faster.

The `TimeZoneInfoTests` and `LocalizationTests` suites have been moved
into separate test stages in the nightly test job.

An issue that caused LocalizationTests nodes 11 and 12 to not contain
any tests has been fixed.

An issue that caused LocalizationTests node 1 to also run tests from
node 11 and node 12 has been fixed.

Test result attachments have been fixed for `TimeZoneInfoTests` and
`LocalizationTests`, ensuring that we capture the right logcat and build
files for each test variant.

An issue causing binlog files to be overwritten by tests that use
multiple build targets has been fixed by naming the binlog file after
the build log file.

Console output verbosity has been set to normal for dotnet test
invocations, which should help with debugging.

Test NUnit packages have been updated to their latest versions.
@github-actions github-actions bot locked and limited conversation to collaborators Jan 23, 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.

4 participants