

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
123456# Helix Device Tests Guidelines78This document provides guidance for working with .NET MAUI device tests that run on Helix infrastructure using XHarness.910## Overview1112.NET MAUI uses [.NET Engineering Services Helix](https://helix.dot.net) with XHarness to run device tests across multiple platforms in parallel. This provides cloud-based device testing infrastructure.1314### Device Test Projects1516- `Controls.DeviceTests` - UI control tests17- `Core.DeviceTests` - Core framework tests18- `Graphics.DeviceTests` - Graphics and drawing tests19- `Essentials.DeviceTests` - Platform API tests20- `MauiBlazorWebView.DeviceTests` - Blazor WebView tests2122### Available Helix Queues2324Current configuration uses:25- **iOS**: `osx.15.arm64.maui.open`26- **Mac Catalyst**: `osx.15.arm64.maui.open`27- **Android**: `ubuntu.2204.amd64.android.33.open`2829Check available queues at [helix.dot.net](https://helix.dot.net).3031## Key Configuration Files3233| File | Purpose |34|------|---------|35| `eng/helix_xharness.proj` | Main Helix configuration - defines scenarios, queues, and work items |36| `eng/pipelines/common/stage-device-tests.yml` | Pipeline template for device tests |37| `eng/test-configuration.json` | Test retry configuration |3839## iOS Category Splitting4041For iOS, Controls.DeviceTests heavy categories are split into separate Helix work items. This mirrors the old cake-based approach and enables parallel execution for the slowest tests.4243**How it works:**441. Heavy categories are defined in `ControlsTestCategoriesToSkipForRestOfTests` property in `helix_xharness.proj`452. The `ControlsTestCategoriesToRunIndividually` ItemGroup is populated from that property463. Each heavy category becomes a separate Helix work item474. All other Controls tests run together in a single "General" work item485. XHarness passes `--set-env="TestFilter=Category=X"` for individual categories496. XHarness passes `--set-env="TestFilter=SkipCategories=X;Y;Z"` for the "General" work item507. Core.DeviceTests runs as a single work item (no splitting)5152**Heavy categories that run separately:**53- CollectionView, Shell, HybridWebView5455**Keep in sync:** If adding new heavy categories, update the `ControlsTestCategoriesToSkipForRestOfTests` property in `eng/helix_xharness.proj`.5657## Running Device Tests Locally5859### Prerequisites6061From the repository root:6263```bash64# 1. Restore dotnet tools65dotnet tool restore6667# 2. Build MSBuild tasks (required)68./build.sh -restore -build -configuration Release -projects $(PWD)/Microsoft.Maui.BuildTasks.slnf /bl:BuildBuildTasks.binlog -warnAsError false6970# 3. Build device tests71./build.sh -restore -build -configuration Release /p:BuildDeviceTests=true /bl:BuildDeviceTests.binlog -warnAsError false72```7374### Using the run-device-tests Skill (Recommended)7576The easiest way to run device tests locally is using the `run-device-tests` skill:7778```bash79# Run Controls tests on iOS simulator80pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios8182# Run only Button category tests83pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform ios -TestFilter "Category=Button"8485# Run on Android emulator86pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Controls -Platform android -TestFilter "Category=Button"8788# Run on MacCatalyst89pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Core -Platform maccatalyst90```9192See `.github/skills/run-device-tests/SKILL.md` for full documentation.9394### Submit to Helix9596Set required environment variables:9798```bash99export BUILD_REASON=pr100export BUILD_REPOSITORY_NAME=maui101export BUILD_SOURCEBRANCH=main102export SYSTEM_TEAMPROJECT=dnceng103export SYSTEM_ACCESSTOKEN=''104```105106Submit tests:107108```bash109# Android110./eng/common/msbuild.sh ./eng/helix_xharness.proj /restore /p:TreatWarningsAsErrors=false /t:Test /p:TargetOS=android /bl:sendhelix_android.binlog111112# iOS113./eng/common/msbuild.sh ./eng/helix_xharness.proj /restore /p:TreatWarningsAsErrors=false /t:Test /p:TargetOS=ios /bl:sendhelix_ios.binlog114115# Mac Catalyst116./eng/common/msbuild.sh ./eng/helix_xharness.proj /restore /p:TreatWarningsAsErrors=false /t:Test /p:TargetOS=maccatalyst /bl:sendhelix_catalyst.binlog117```118119### Windows Commands120121```cmd122set BUILD_REASON=pr123set BUILD_REPOSITORY_NAME=maui124set BUILD_SOURCEBRANCH=main125set SYSTEM_TEAMPROJECT=dnceng126set SYSTEM_ACCESSTOKEN=127128.\build.cmd -restore -build -configuration Release -projects ".\Microsoft.Maui.BuildTasks.slnf" /bl:BuildBuildTasks.binlog -warnAsError false129.\build.cmd -restore -build -configuration Release /p:BuildDeviceTests=true /bl:BuildDeviceTests.binlog -warnAsError false130.\eng\common\msbuild.cmd .\eng\helix_xharness.proj /restore /p:TreatWarningsAsErrors=false /t:Test /p:TargetOS=android /bl:sendhelix.binlog131```132133### Validate MSBuild Logic Only134135To validate the helix proj without submitting (requires built artifacts):136137```bash138dotnet msbuild eng/helix_xharness.proj /t:DiscoverTestBundles /p:TargetOS=ios /p:_MauiDotNetTfm=net10.0 /p:RepoRoot=$(pwd)/ -v:n139```140141## Test Filtering Implementation142143Test category filtering is implemented in `src/Core/tests/DeviceTests.Shared/DeviceTestSharedHelpers.cs`. The `GetExcludedTestCategories()` method reads the `TestFilter` value and converts it to a list of categories to skip.144145### Filter Syntax146147| Format | Description | Example |148|--------|-------------|---------|149| `Category=X` | Run only category X (skip all others) | `Category=Button` |150| `SkipCategories=X,Y,Z` | Skip specific categories | `SkipCategories=Shell,CollectionView` |151152### Platform-Specific Filter Passing153154| Platform | XHarness Argument | How App Reads It |155|----------|-------------------|------------------|156| **iOS/MacCatalyst** | `--set-env=TestFilter=...` | `NSProcessInfo.ProcessInfo.Environment["TestFilter"]` |157| **Android** | `--arg TestFilter=...` | `MauiTestInstrumentation.Current.Arguments.GetString("TestFilter")` |158| **Windows** | `--filter "Category=..."` | Native vstest filter |159160**Important**: iOS uses `--set-env` (environment variable), while Android uses `--arg` (instrumentation argument). These are NOT interchangeable.161162### Example XHarness Commands with Filters163164```bash165# iOS - uses --set-env166xharness apple test --target ios-simulator-64_18.5 --device UDID --set-env=TestFilter=Category=Button ...167168# Android - uses --arg169xharness android test --package-name com.microsoft.maui.controls.devicetests --arg TestFilter=Category=Button ...170```171172## Configuration Details173174The `eng/helix_xharness.proj` configuration includes:175176- **Timeouts**: 2-hour work item timeout, 1-hour 15-min test timeout for category splits177- **Test Discovery**: Automatically discovers test bundles for each scenario178- **Platform Targeting**: Uses `TargetOS` property (ios, maccatalyst, android)179- **Queue Selection**: Platform-appropriate Helix queues180- **XHarness Integration**: Uses XHarness CLI for device orchestration181182### CustomCommands for Category Filtering183184When using category splitting, `CustomCommands` metadata overrides the default xharness invocation:185186```xml187<CustomCommands>xharness apple test --target "$target" --app "$app" --output-directory "$output_directory" --timeout "$timeout" --launch-timeout "$launch_timeout" --set-env="TestFilter=Category=CategoryName"</CustomCommands>188```189190**Important**: Keep CustomCommands as a single line. Multi-line commands with `set -ex` can cause parse errors.191192## Troubleshooting193194### Common Issues1951961. **Build failures**: Ensure MSBuild tasks are built first1972. **Missing devices**: Check queue availability at [helix.dot.net](https://helix.dot.net)1983. **Authentication**: For CI, ensure proper Azure DevOps access tokens1994. **Timeouts**: Adjust `TestTimeout` and `WorkItemTimeout` for complex scenarios2005. **CustomCommands parse errors**: Keep commands on single line, avoid shell constructs like `set -ex`201202### Logging and Diagnostics203204- Use `/bl:filename.binlog` for detailed MSBuild logs205- Add `-verbosity:diag` for maximum diagnostic output206- Check Helix job results at the URL provided after submission207- Individual work item logs available at `https://helix.dot.net/api/2019-06-17/jobs/{jobId}/workitems/{workItemName}/console`208209## Additional Resources210211- [XHarness on Helix Documentation](https://github.com/dotnet/arcade/blob/main/src/Microsoft.DotNet.Helix/Sdk/tools/xharness-runner/Readme.md)212- [Helix SDK Documentation](https://github.com/dotnet/arcade/blob/main/src/Microsoft.DotNet.Helix/Sdk/Readme.md)213- [Example Helix Run](https://dev.azure.com/dnceng-public/public/_build/results?buildId=1115383&view=results)214
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| dotnet/maui.github/instructions/public-api.instructions.md · 23k | Copilot instructions | apido-not | 59/100 | 9 days ago | |
| dotnet/maui.github/copilot-instructions.md · 23k | Copilot instructions | setuptestlint-formatstyle+6 | 76/100 | 14 days ago | |
| dotnet/maui.github/instructions/android.instructions.md · 23k | Copilot instructions | buildstyle | 70/100 | 14 days ago | |
| dotnet/maui.github/instructions/ci-copilot-pipeline-security.instructions.md · 23k | Copilot instructions | gitsecuritydeploymentdo-not+1 | 76/100 | 14 days ago | |
| dotnet/maui.github/instructions/collectionview-android.instructions.md · 23k | Copilot instructions | stylearchperformanceagent-behaviour | 52/100 | 14 days ago | |
| dotnet/maui.github/instructions/collectionview-handler-detection.instructions.md · 23k | Copilot instructions | stylegitdo-not | 73/100 | 14 days ago | |
| dotnet/maui.github/instructions/collectionview-ios.instructions.md · 23k | Copilot instructions | styleperformance | 48/100 | 14 days ago | |
| dotnet/maui.github/instructions/collectionview-windows.instructions.md · 23k | Copilot instructions | stylearch | 52/100 | 14 days ago | |
| dotnet/maui.github/instructions/handler-patterns.instructions.md · 23k | Copilot instructions | styledo-not | 55/100 | 14 days ago | |
| dotnet/maui.github/instructions/integration-tests.instructions.md · 23k | Copilot instructions | setupteststyledo-not | 92/100 | 14 days ago | |
| dotnet/maui.github/instructions/layout-system.instructions.md · 23k | Copilot instructions | archapiperformancedo-not | 55/100 | 14 days ago | |
| dotnet/maui.github/instructions/performance-hotpaths.instructions.md · 23k | Copilot instructions | styleperformancedo-not | 55/100 | 14 days ago | |
| dotnet/maui.github/instructions/sandbox.instructions.md · 23k | Copilot instructions | buildteststyletesting-strategy+4 | 81/100 | 14 days ago | |
| dotnet/maui.github/instructions/templates.instructions.md · 23k | Copilot instructions | buildteststylearch+1 | 92/100 | 14 days ago | |
| dotnet/maui.github/instructions/threading-async.instructions.md · 23k | Copilot instructions | styleui | 48/100 | 14 days ago | |
| dotnet/maui.github/instructions/xaml-unittests.instructions.md · 23k | Copilot instructions | teststyledocs | 70/100 | 14 days ago | |
| dotnet/maui.github/instructions/safe-area-ios.instructions.md · 23k | Copilot instructions | stylegit | 43/100 | 14 days ago | |
| dotnet/maui.github/instructions/uitests.instructions.md · 23k | Copilot instructions | setupbuildteststyle+5 | 79/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| dotnet/roslyn.github/instructions/Compiler.instructions.md · 21k | Copilot instructions | buildteststylearch+3 | 99/100 | today | |
| ardalis/CleanArchitecture.github/copilot-instructions.md · 18k | Copilot instructions | buildteststylearch+4 | 96/100 | 14 days ago | |
| dotnet/maui.github/instructions/templates.instructions.md · 23k | Copilot instructions | buildteststylearch+1 | 92/100 | 14 days ago | |
| dotnet/maui.github/instructions/integration-tests.instructions.md · 23k | Copilot instructions | setupteststyledo-not | 92/100 | 14 days ago | |
| dotnet/roslyn.github/copilot-instructions.md · 21k | Copilot instructions | buildteststylearch+3 | 89/100 | 8 days ago | |
| we-promise/sure.github/copilot-instructions.md · 9.5k | Copilot instructions | setuptestlint-formatstyle+10 | 88/100 | 13 days ago | |
| microsoft/WSL.github/copilot-instructions.md · 33k | Copilot instructions | setupbuildtestlint-format+7 | 88/100 | 14 days ago | |
| PowerShell/PowerShell.github/instructions/start-native-execution.instructions.md · 55k | Copilot instructions | buildstylearchgit+1 | 86/100 | 14 days ago |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/dotnet-maui-github-instructions-helix-device-tests-instructions)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.