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

[Mobile] Add BrowserStack Android MAUI Test #23383

Merged
merged 4 commits into from
Jan 22, 2025

Conversation

carzh
Copy link
Contributor

@carzh carzh commented Jan 15, 2025

Description

Add test project that will perform an automated UI test that runs the unit tests on Android.

Motivation

  • Enables end-to-end on-device MAUI unit testing which we want to add to the packaging pipelines

Context

Microsoft.ML.OnnxRuntime.Tests.MAUI uses DeviceRunners.VisualRunners to allow running the unit tests (found in Microsoft.ML.OnnxRuntime.Tests.Common) across multiple devices. DeviceRunners.VisualRunners provides a simple UI with a button that will run the unit tests and a panel with the unit test results.

In order to automate the process of running the unit tests across mobile devices, Appium is used for UI testing orchestration (it provides a way to interact with the UI), and BrowserStack automatically runs these Appium tests across different mobile devices.

This project does not include the capability to start an Appium server locally or attach to a local emulator or device.

Build & run instructions

Requirements

  • A BrowserStack account with access to App Automate
    • You can set BrowserStack credentials as environment variables as shown here
  • ONNXRuntime NuGet package
    1. You can either download the stable NuGet package then follow the instructions from NativeLibraryInclude.props file to use the downloaded .nupkg file
    2. Or follow the build instructions to build the Android package locally
  • The dotnet workloads for maui and maui-android, which will not always automatically install correctly
    1. dotnet workload install maui
    2. dotnet workload install maui-android
  • Appium and the UiAutomator2 driver

Run instructions

  1. Build the Microsoft.ML.OnnxRuntime.Tests.MAUI project into a signed APK.
    1. Run the following: dotnet publish -c Release -f net8.0-android in the Microsoft.ML.OnnxRuntime.Tests.MAUI directory.
    2. Search for the APK files generated. They should be located in bin\Release\net8.0-android\publish.
    3. If they're in a different location, edit the browserstack.yml file to target the path to the signed APK.
  2. Ensure you've set the BrowserStack credentials as environment variables.
  3. Run the following in the Microsoft.ML.OnnxRuntime.Tests.Android.BrowserStack directory: dotnet test
  4. Navigate to the BrowserStack App Automate dashboard to see your test running!

@carzh carzh requested review from skottmckay and edgchen1 January 15, 2025 21:21
@carzh
Copy link
Contributor Author

carzh commented Jan 16, 2025

@edgchen1
Copy link
Contributor

will this test be run from a pipeline? will that be done in another PR?

@carzh
Copy link
Contributor Author

carzh commented Jan 17, 2025

will this test be run from a pipeline? will that be done in another PR?

Yep, the test will be run in the NuGet packaging pipeline which will be done in a follow-up PR

@carzh carzh merged commit 9f9fcf7 into microsoft:main Jan 22, 2025
94 checks passed
ashrit-ms pushed a commit that referenced this pull request Jan 23, 2025
### Description
Add test project that will perform an automated UI test that runs the
unit tests on Android.

### Motivation
- Enables end-to-end on-device MAUI unit testing which we want to add to
the packaging pipelines

### Context
Microsoft.ML.OnnxRuntime.Tests.MAUI uses DeviceRunners.VisualRunners to
allow running the unit tests (found in
Microsoft.ML.OnnxRuntime.Tests.Common) across multiple devices.
DeviceRunners.VisualRunners provides a simple UI with a button that will
run the unit tests and a panel with the unit test results.

In order to automate the process of running the unit tests across mobile
devices, Appium is used for UI testing orchestration (it provides a way
to interact with the UI), and BrowserStack automatically runs these
Appium tests across different mobile devices.

This project does not include the capability to start an Appium server
locally or attach to a local emulator or device.

## Build & run instructions
### Requirements
* A BrowserStack account with access to App Automate
* You can set BrowserStack credentials as environment variables as shown
[here](https://www.browserstack.com/docs/app-automate/appium/getting-started/c-sharp/nunit/integrate-your-tests#CLI)
* ONNXRuntime NuGet package
1. You can either download the [stable NuGet
package](https://www.nuget.org/packages/Microsoft.ML.OnnxRuntime) then
follow the instructions from [NativeLibraryInclude.props
file](../Microsoft.ML.OnnxRuntime.Tests.Common/NativeLibraryInclude.props)
to use the downloaded .nupkg file
2. Or follow the [build
instructions](https://onnxruntime.ai/docs/build/android.html) to build
the Android package locally
* The dotnet workloads for maui and maui-android, which will not always
automatically install correctly
    1. `dotnet workload install maui`
    2. `dotnet workload install maui-android`
* [Appium](https://appium.io/docs/en/latest/quickstart/) and the
[UiAutomator2
driver](https://appium.io/docs/en/latest/quickstart/uiauto2-driver/)

### Run instructions
1. Build the Microsoft.ML.OnnxRuntime.Tests.MAUI project into a signed
APK.
1. Run the following: `dotnet publish -c Release -f net8.0-android` in
the Microsoft.ML.OnnxRuntime.Tests.MAUI directory.
2. Search for the APK files generated. They should be located in
`bin\Release\net8.0-android\publish`.
3. If they're in a different location, edit the `browserstack.yml` file
to target the path to the signed APK.
2. Ensure you've set the BrowserStack credentials as environment
variables.
3. Run the following in the
Microsoft.ML.OnnxRuntime.Tests.Android.BrowserStack directory: `dotnet
test`
4. Navigate to the [BrowserStack App Automate
dashboard](https://app-automate.browserstack.com/dashboard/v2/builds) to
see your test running!
ashrit-ms added a commit that referenced this pull request Jan 23, 2025
### Description
This PR is to update the win-ort-main branch to the tip main branch as
of 2025-01-23.

### PR List
ddf0d37 [QNN EP] Add LoggingManager::HasDefaultLogger() to provider
bridge API (#23467)
05fbbdf [QNN EP] Make QNN EP a shared library (#23120)
1336566 Add custom vcpkg ports (#23456)
2e1173c Update the compile flags for vcpkg packages (#23455)
1f628a9 [Mobile] Add BrowserStack Android MAUI Test (#23383)
009cae0 [js/webgpu] Optimize ConvTranspose (Continue) (#23429)
04a4a69 Use onnx_protobuf.h to suppress some GCC warnings (#23453)
2e3b62b Suppress some strict-aliasing related warnings in WebGPU EP
(#23454)
b708f9b Bump ruff from 0.9.1 to 0.9.2 (#23427)
c0afc66 [WebNN] Remove workarounds for TFLite backend (#23406)
8a821ff Bump vite from 6.0.7 to 6.0.11 in
/js/web/test/e2e/exports/testcases/vite-default (#23446)
220c1a2 Make ORT and Dawn use the same protobuf/abseil source code
(#23447)
b7b5792 Change MacOS-13 to ubuntu on for
android-java-api-aar-test.yml. (#23444)
19d0d2a WIP: Dp4MatMulNBits accuracy level 4 matmul for WebGPU EP
(#23365)
95b8eff [QNN EP]: Clean up QNN logging resources if an error occurs
during initialization (#23435)
626134c Bump clang-format from 19.1.6 to 19.1.7 (#23428)
0cf9753 Fix eigen external deps (#23439)
f9440ae Moving RN_CI Android Testing to Linux (#23422)
1aa5902 [QNN EP] workaround for QNN validation bug for Tanh with
uint16 quantized output (#23432)
7f5582a Seperate RN andriod and IOS into 2 separated Stages. (#23400)
73deac2 Implement some missing element wise Add/Sub/Mul/Div/Neg
operations for CPU and CUDA EPs (#23090)
949fe42 Upgrade Java version from react-native/android to Java 17
(#23066)
0892c23 Update Qnn SDK default version to 2.30 (#23411)
94c099b Fix type cast build error (#23423)
d633e57 [WebNN EP] Fix AddInitializersToSkip issues (#23354)
e988ef0 [QNN EP] Fix regression for MatMul with two quantized/dynamic
uint16 inputs (#23419)
7538795 Update onnxruntime binary size checks ci pipeline's docker
image (#23405)
6c5ea41 Revert "[QNN EP] Clean up correctly from a partial setup
(#23320)" (#23420)
e866804 Enable comprehension simplification in ruff rules (#23414)
0a5f1f3 bugfix: string_view of invalid memory (#23417)
4cc38e0 fix crash when first input of BatchNormalization is 1-D
(#23387)
0334414 Target py310 and modernize codebase with ruff (#23401)
87341ac [QNN EP] Fix segfault when unregistering HTP shared memory
handles (#23402)

### Motivation and Context
This update includes the change to make QNN-EP a shared library.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Adrian Lizarraga <[email protected]>
Co-authored-by: Justin Chu <[email protected]>
Co-authored-by: Yulong Wang <[email protected]>
Co-authored-by: Edward Chen <[email protected]>
Co-authored-by: Changming Sun <[email protected]>
Co-authored-by: Peishen Yan <[email protected]>
Co-authored-by: Tianlei Wu <[email protected]>
Co-authored-by: Hector Li <[email protected]>
Co-authored-by: Jian Chen <[email protected]>
Co-authored-by: Alexis Tsogias <[email protected]>
Co-authored-by: junchao-zhao <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: sushraja-msft <[email protected]>
Co-authored-by: Wanming Lin <[email protected]>
Co-authored-by: Jiajia Qin <[email protected]>
Co-authored-by: Caroline Zhu <[email protected]>
carzh added a commit that referenced this pull request Jan 23, 2025
adrianlizarraga pushed a commit that referenced this pull request Jan 24, 2025
This reverts commit 9f9fcf7.

### Motivation and Context
- NuGet packaging pipelines failing with this error:
```Files\dotnet\packs\Microsoft.NET.Runtime.MonoTargets.Sdk\8.0.12\Sdk\RuntimeComponentManifest.targets(3,5):
error : Empty ResolveFrameworkReference.RuntimePackPath while trying to
read runtime components manifest. ResolvedFrameworkReference available:
{ Microsoft.NETCore.App, RuntimePackPath: }```
carzh added a commit that referenced this pull request Jan 29, 2025
carzh added a commit that referenced this pull request Feb 4, 2025
## Description
Follow-up for #23383 and #23474

* Adds android BrowserStack test back in
* Modifies MAUI csproj file to build into an APK


### Motivation and Context
There were 2 issues with the previous PRs:
1. The updated MAUI .csproj file configuration failed when building to
iOS and MacCatalyst. This caused problems in the packaging pipeline
because we build all C# projects in the .soln file in the packaging
pipeline. Removed the Mac & iOS build targets for now

3. The previous MAUI .csproj file configuration did not build into an
APK. It was missing the `<OutputType>` XAML tag and the Android package
type XAML tag.
sfatimar pushed a commit to intel/onnxruntime that referenced this pull request Feb 5, 2025
## Description
Follow-up for microsoft#23383 and microsoft#23474

* Adds android BrowserStack test back in
* Modifies MAUI csproj file to build into an APK


### Motivation and Context
There were 2 issues with the previous PRs:
1. The updated MAUI .csproj file configuration failed when building to
iOS and MacCatalyst. This caused problems in the packaging pipeline
because we build all C# projects in the .soln file in the packaging
pipeline. Removed the Mac & iOS build targets for now

3. The previous MAUI .csproj file configuration did not build into an
APK. It was missing the `<OutputType>` XAML tag and the Android package
type XAML tag.
sfatimar pushed a commit to intel/onnxruntime that referenced this pull request Feb 5, 2025
## Description
Follow-up for microsoft#23383 and microsoft#23474

* Adds android BrowserStack test back in
* Modifies MAUI csproj file to build into an APK


### Motivation and Context
There were 2 issues with the previous PRs:
1. The updated MAUI .csproj file configuration failed when building to
iOS and MacCatalyst. This caused problems in the packaging pipeline
because we build all C# projects in the .soln file in the packaging
pipeline. Removed the Mac & iOS build targets for now

3. The previous MAUI .csproj file configuration did not build into an
APK. It was missing the `<OutputType>` XAML tag and the Android package
type XAML tag.
ashrit-ms pushed a commit that referenced this pull request Feb 11, 2025
This reverts commit 9f9fcf7.

### Motivation and Context
- NuGet packaging pipelines failing with this error:
```Files\dotnet\packs\Microsoft.NET.Runtime.MonoTargets.Sdk\8.0.12\Sdk\RuntimeComponentManifest.targets(3,5):
error : Empty ResolveFrameworkReference.RuntimePackPath while trying to
read runtime components manifest. ResolvedFrameworkReference available:
{ Microsoft.NETCore.App, RuntimePackPath: }```
ashrit-ms pushed a commit that referenced this pull request Feb 11, 2025
## Description
Follow-up for #23383 and #23474

* Adds android BrowserStack test back in
* Modifies MAUI csproj file to build into an APK


### Motivation and Context
There were 2 issues with the previous PRs:
1. The updated MAUI .csproj file configuration failed when building to
iOS and MacCatalyst. This caused problems in the packaging pipeline
because we build all C# projects in the .soln file in the packaging
pipeline. Removed the Mac & iOS build targets for now

3. The previous MAUI .csproj file configuration did not build into an
APK. It was missing the `<OutputType>` XAML tag and the Android package
type XAML tag.
ashrit-ms added a commit that referenced this pull request Feb 11, 2025
### Description
This PR is to update the win-ort-main branch to the tip main branch as
of 2025-02-11.

### PR List
74c778e [WebNN EP] Automatically move input CPU tensors to ml-tensor
(#23073)
3775057 use correct total length to fix static kv_cache performance
(#23615)
3901e96 remove --use_vcpkg flag for Python-CUDA-Packaging-Pipeline
(#23631)
c610df5 Add python_requires to package metadata (#23604)
2d27d68 [QNN EP] Add QNN EP to ARM64X build targets (#23635)
e666503 [webgpu] no longer need pass-in gpu adapter for custom
context (#23593)
af679a0 Fix logic for selecting alternate name for blob (#23617)
e206950 [ARM CPU] Add fp16 mlas kernels for exp, tanh, softmax,
logsoftmax, softcap (#23597)
9ba5619 Update pybind and json to the latest (#23589)
c54736c Migrate iOS release pipeline to 1 ES (#23606)
3981326 Increase timeout for Windows TensorRT CI (#23625)
0274b7b fix on trtCudaVersion (#23616)
740e9ab update run CI script (#23621)
5ef1832 [WebGPU] Support PIX Capture for WebGPU EP (#23192)
0114551 Fix for C4267 warning (#23610)
002916a Validate the context_file_path before EP compile graphs
(#23611)
0887e36 [webgpu] Use pushErrorScope()/popErrorScope() once for an
inference run (#23438)
65008cb Auto-generated baselines by 1ES Pipeline Templates (#23603)
09e5724 [CUDA] Fix beam search of num_beams > 32 (#23599)
82840f6 Implement Flash Attention 2 for webgpu EP (#23576)
a6ea57b OpenVINO EP Weights Sharing Feature (#23553)
2c2ff4a [CUDA] Fix BeamSearchTest.DummyT5WithSequenceInputIds test
failure in Windows (#23596)
d981b15 [webgpu/js] Optimize resize webgpu op & fix precision issues
(#23591)
328a13c Enable VCPKG in more pipelines (#23590)
6728d60 [TensorRT EP] support TensorRT 10.8-GA (#23592)
d1fb58b Quantization tool: Allow user to override calibrator's
session EP (#23559)
649ced4 Enable user loading model with external data from memory
buffer (#23557)
544bdd6 Fix ConvTranspose for certain attribute combinations (#23488)
8f6ddf3 Delete extra cgmanifest entries and files (#23583)
5f6a315 Enable VCPKG in CI build (#23426)
e1e3f62 Bump lintrunner from 0.12.5 to 0.12.7 (#23326)
cd8775f Fix Node JS Samples (#23581)
6b4f9c4 [WebGPU EP] Batch Norm Implementation (#23525)
1fce51b Fix all instances of 4244 and 4267 warnings in OV EP code
(#23567)
c29ca1c Update QNN default version to 2.31 (#23573)
2fc75a4 [mobile] Add Android BrowserStack test project back (#23551)
9e18b6a [CUDA] Update nvcc flags (#23572)
b47e1e6 [QNN EP] Make offloading graph input/output quantization (to
CPU) the default (#23368)
75a9b40 [ROCm] Update CI to use rocm 6.3.2 (#23577)
26ff2b6 Bump ruff from 0.9.3 to 0.9.4 (#23563)
b2560a7 Update react-native to 0.72 (#23509)
faee912 [js] update JavaScript API to support QNN EP options (#23486)
816e8cb [EP Perf] Update env to ubuntu 22.04 (#23570)
cddc271 Use Eigen in Round implementation (#23571)
e8b0bdb Shape inference: ReduceMean dispatcher, quant_pre_process:
skip_symbolic_shape bugfix (#23558)
267b493 delete the supported domain version upper bounds (#23237)
bb7f961 remove log spam from cpuinfo (#23548)
169917b Use latest vcpkg commit in configuration, sync manifest with
deps.txt (#23554)
a9d4d08 Add of ReduceMax Gradient (#23501)
6bbf1bd [js/web] upgrade version of flatbuffers (#23545)
271c509 DP4AMatMul perf refinements (#23539)
cb69c59 Add fusions for SigLIP and Conformer-Encoder (#23528)
61fae9b Remove "--enable_pybind" from webgpu pipeline (#23550)
0bb4ea6 Update BiasGelu fusion and related ops (#23518)
4dde74a Add more details to BrowserStack script failure (#23520)
ead9d5c Set ANDROID_USE_LEGACY_TOOLCHAIN_FILE to false (#23544)
7e24088 Enable dlpack by default (#23110)
dc2f7a9 Add overload of `TryParseStringWithClassicLocale()` that uses
`std::from_chars()` (#23541)
5407c69 Fix the issue that the new generated EP context model not
able to find external data (#23537)
fbae88f [js/web] use the recommended workaround for Vite (#23531)
d5338da Fix tensor external data info length parsing issue. (#23526)
e3e4173 [ROCm EP] Fix transpose helper for gfx gridsize constraints
(#23527)
80bc1d2 Enable Ep context with external data for CPU nodes (#23498)
bf023ab [js/web] allow import .mjs/.wasm file (#23487)
655a23f [onnxruntime/build] Add new flag enable_generic_interface to
build primary EPs by default (#23342)
a770a8d Update RN to 0.71.19 (#23381)
1cf0ebd Delete Prefast workflow until the build failure is fixed
(#23510)
d2c5e24 Add of GlobalMaxPool Gradient (#23502)
ded8730 Remove thrust::unary_function (#23506)
8db97a6 [webgpu] Bump version of Dawn to b9b4a370 (#23494)
fdde2e2 Fix for gcc 13.3.1: Avoid creating a copy (#23500)
96ec1dd Bump ruff from 0.9.2 to 0.9.3 (#23496)
42f0c00 Adds the new System.Numerics.Tensors as an input/output type
when using dotnet 8.0 and up. (#23261)
97c2bbe Fix shape infer of onnx GroupNorm (#23477)
1fc9c48 Enable coremltools for Linux build (#23481)
13348c5 [ARM CPU] hgemm optimized for gqa (#23107)
c89a798 Enable opti on Microsoft.ML.OnnxRuntime with RelWithDebInfo
config (#23463)
d00ae32 Revert "[Mobile] Add BrowserStack Android MAUI Test (#23383)"
(#23474)
8b1d3b3 Align AvgPool ceil_mode on last value to torch (#16752)
06fc73b [TRT EP Perf Tool] Add annotations import to python script to
support annotations on Python 3.8 (#23466)

### Motivation and Context
This update includes the change to add QNN EP to ARM64X build targets.

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Adrian Lizarraga <[email protected]>
Co-authored-by: Ti-Tai Wang <[email protected]>
Co-authored-by: Caroline Zhu <[email protected]>
Co-authored-by: Grégoire <[email protected]>
Co-authored-by: Jing Fang <[email protected]>
Co-authored-by: Changming Sun <[email protected]>
Co-authored-by: Yateng Hong <[email protected]>
Co-authored-by: Michael Sharp <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Malik Shahzad Muzaffar <[email protected]>
Co-authored-by: Yulong Wang <[email protected]>
Co-authored-by: Dmitri Smirnov <[email protected]>
Co-authored-by: Corentin Maravat <[email protected]>
Co-authored-by: Jian Chen <[email protected]>
Co-authored-by: Karim Vadsariya <[email protected]>
Co-authored-by: Lei Cao <[email protected]>
Co-authored-by: Karim Vadsariya <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hector Li <[email protected]>
Co-authored-by: Ted Themistokleous <[email protected]>
Co-authored-by: Ted Themistokleous <[email protected]>
Co-authored-by: Edward Chen <[email protected]>
Co-authored-by: Takeshi Watanabe <[email protected]>
Co-authored-by: Xavier Dupré <[email protected]>
Co-authored-by: Justin Chu <[email protected]>
Co-authored-by: Tianlei Wu <[email protected]>
Co-authored-by: kunal-vaishnavi <[email protected]>
Co-authored-by: Sushanth Rajasankar <[email protected]>
Co-authored-by: PARK DongHa <[email protected]>
Co-authored-by: George Wu <[email protected]>
Co-authored-by: Xinpeng Dou <[email protected]>
Co-authored-by: Jambay Kinley <[email protected]>
Co-authored-by: Yifan Li <[email protected]>
Co-authored-by: Gavin Kinsey <[email protected]>
Co-authored-by: Prathik Rao <[email protected]>
Co-authored-by: Jon Campbell <[email protected]>
Co-authored-by: Satya Kumar Jandhyala <[email protected]>
Co-authored-by: Joshua Lochner <[email protected]>
Co-authored-by: Ankit Maheshkar <[email protected]>
Co-authored-by: jatinwadhwa921 <[email protected]>
Co-authored-by: jatinwadhwa921 <[email protected]>
Co-authored-by: saurabh <[email protected]>
Co-authored-by: TejalKhade28 <[email protected]>
Co-authored-by: sfatimar <[email protected]>
Co-authored-by: Javier E. Martinez <[email protected]>
Co-authored-by: Preetha Veeramalai <[email protected]>
Co-authored-by: Eric Crawford <[email protected]>
Co-authored-by: microsoft-github-policy-service[bot] <77245923+microsoft-github-policy-service[bot]@users.noreply.github.com>
Co-authored-by: Jie Chen <[email protected]>
Co-authored-by: shaoboyan091 <[email protected]>
Co-authored-by: David Hotham <[email protected]>
Co-authored-by: Guenther Schmuelling <[email protected]>
Co-authored-by: Enrico Galli <[email protected]>
guschmue pushed a commit that referenced this pull request Mar 6, 2025
### Description
Add test project that will perform an automated UI test that runs the
unit tests on Android.

### Motivation
- Enables end-to-end on-device MAUI unit testing which we want to add to
the packaging pipelines

### Context
Microsoft.ML.OnnxRuntime.Tests.MAUI uses DeviceRunners.VisualRunners to
allow running the unit tests (found in
Microsoft.ML.OnnxRuntime.Tests.Common) across multiple devices.
DeviceRunners.VisualRunners provides a simple UI with a button that will
run the unit tests and a panel with the unit test results.

In order to automate the process of running the unit tests across mobile
devices, Appium is used for UI testing orchestration (it provides a way
to interact with the UI), and BrowserStack automatically runs these
Appium tests across different mobile devices.

This project does not include the capability to start an Appium server
locally or attach to a local emulator or device.

## Build & run instructions
### Requirements
* A BrowserStack account with access to App Automate
* You can set BrowserStack credentials as environment variables as shown
[here](https://www.browserstack.com/docs/app-automate/appium/getting-started/c-sharp/nunit/integrate-your-tests#CLI)
* ONNXRuntime NuGet package
1. You can either download the [stable NuGet
package](https://www.nuget.org/packages/Microsoft.ML.OnnxRuntime) then
follow the instructions from [NativeLibraryInclude.props
file](../Microsoft.ML.OnnxRuntime.Tests.Common/NativeLibraryInclude.props)
to use the downloaded .nupkg file
2. Or follow the [build
instructions](https://onnxruntime.ai/docs/build/android.html) to build
the Android package locally
* The dotnet workloads for maui and maui-android, which will not always
automatically install correctly
    1. `dotnet workload install maui`
    2. `dotnet workload install maui-android`
* [Appium](https://appium.io/docs/en/latest/quickstart/) and the
[UiAutomator2
driver](https://appium.io/docs/en/latest/quickstart/uiauto2-driver/)

### Run instructions
1. Build the Microsoft.ML.OnnxRuntime.Tests.MAUI project into a signed
APK.
1. Run the following: `dotnet publish -c Release -f net8.0-android` in
the Microsoft.ML.OnnxRuntime.Tests.MAUI directory.
2. Search for the APK files generated. They should be located in
`bin\Release\net8.0-android\publish`.
3. If they're in a different location, edit the `browserstack.yml` file
to target the path to the signed APK.
2. Ensure you've set the BrowserStack credentials as environment
variables.
3. Run the following in the
Microsoft.ML.OnnxRuntime.Tests.Android.BrowserStack directory: `dotnet
test`
4. Navigate to the [BrowserStack App Automate
dashboard](https://app-automate.browserstack.com/dashboard/v2/builds) to
see your test running!
guschmue pushed a commit that referenced this pull request Mar 6, 2025
This reverts commit 9f9fcf7.

### Motivation and Context
- NuGet packaging pipelines failing with this error:
```Files\dotnet\packs\Microsoft.NET.Runtime.MonoTargets.Sdk\8.0.12\Sdk\RuntimeComponentManifest.targets(3,5):
error : Empty ResolveFrameworkReference.RuntimePackPath while trying to
read runtime components manifest. ResolvedFrameworkReference available:
{ Microsoft.NETCore.App, RuntimePackPath: }```
guschmue pushed a commit that referenced this pull request Mar 6, 2025
## Description
Follow-up for #23383 and #23474

* Adds android BrowserStack test back in
* Modifies MAUI csproj file to build into an APK


### Motivation and Context
There were 2 issues with the previous PRs:
1. The updated MAUI .csproj file configuration failed when building to
iOS and MacCatalyst. This caused problems in the packaging pipeline
because we build all C# projects in the .soln file in the packaging
pipeline. Removed the Mac & iOS build targets for now

3. The previous MAUI .csproj file configuration did not build into an
APK. It was missing the `<OutputType>` XAML tag and the Android package
type XAML tag.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants