Repository navigation
[Testing] Android shell renderer lane - #39427
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 39427Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 39427" |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
There was a problem hiding this comment.
Expert Review — 0 findings
Reviewed commit b8e34b8.
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@Ahamed-Ali — new AI review results are available based on commit
b8e34b8.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ⚠️ SKIPPED
No tests were detected in this PR.
Recommendation: Add tests to verify the fix using the write-tests-agent.
📋 Pre-Flight — Context & Validation
Pre-Flight Context
PR snapshot: #39427 is an open draft targeting net11.0 (3f6af9762db18e6b251ec953e34ec0db9bfb1f7c) from ahamed-ali-android-shell-renderer-lane (b8e34b8d9a2b6bd4bbb84a314801ebeded3a93ff). The submitted change contains 7 files, +146/−6 across two commits. No submitted reviews were present. Comments show Azure Pipelines runs were requested and started, but completion/results are unknown. No linked issue or original report was surfaced in the PR body, commit metadata, or comments, so the originating reproduction, user impact, and acceptance criteria remain unknown.
Reported problem
The PR description reports that Android Shell UI tests currently exercise the modern ShellHandler, leaving the compatibility ShellRenderer path without a separate execution lane. It proposes running the existing Shell category twice against the same prebuilt CoreCLR HostApp artifact, selecting the renderer at runtime rather than producing another app build.
The documentation added by the PR further asserts that Android Mono is unsupported for the branch’s .NET 11 target (NETSDK1242 when UseMonoRuntime=true), making a separate Mono lane unsuitable. The exact expanded HostApp target framework is indirect through $(MauiSamplePlatforms) and was not independently resolved here, so that runtime assertion still requires validation.
Changed files and mechanism
| File | Submitted mechanism |
|---|---|
docs/UITesting-Guide.md |
Documents Handler and Renderer lanes, CoreCLR/Mono constraints, argument propagation, logcat identification, local renderer invocation, and reuse of Android snapshot baselines. |
eng/pipelines/common/ui-tests.yml |
Adds android_ui_tests_shell_renderer, depending on build_ui_tests_coreclr; iterates eligible Android projects/API levels, filters to Shell, passes ShellRenderer, and publishes renderer snapshot diffs. The template’s default Android API is 30, though callers may override it. |
eng/devices/android.cake |
Reads the Cake argument or inherited TEST_CONFIGURATION_ARGS environment variable and exports it for the test process. |
src/Controls/tests/TestCases.HostApp/MauiProgram.cs |
Under #if ANDROID, replaces the implicit Shell registration with a factory that creates either compatibility ShellRenderer or modern ShellHandler, then logs the selected type under logcat tag MauiUITests. This registration applies to every Shell created by the Android HostApp, not only tests categorized as Shell. |
src/Controls/tests/TestCases.HostApp/Platforms/Android/MainActivity.cs |
Reads the TEST_CONFIGURATION_ARGS intent extra before base.OnCreate; an exact case-insensitive ShellRenderer value sets a process-static selection flag. The activity is SingleTask and registered as com.microsoft.maui.uitests.MainActivity. |
src/TestUtils/src/UITest.Appium/AppiumAndroidApp.cs |
For configuration-bearing Android runs, disables Appium auto-launch and explicitly invokes UiAutomator2 mobile: startActivity with the configuration as a string extra. Initial creation requests a forced restart. Without configuration arguments, it retains Driver.ActivateApp. |
src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs |
Routes Android launch/foreground activation through the new helper and changes crash recovery to preserve launch configuration. Its ADB fallback uses am start with the extra when configured, otherwise retaining the launcher monkey fallback. |
The unchanged pipeline template already converts testConfigurationArgs into --TEST_CONFIGURATION_ARGS, and the shared UI-test fixture places the resulting environment value into Appium’s TestConfigurationArgs dictionary. The PR therefore fills the Android-specific transport from that dictionary to an activity intent. The renderer stage sets runtimeVariant: "CoreCLR", causing ui-tests-steps.yml to download ui-tests-samples-coreclr.
For the HostApp, the launch component constructed by the Appium helper is consistent with the observed project metadata: ApplicationId is com.microsoft.maui.uitests, and MainActivity is registered under that package-qualified name. Because AppiumAndroidApp is shared infrastructure, compatibility with any other Android test application that supplies configuration arguments is not established by that HostApp match.
Platform-sensitive paths
- The intended functional change is Android-specific: Android Cake execution, an Android pipeline stage,
#if ANDROIDhandler registration, activity intent handling, and UiAutomator2 activation. AppiumLifecycleActionsis shared cross-platform code, but the new activation branches are selected only forAppiumAndroidApp; existing iOS-specific launch handling remains separate.- Runs with no configuration value follow the previous Android
Driver.ActivateApppath, but the explicit Android Shell factory still becomes the default registration and should be checked for parity with the prior implicit registration. - Every Android run carrying any
TEST_CONFIGURATION_ARGSvalue—not onlyShellRenderer—takes the newautoLaunch=falseandstartActivitypath. MainActivityusesLaunchMode.SingleTask. A later start of an existing activity can be delivered throughOnNewIntent, while the submitted code updates its static flag only inOnCreate. The initial configured launch requests a forced restart and a constant lane value is expected, but relaunch/reuse behavior remains a validation point.- The configuration is represented as one opaque string and renderer selection requires that string to equal
ShellRenderer; behavior if future lanes need multiple composable options is unknown. - The new stage uses the normal Android snapshot data while labeling collected results as
Android Shell Renderer; whether every Shell test is compatible with those baselines is unverified.
Required later validation
Testing is specifically required on Android:
- Confirm template expansion creates the renderer jobs for the intended projects and effective API levels, downloads the shared CoreCLR artifact, runs only the
Shellcategory, and publishes test and snapshot artifacts. - Establish runtime identity in both lanes:
ShellRenderermust be logged and used when configured, while an omitted/unset argument must log and useShellHandler. - Exercise cold startup, ordinary launch, background/foreground relaunch, and crash recovery, verifying that the intent extra survives each applicable path and that fallback ADB launching addresses the actual activity.
- Verify the pinned Appium client and UiAutomator2 driver accept the submitted
mobile: startActivitypayload shape, extras encoding, flags,wait, andstopoptions. - Confirm existing Android runs without arguments retain prior launch behavior and that any existing Android configurations with non-Shell values are not regressed by
autoLaunch=false. - Check that explicitly registering the default
ShellHandlerpreserves expected handler lifetime, dependency resolution, and behavior for Android HostApp tests outside theShellcategory. - Confirm existing Android snapshot baselines are appropriate for both implementations and that renderer failures cannot be hidden by artifact naming or snapshot collection behavior.
- Validate the documentation’s .NET 11/Mono statement, local command, inherited-environment guidance, and claim that no separate app build is needed.
Validation state and uncertainties
The supplied Gate result is
Remaining unknowns include the original issue and acceptance criteria, completed CI outcomes, effective pipeline callers/project matrix, coverage represented by the existing Shell category, behavior when SingleTask receives a changed or removed extra through OnNewIntent, compatibility of the hard-coded .MainActivity convention with other consumers of the shared Appium helper, and whether renderer selection remains correct through every lifecycle recovery path. This is context gathering, not an exhaustive review or comparative conclusion.
🔬 Code Review — Deep Analysis
Code Review — PR #39427
Independent Assessment
What this changes:
This PR adds an Android-specific UI-test lane that runs Shell category tests with TEST_CONFIGURATION_ARGS=ShellRenderer, then plumbs that value from pipeline → Cake environment → UITest config → Appium Android launch → HostApp MainActivity intent parsing → MauiProgram Shell handler factory selection (ShellRenderer vs ShellHandler).
Inferred motivation:
Exercise compatibility ShellRenderer behavior in CI without producing a second Android app build artifact, while reusing the existing CoreCLR HostApp artifact.
Reconciliation with PR Narrative
Author claims:
Adds a dedicated Android ShellRenderer lane and runtime selection path, including launch/foreground/crash-recovery propagation and docs.
Agreement/disagreement:
Agreement. Submitted code and pipeline changes match those claims in the immutable diff (eng/pipelines/common/ui-tests.yml, eng/devices/android.cake, AppiumAndroidApp.cs, AppiumLifecycleActions.cs, MainActivity.cs, MauiProgram.cs, docs/UITesting-Guide.md). No conflicting behavior was found in submitted lines.
Prior Review Reconciliation
No prior ❌ Error findings found (no submitted reviews or inline review comments at review time).
Blast Radius Assessment
- Runs for all instances: Partially yes — Android UITest HostApp always uses explicit
handlers.AddHandler<Shell>(...); shared Appium Android launch helper changes apply to Android runs whenTEST_CONFIGURATION_ARGSis set. - Startup impact: Yes — startup launch path changed for configured Android runs (
autoLaunch=false+ explicitmobile: startActivity/ADB restart path). - Static/shared state: Yes —
MainActivity.UseShellRendereris process-static and read by Shell handler factory.
CI Status
- Required-check result: undetermined (GitHub CLI unauthenticated in this environment; anonymous PR surfaces show pipelines were queued but no terminal pass/fail evidence was available here).
- Classification: undetermined
- Action taken: capped confidence and verdict (per rule: no LGTM with pending/undetermined CI and Gate skipped).
Findings
⚠️ Warning — Validation coverage is currently undetermined for this submission
Gate is explicitly SKIPPED — no tests detected, and required-check status could not be conclusively resolved in this environment. Because this PR changes Android startup/lifecycle launch plumbing and pipeline fanout, merge safety cannot be raised to approval confidence without completed lane evidence.
No concrete file:line functional defect was validated in submitted modified lines at this pass; inline findings file remains empty ([]).
Failure-Mode Probing
- If code runs on pages not using new feature:
Runtime Shell selection still routes toShellHandlerby default when noShellRendererarg is present (MainActivity.UseShellRendererfalse path). - Handler disconnect/reconnect / foreground transitions:
Android foregrounding for configured runs now callsActivateApp()(which includesmobile: startActivitywith extras) rather than genericDriver.ActivateApp, preserving config intent through relaunch paths. - Null/empty configuration input:
GetTestConfigurationArgsnull/empty path falls back to existingDriver.ActivateApp(appId)behavior. - Crash recovery path:
On Android crash recovery, relaunch now prefers shared launch logic and falls back toadb am start ... --es TEST_CONFIGURATION_ARGS ...when configured, otherwise existingmonkeyfallback. - Static-state stale risk (
UseShellRenderer):
Selection is static and set inOnCreate; current pipeline design uses a constant lane argument and forced restart on initial configured launch, so no concrete stale-state defect was confirmed in submitted scenarios.
External Output Contract
Not applicable. This PR does not add/modify regex/string classification of external tool output semantics (it propagates launch configuration input rather than classifying producer text output).
Verdict: NEEDS_DISCUSSION
Confidence: low
Summary: The submitted implementation is coherent and internally consistent for the intended Android ShellRenderer lane. I did not validate a concrete actionable code defect on modified lines, so inline findings are empty. However, because Gate is skipped and CI required-check outcomes are undetermined in this run, approval-level confidence is not justified; this remains discussion/validation-gated rather than LGTM.
PR-plus-reviewer refinement threshold
Does this review produce a concrete actionable pr-plus-reviewer refinement? No.
Reason: No validated file:line behavioral defect was proven in submitted modified lines under available evidence; the only blocker is evidence/coverage state (Gate skipped + undetermined CI), which is process validation rather than a code-line correction.
🛠️ Try-Fix — Analysis & Comparison
Alternative generation: not requested
Evidence-first mode intentionally omits routine Try-Fix attempts. This is not a failed
attempt, a completed alternative search, or evidence that alternatives have no value.
The expert review may still produce one evidence-backed PR refinement.
📝 PR Finalize — Recommended Title & Description
Assessment: ✏️ Recommend updating — the title is vague and does not follow the platform/component formula, while the description inaccurately implies configured sessions use Appium auto-launch instead of disabling it before an explicit mobile: startActivity.
Recommended title
[Android] UI Tests: Add ShellRenderer test lane
Recommended description
### Description of Change
This pull request adds a dedicated Android UI-test stage that runs the existing `Shell` category with the compatibility `ShellRenderer`, while the default Android lane continues to use `ShellHandler`. Both lanes depend on `build_ui_tests_coreclr` and reuse the same `ui-tests-samples-coreclr` HostApp artifact, so Shell implementation selection happens at runtime without a separate app build.
**Android UI Test Pipeline and Configuration Enhancements:**
* Adds the `android_ui_tests_shell_renderer` stage for eligible Android projects and API levels. The stage filters to the `Shell` category, passes `testConfigurationArgs: "ShellRenderer"`, uses the CoreCLR runtime variant, and publishes separately named Android Shell Renderer snapshot-diff artifacts.
* Updates `eng/devices/android.cake` to accept `TEST_CONFIGURATION_ARGS` from either the Cake argument or the inherited environment variable and expose it to the UI-test process.
* Updates `docs/UITesting-Guide.md` to document the Shell Handler and Shell Renderer lanes, their shared CoreCLR artifact, the .NET 11 Android/Mono constraint, configuration propagation, logcat identification, local renderer invocation, and reuse of the existing Android snapshot baselines.
**Dynamic Shell Implementation Selection:**
* Updates Android `MainActivity` to read the `TEST_CONFIGURATION_ARGS` intent extra before `base.OnCreate`. An exact, case-insensitive `ShellRenderer` value selects the compatibility renderer; an omitted or different value retains the default handler.
* Registers an Android Shell handler factory in `MauiProgram.cs` that creates either `Microsoft.Maui.Controls.Handlers.Compatibility.ShellRenderer` or `Microsoft.Maui.Controls.Handlers.ShellHandler` from that selection and logs the chosen implementation under the `MauiUITests` logcat tag.
**Appium Android Test Infrastructure Improvements:**
* When configuration arguments are present, disables Appium `autoLaunch` and explicitly starts `${appId}.MainActivity` with `mobile: startActivity`, carrying `TEST_CONFIGURATION_ARGS` as an Android intent extra. Runs without configuration arguments retain the existing `Driver.ActivateApp` path.
* Uses the same configuration-aware launch helper for initial startup, ordinary launch, foregrounding, and crash recovery. Initial configured startup requests a forced restart, and crash recovery preserves the extra in its ADB `am start` fallback.
### Platform Notes
The runtime selection and new pipeline stage are Android-specific. The shared lifecycle code changes branch through `AppiumAndroidApp`; existing iOS, Mac Catalyst, and Windows launch handling remains separate.
### Testing
No standalone automated test file is added. The new Android ShellRenderer pipeline stage is the end-to-end validation surface for the existing `Shell` UI-test category.
### Issues Fixed
N/A — this change adds Android test-infrastructure coverage.
🏁 Report — Final Recommendation
⚠️ Final Recommendation: REQUEST CHANGES
Phase Status
| Phase | Status | Notes |
|---|---|---|
| Pre-Flight | ✅ COMPLETE | Trusted read-only context captured for submitted HEAD |
| Expert Review | 0 errors, 1 validation warning, 0 inline findings | |
| Gate | No tests detected in this PR; approval is not permitted without validation evidence | |
| Try-Fix | Not requested | Evidence-first mode intentionally omitted alternative generation |
| Refinement | Not generated | No concrete actionable defect or unresolved mechanism met the evidence threshold |
| Report | ✅ COMPLETE | Raw PR assessed as the sole real candidate |
Code Review and Candidate Comparison
Alternative generation: not requested. This is an intentional evidence-first omission, not a failed or exhausted alternative search.
| Rank | Candidate | Expert assessment | Validation | Disposition |
|---|---|---|---|---|
| 1 | pr |
The submitted Android ShellRenderer lane and configuration transport are internally coherent; no concrete modified-line defect was established. | Gate skipped and required-check outcomes remain undetermined. | Sole real candidate, but not demonstrated merge-ready. |
No pr-plus-reviewer candidate was implemented because the expert review found only a validation-evidence gap, not a source-backed defect suitable for a surgical patch. No try-fix-* candidates exist.
Selected Fix: PR — it is the only implemented candidate and no evidence-backed refinement was justified. Selection does not override the skipped Gate or the expert NEEDS_DISCUSSION verdict.
Summary
The submitted fix adds a dedicated Android ShellRenderer UI-test lane and carries its runtime selection from the pipeline through Cake and Appium into the HostApp. The expert review found no concrete functional error in the submitted lines, but Gate detected no tests and completed Android/required-check evidence was unavailable. Because both the startup/lifecycle plumbing and new pipeline fanout remain unvalidated in this review, the raw PR cannot be approved.
Root Cause
The existing Android Shell UI-test path exercised the default ShellHandler only. There was no separate lane or launch-configuration transport that could reuse the CoreCLR HostApp while selecting the compatibility ShellRenderer before Shell creation.
Fix Quality
The implementation is cohesive: the new stage filters the Shell category, forwards ShellRenderer as TEST_CONFIGURATION_ARGS, explicitly launches configured Android sessions with the intent extra, preserves it across foregrounding and crash recovery, and selects/logs the Shell implementation in the HostApp. However, the required evidence is incomplete. Approval requires completed Android evidence for both handler selections, configured cold start/relaunch/crash recovery, the no-argument path, and the new lane's test and snapshot publication behavior; missing evidence must not be treated as a pass.
📱 UI Tests — Button,Label,Layout
Detected UI test categories: Button,Label,Layout
[!WARNING]
No UI test results were produced for the detected categories. The trusted gate was
skipped before build/test verification, so it does not prove that the PR build is healthy.
The deep UI stage also returned no results; inspect the independent CI checks and retry the
review if those categories still need coverage.
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🔵 Needs a closer look
Shared Android startup and recovery paths lack runtime validation, and configuration switching retains an unresolved correctness issue.
1 open issue
What changed in this PR
Adds an Android Shell Renderer UI-test lane alongside the default Shell Handler lane, reusing the same HostApp build.
Changes:
- Runs Shell Renderer coverage in separate
Shell1andShell2jobs. - Passes configuration through Cake and Appium to select the Shell implementation at runtime.
- Adds configuration-specific test skips and documents local execution.
| File | Description |
|---|---|
src/TestUtils/src/UITest.Appium/AppiumAndroidApp.cs |
Adds configuration-aware Android activation. |
src/TestUtils/src/UITest.Appium/Actions/AppiumLifecycleActions.cs |
Preserves configuration during launch and recovery. |
src/Controls/tests/TestCases.Shared.Tests/UtilExtensions.cs |
Adds Handler- and Renderer-specific skip helpers. |
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32419.cs |
Skips a known Renderer-only failure. |
src/Controls/tests/TestCases.HostApp/Platforms/Android/MainActivity.cs |
Reads Shell selection from the launch intent. |
src/Controls/tests/TestCases.HostApp/MauiProgram.cs |
Selects and logs the Shell implementation. |
eng/pipelines/common/ui-tests.yml |
Adds the sharded Android Renderer stage. |
eng/devices/android.cake |
Forwards test configuration to the test process. |
docs/UITesting-Guide.md |
Documents lanes, local execution, and skip helpers. |
Review effort: Balanced
| var args = GetTestConfigurationArgs(Config); | ||
| if (string.IsNullOrEmpty(args)) | ||
| { | ||
| Driver.ActivateApp(appId); |
kubaflo
left a comment
There was a problem hiding this comment.
Looks like tests are failing
Reuse the common CoreCLR app build for separate Shell Handler and Renderer execution lanes. Pass renderer selection through runtime launch arguments and preserve it across app relaunches. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep the Android Shell UI-test lane change focused on runtime coverage without the additional Pester configuration checks. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep Handler coverage enabled while the Renderer layout issue is tracked in #39461. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Centralize Handler-only and Renderer-only test exclusions and document their usage. Keep the RTL menu test excluded only from Renderer coverage while #39461 is open. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Run Shell1 and Shell2 in separate Renderer matrix jobs, matching the main Handler lane while reusing the shared CoreCLR app artifact. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
5fb5b64 to
a57a0c9
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Tests Failure Analysis
🧪 CI Analysis — click to expand📊 maui-prNo failures found. 🧪 maui-pr-devicetests
🧪 maui-pr-uitests
🧭 Follow-up — actions and refreshNext action: Restore complete results/upload diagnostics and compare unresolved cases on base with identical runtime, handler and test selection; prioritize Renderer versus Handler startup/relaunch evidence.
|

Description of Change
This pull request introduces a new Android UI test pipeline stage for running Shell tests using the Shell Renderer instead of the default Shell Handler, and adds support for passing custom configuration arguments through the test infrastructure. The changes enable dynamic selection between Shell Handler and Shell Renderer at runtime, improve test reliability by ensuring the correct app launch configuration, and document the new workflow.
Android UI Test Pipeline and Configuration Enhancements:
android_ui_tests_shell_rendererpipeline stage to run the Shell UI test category using the Shell Renderer, with the appropriate test configuration argument passed through the build and test system. [1] [2]docs/UITesting-Guide.md) to explain the new Shell Handler and Shell Renderer test lanes, the configuration argument mechanism, and how to run the renderer configuration locally.Dynamic Shell Implementation Selection:
MainActivityandMauiProgram.csso that the Shell implementation (Handler or Renderer) is selected at runtime based on theTEST_CONFIGURATION_ARGSintent extra, which is set by the test infrastructure. The selected implementation is logged to logcat for traceability. [1] [2]Appium Android Test Infrastructure Improvements:
AppiumAndroidAppto support activating the app with custom intent extras (e.g.,TEST_CONFIGURATION_ARGS), and to use theautoLaunchAppium option when configuration arguments are present to ensure proper startup. This logic is used consistently for app launch, foregrounding, and crash recovery. [1] [2] [3] [4] [5]These changes collectively enable more flexible and robust Android UI test configurations, allowing the test pipeline to exercise both Shell Handler and Shell Renderer implementations with minimal duplication and clear traceability.