Files
UA-.NETStandard/tools/Opc.Ua.Lens/DesktopTesting.md
6fe5399510 Add UaLens desktop engineering workspace (#4822)
# Description

Add **UaLens**, an Avalonia desktop engineering workspace for OPC UA
exploration, monitoring, typed editing, administration and guided
companion-specification tasks.

This is a **new draft PR for `pisrapp` against `master`**, replacing
closed, unmerged #4462 without reopening it. The shared prerequisites
(#4801, #4802, #4803, #4804 and #4806) have all merged; their
implementation is no longer part of this PR's delta.

### Scope

- Multi-document workspace with connection, security and identity
controls; browsing, subscriptions, events, alarms, history, writes and
method calls.
- Offline NodeSet2 exploration, typed scalar/array/matrix editing,
certificate/GDS and account/role tools.
- UaLens companion workflows, repository sample launching and the Aspire
AppHost.
- PubSub commissioning and capture/replay integration, plus the
UaLens-facing OpenUSD viewport and rendered Vision workflows.
- UaLens projects, test assemblies, UI assets, guides,
solution/dependency entries, desktop test wiring and delivery workflows.

Head **`6f46c51fcfef275059bbe77ef39c64c19ebc1053`** is one UaLens-only
commit directly above master
**`44a8cb277df450162c29313e2f4c862e7c683752`**. The rebase required no
conflicts. All **967 UaLens file blobs**, the full-index binary patch,
commit-message text and author/co-author attribution are unchanged from
the previously published layer. There is **no implementation delta under
`src/`**. The original history is retained in recovery refs, including
`refs/pr-stack/backups/master20261017/ualens`.

No feature was disabled, and no export/path safeguards, native
acceptance criteria, test assertions or CI gates were weakened. The four
previously recorded blank-line-at-EOF findings in the UaLens dialog
files remain unchanged; they are not reported as newly fixed.

### Validation

Fresh validation ran on the **exact PR head `6f46c51f`**, using the
existing pinned SDK **10.0.401**, normal repository analyzers and
physical/non-linked build outputs:

```powershell
$d = 'D:\git\UA-.NETStandard_master\TestResults\ualens-528-deep-repro\sdk\dotnet.exe'
$b = 'D:\git\UA-.NETStandard_master\TestResults\ua-stack-feedback20261016'
$r = 'C:\Users\mschier\.copilot\session-state\abd33a2e-7139-44e1-9912-6e4451102b4e\files\ualens-new-draft20261017-net10'
$env:DOTNET_ROOT = Split-Path -Parent $d
$env:DOTNET_ROOT_X64 = $env:DOTNET_ROOT
$env:DOTNET_CLI_TELEMETRY_OPTOUT = '1'
$env:PATH = $env:DOTNET_ROOT + [IO.Path]::PathSeparator + $env:PATH

& $d test 'tests\Opc.Ua.Lens.Tests\Opc.Ua.Lens.Tests.csproj' --no-restore --artifacts-path $b -c Release -f net10.0 -p:CustomTestTarget=net10.0 --filter 'TestCategory!=LongRunning&TestCategory!=Stress' --logger 'trx;LogFileName=ualens-new-draft.trx' --results-directory $r --blame-hang --blame-hang-timeout 3m --blame-hang-dump-type none --verbosity minimal
# PASS, exit0: Passed: 4524, Failed: 0, Skipped: 0.
```

The saved TRX contains **4524 Passed and 44 explicit/prerequisite
NotExecuted records** (4568 total). The repository verdict helper
confirms zero failed tests, fixture setup/teardown failures or run-level
errors, without toleration. No compiler/analyzer diagnostics were
emitted. Logs, TRX and `ualens-new-draft20261017-validation.json` retain
this exact-head evidence.

**Not run for this new draft:** the full `UA.slnx` net48/net10 matrix,
fresh coverage, other desktop TFMs, application-desktop/native workflow
suites, NativeAOT, GPU/per-RID/installed-runtime or package-release
qualification. UaLens targets .NET8+; no net48 UaLens execution is
claimed. Remote CI and CodeQL are not yet claimed green. Historical
native diagnostics and successful managed tests are not substitutes for
rendered-frame or release acceptance.

The previous PR and retained session artifacts preserve the full
extraction, review, failed-attempt and diagnostic history. Historical
intermittent CI failures were not silently reclassified as root-cause
fixes; no old diagnostic grants or producer/release operations were
reused for this PR.

## Related Issues

_Reference all GitHub issues this PR addresses. If there is no issue
yet, open one and link it here._

_If this is a relatively large or complex change, a design must have
been discussed in the related tracking issue and signed off (which
becomes the Architectural Decision Record (ADR))._

- References #4461, the existing closed UaLens design/qualification
tracking issue; no new design approval is implied.
- Replaces closed, unmerged #4462 for the remaining UaLens work.
- Builds on merged prerequisites #4801, #4802, #4803, #4804 and #4806;
this PR does not close them.

## Checklist

_Put an `x` in the boxes that apply. You can complete these step by step
after opening the PR._

- [ ] I have signed the
[CLA](https://opcfoundation.org/license/cla/ContributorLicenseAgreementv1.0.pdf)
and read the
[CONTRIBUTING](https://github.com/OPCFoundation/UA-.NETStandard/blob/master/CONTRIBUTING.md)
doc.
- [ ] I have added tests that prove my fix is effective or that my
feature works and increased code coverage.
- [x] I have added all necessary documentation.
- [x] I have verified that my changes do not introduce (new) build or
analyzer warnings.
- [ ] I ran **all** tests locally using the **UA.slnx** solution against
at least .net **framework** and .net **10**, and all passed.
- [ ] I fixed **all** failing and flaky tests in the CI pipelines and
**all** CodeQL warnings.
- [ ] I have addressed **all** PR feedback received.

The test/coverage item remains unchecked because fresh coverage was not
collected. This draft does not claim CLA confirmation, full-matrix
clearance, native qualification or completed review.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Alexander Köpke <alexander.koepke@microsoft.com>
Co-authored-by: Copilot <Copilot@users.noreply.github.com>
2026-10-21 17:18:19 +02:00

3.3 KiB

UaLens desktop tests

See Testing UaLens for the four test assemblies, standard commands, coverage and evidence boundaries.

The assemblies use the centrally pinned NUnit 5 framework and VSTest adapter. Await Assert.ThrowsAsync, Assert.CatchAsync and Assert.DoesNotThrowAsync; otherwise teardown can run before the assertion finishes.

Native desktop prerequisites

Use .NET SDK 10 and PowerShell 7 on an interactive Windows desktop, or Linux with a reachable X11 display and the Avalonia native dependencies. At the minimum 980 by 640 DIP client size, a 200% scale needs at least 1960 by 1280 physical pixels plus window chrome. No headless rendering backend is substituted.

Desktop test assembly

Run the complete application-desktop assembly with NUnit:

dotnet test tests\Opc.Ua.Lens.Desktop.Tests\Opc.Ua.Lens.Desktop.Tests.csproj `
  -c Release -f net10.0 -p:CustomTestTarget=net10.0 `
  --logger trx --results-directory TestResults\lens-desktop `
  -- NUnit.NumberOfTestWorkers=0 RunConfiguration.TreatNoTestsAsError=true

NUnit discovers the cases from the assembly; no second list of test methods is maintained in a script. On Linux, provide a display with Xvfb:

xvfb-run -a -s '-screen 0 1280x1024x24 -nolisten tcp' \
  dotnet test tests/Opc.Ua.Lens.Desktop.Tests/Opc.Ua.Lens.Desktop.Tests.csproj \
    -c Release -f net10.0 -p:CustomTestTarget=net10.0 \
    --logger trx --results-directory TestResults/lens-desktop \
    -- NUnit.NumberOfTestWorkers=0 RunConfiguration.TreatNoTestsAsError=true

The complete Opc.Ua.Lens.Desktop.Tests project also runs the NodeSet and namespace highlighting cases. The opt-in NodeSetImportResponsivenessTests case requires UALENS_NODESET_REPRO_FILE naming a local file and is excluded from ordinary runs.

Workflow tests

The separate workflow assembly exercises editing, administration, monitoring and document lifetimes with injected protocol clients:

dotnet test tests\Opc.Ua.Lens.Workflow.Tests\Opc.Ua.Lens.Workflow.Tests.csproj `
  -c Release -f net10.0 -p:CustomTestTarget=net10.0

The normal matrix schedules both native assemblies on their supported platforms. The artifact workflow runs the desktop and workflow assemblies separately.

Captures and guard checks

The validation/contrast case writes nine verified PNGs and two CSV reports under TestResults/lens-desktop/ux06/<platform>-<native-scale>/ and attaches them to the test result. Captures render the client visual after a dispatcher frame. Color-vision simulations are diagnostics; only normal-source contrast is gated.

Artifact acceptance tests cover markers, nonzero exits, timeouts, stale or corrupt PNGs, uniform frames and unchanged decoded pixels. They use the standard NUnit runner and do not start UaLens or a renderer:

dotnet test tests\Opc.Ua.Lens.Artifacts.Tests\Opc.Ua.Lens.Artifacts.Tests.csproj `
  -c Release -f net10.0 -p:CustomTestTarget=net10.0

The real artifact fixture is [Explicit] and requires a selected published or installed executable. See artifact qualification.

Historical DPI and platform results are recorded in plans/UaLensReview.md. They do not qualify a new source revision or replace physical keyboard and screen-reader checks.