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

Add doc for android startup scenario local testing. #4664

Merged
merged 8 commits into from
Feb 4, 2025
35 changes: 35 additions & 0 deletions docs/android-startup-scenarios.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

# Android Startup Test

## Prereqs

- Ensure `dotnet` is installed and available with the `dotnet` command for easy xharness installation. Any supported .NET Core version should work. [Dotnet Download](https://dotnet.microsoft.com/en-us/download) or [Daily Dotnet Download](https://github.com/dotnet/sdk/blob/main/documentation/package-table.md)
- Ensure `xharness` is installed and available with the `xharness` command. The current version in use can be found in the `eng/performance/maui_scenarios_android.proj` file at line 7 (under the tag `MicrosoftDotNetXHarnessCLIVersion`), although any recent version should work. [XHarness Install Instructions](https://github.com/dotnet/xharness?tab=readme-ov-file#installation-and-usage).
- Have an Android app APK available for testing.
- Have an Android Device (with developer mode enabled) or emulator connected to computer, and viewable with `xharness android device` or `xharness android adb -- devices -l`.

## Steps

1. Initialize the environment (note the . for bash):

```sh
cd src/scenarios
. ./init.sh # or `.\init.ps1` on Windows
ivanpovazan marked this conversation as resolved.
Show resolved Hide resolved
```

2. Navigate to the `helloandroid` scenario directory:

```sh
cd helloandroid
```

3. Copy the APK into the `helloandroid` directory.
Copy link
Member

Choose a reason for hiding this comment

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

Is there any correlation between dotnet version used for building the .apk and the one used as part of the environment?

Copy link
Member

Choose a reason for hiding this comment

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

This script should work with any .apk, cc: @LoopedBard3

Copy link
Member Author

Choose a reason for hiding this comment

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

There should not be any correlation if using a separately built APK. There are scenarios that this does not currently cover where the dotnet version would matter, e.g. when building Maui apps with pre.py the dotnet version will matter.

Copy link
Member

Choose a reason for hiding this comment

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

I am a bit confused, could you please clarify:

  • Is this doc specific to HelloAndroid (the dotnet/runtime) sample, or it refers to any Android app - any .apk?
    • If it is the former - only HelloAndroid sample, there are couple of issues I can see with it:
    • If it is the latter, then we should rename the scenario to avoid confusion (or create a new one which would be just for this purpose). Maybe androidstartup or something like that, the point is that it shouldn't refer to HelloAndroid in any way for the above mentioned reasons

Copy link
Member Author

Choose a reason for hiding this comment

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

The doc is more general for any APK, so I went ahead and added a new scenario folder named genericandroidstartup to make it more clear that it can be used for any APK. The reason we have the specific scenarios for some of the other apps is some of the pre.py files can build the apps (like the mauiandroid), but most of the test.py's for the android testing are interchangeable.

4. Run the test:

```sh
python test.py devicestartup --device-type android --package-path <path to apk (e.g. .)>/<apkname>.apk --package-name <apk package name> [--disable-animations]
LoopedBard3 marked this conversation as resolved.
Show resolved Hide resolved
```

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add information about where the results of the performance test can be found or an example of what the output should look like.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added section on this.

## Notes

- Example commands and additional logic can be found in the `maui_scenarios_android.proj` and `runner.py` files in the `performance` repository.
ivanpovazan marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 3 additions & 1 deletion docs/scenarios-workflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## Overview

Our existing scenario tests are under `src\scenarios` in this repo, where each subdirectory contains a test asset that can be combined with a specific set of commands to do measurements. Currently we have scenario tests for [SDK](./sdk-scenarios.md), [Crossgen](./crossgen-scenarios.md), [Blazor](./blazor-scenarios.md) and [other scenarios](./basic-scenarios.md).
Our existing scenario tests are under `src\scenarios` in this repo, where each subdirectory contains a test asset that can be combined with a specific set of commands to do measurements. Currently we have scenario tests for [SDK](./sdk-scenarios.md), [Crossgen](./crossgen-scenarios.md), [Blazor](./blazor-scenarios.md), [Android Startup](./android-startup-scenarios.md), and [other scenarios](./basic-scenarios.md).

## Running scenario tests

Expand All @@ -12,6 +12,7 @@ This is a general guideline on how the scenario tests are arranged in this repo.
- [How to run SDK scenario tests](./sdk-scenarios.md)
- [How to run Crossgen scenario tests](./crossgen-scenarios.md)
- [How to run Blazor tests](./blazor-scenarios.md)
- [How to run Android Startup tests](./android-startup-scenarios.md)
- [How to run other Scenario tests](./basic-scenarios.md)

### Prerequisites
Expand Down Expand Up @@ -138,4 +139,5 @@ Some command options are only applicable for certain test assets. Refer to the c
- [SDK Command Matrix](./sdk-scenarios.md#command-matrix)
- [Crossgen Command Matrix](./crossgen-scenarios.md#command-matrix)
- [Blazor Command Matrix](./blazor-scenarios.md#command-matrix)
- [How to run Android Startup tests](./android-startup-scenarios.md)
- [Other Scenarios Command Matrix](./basic-scenarios.md#command-matrix)
Loading