Workload and device testing
Workload and device testing
A MAUI application is ready for a device only when the relevant workload, platform SDK, target OS, architecture, packaging and actual UI behavior have been checked. A portable test of shared logic is valuable but cannot demonstrate accessibility, permissions or app lifecycle on a device.
Start with read-only environment inventory: dotnet --info, dotnet --list-sdks, dotnet workload list, dotnet new list maui. Record the approved SDK and workload set, exact template version, target framework, OS and emulator image; check official platform requirements and current servicing separately. Do not silently install workloads or use signing identities. Android, iOS, Windows and Mac Catalyst each need their appropriate tooling. Build only an approved target using its actual framework from the generated project (for example net10.0-android), not an arbitrary TFM. Use a disposable emulator or authorized device without personal accounts. Test offline startup, denial paths for any requested permissions, suspend/resume, rotation or resize, font scaling, keyboard navigation and screen reader behavior. A permission-free lab should not request unrelated sensitive permissions. Reset only fixture-owned state. Capture observed behavior separately from expectations. Never publish to a store or sign using personal keys. The first example is a manual device walkthrough; the other two are portable test models, not hardware evidence.
Baseline: .NET 10 / C# 14. Every expected result is reasoned, not executed. The complete portable and Windows desktop projects are separate from MAUI template overlays. No runtime or UI claims.
Check a page with large fonts and assistive technology
On a disposable approved device, turn on large text and the platform screen reader; activate the button with supported input. Return device settings afterward.
In an approved environment with .NET 10 SDK and MAUI 10 workload already available, create a fresh disposable standard MAUI app with dotnet new maui -n Fixture -o Fixture --no-restore. Confirm namespace Fixture, standard Shell root, target framework, resource paths, and actual template compatibility; stop on mismatch. Copy the archived Program.cs AS MainPage.xaml.cs (replace, do not add a duplicate). Replace MainPage.xaml and any named companion in the generated project. Keep the template project, platform startup and assets. Inspect dependency graph and target tooling before approved restore/build; use the actual target framework from the template. Run only on an authorized emulator or disposable device. No silent installation, signing, or publishing.
using System;using Microsoft.Maui.Controls;using Microsoft.Maui;namespace Fixture;public partial class MainPage : ContentPage { private int count; public MainPage() { InitializeComponent(); } private void Add(object? sender, EventArgs e) { if(count<9) count++; Status.Text=$"Sample count: {count}"; if(count==9) AddButton.IsEnabled=false; }}MainPage.xaml
<ContentPage x:Class="Fixture.MainPage" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" Title="Notes lab"> <ScrollView> <VerticalStackLayout Padding="20" Spacing="12"> <Label Text="Offline notes check" SemanticProperties.HeadingLevel="Level1"/> <Button x:Name="AddButton" Text="Add sample" SemanticProperties.Hint="Adds one local sample up to nine" Clicked="Add"/> <Label x:Name="Status" Text="Sample count: 0"/> </VerticalStackLayout> </ScrollView></ContentPage>Expected result (not executed):
After one activation: Sample count: 1. At nine: button disabled and count remains nine.Observe label readability, focus and screen reader output in the actual target. The text update is not a guarantee of an automatic announcement.
Test a denied capability with a fake adapter
No OS permission request occurs. Test the denied and allowed synthetic outcomes.
Use the complete Fixture.csproj with an approved .NET 10 SDK. Restore approved dependencies, build and run. No UI workload needed.
using System;foreach(var allowed in new[]{false,true}) { ICapability capability=new FakeCapability(allowed); Console.WriteLine(Describe(capability));}static string Describe(ICapability capability)=>capability.Allowed ? "Feature available" : "Continue offline";interface ICapability { bool Allowed {get;} }sealed class FakeCapability(bool allowed):ICapability { public bool Allowed=>allowed; }Expected result (not executed):
Continue offlineFeature availableThe fallback is testable without sensitive hardware. This does not validate any actual permission dialog.
Track evidence by target and gate
An evidence report must distinguish a portable model from actual device observations.
Use the complete Fixture.csproj with an approved .NET 10 SDK. Restore approved dependencies, build and run. No UI workload needed.
using System;var rows=new[]{new Gate("Shared rule",true),new Gate("Android UI",false),new Gate("Windows UI",false)};foreach(var row in rows) Console.WriteLine($"{row.Name}: {(row.Observed ? "PASS" : "NOT RUN")}");Console.WriteLine(Array.TrueForAll(rows,r=>r.Observed)?"Ready for next gate":"Release blocked");record Gate(string Name,bool Observed);Expected result (not executed):
Shared rule: PASSAndroid UI: NOT RUNWindows UI: NOT RUNRelease blockedThis is a fictional example of gate aggregation, not a report of actual checks. In practice a PASS needs recorded command and observed result.
Apply the concept
Write a device test matrix for the sample app on Android and Windows. Include offline use, keyboard/screen reader, large text, process restart, and reset.
Use the manual practice and knowledge check. Do not deploy or publish these fixtures.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Workload and device testing — knowledge check
Apply the lesson concepts to the following scenarios.
Which command lists installed workloads without installing one?
Which result establishes actual native screen reader behavior?
Should a fixture request location permission when it only edits synthetic notes?
What should an unavailable target test be marked?
What is required before using a personal signing key or publishing?