Now inviting automation leaders: publish your playbook as a skill, under your own name. Publish yours →
Automation Skills
All skills/Uipath core/Xaml-testing
Reference · Uipath core

Xaml-testing

Part of Uipath core. Install the skill and your agent reads this page when it needs the depth.

Testing Activities

Assertions, mocking, comparison, and test-data-queue activities from UiPath.Testing.Activities. Namespace prefix: uta: (clr-namespace UiPath.Testing.Activities).

Contents

When to use

These activities power UiPath's Test Manager / Test Suite workflows. Reach for them when:

For production automation logic, prefer:

Testing activities are about verifying and simulating, not driving the business process.

Assertions

VerifyExpression

Asserts a single boolean expression. Failure stops or continues based on ContinueOnFailure.

{
  "gen": "verifyexpression",
  "args": {
    "expression": "intRecords > 0",
    "result_variable": "boolRecordsExist",
    "continue_on_failure": "True"
  }
}

result_variable receives True/False so downstream activities can branch on the outcome even when ContinueOnFailure="True".

VerifyExpressionWithOperator

Asserts a comparison between two expressions using a named operator (Equal, NotEqual, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual). Clearer diagnostics than VerifyExpression when the assertion fails because the message names both operands.

VerifyRange

Asserts that a numeric expression falls inside [MinValue, MaxValue].

VerifyControlAttribute

Asserts that a UI control's attribute matches an expected value. Combines UIAutomation element targeting with an equality check. Useful inside test cases that interact with real apps.

Mocking

MockActivity

Wraps a child activity and substitutes a deterministic output for testing. At runtime in Test Manager, the wrapped activity does NOT execute — the mock's MockOutput is assigned directly to Result.

Use when:

Do NOT leave MockActivity in production runtime paths — it silently skips the wrapped activity outside Test Manager context.

Test data queues

Test Manager stores structured test inputs in Test Data Queues (distinct from production Orchestrator queues). These activities feed synthetic or curated data rows into a test case.

Use these when the test case is data-driven — i.e., "run this test once per row in the queue." Test Manager orchestrates the iteration.

File and text comparison

CompareText

Asserts string equality, optionally ignoring whitespace, case, or specific characters. Richer than a VB = comparison for human-readable diff output when it fails.

ComparePdfDocuments

Diffs two PDF files, optionally excluding regions (by coordinates or by matching a comparison rule). Returns details of each mismatched region. Use when comparing "before/after" PDF artifacts — receipts, invoices, generated reports.

CreateComparisonRule

Builds a reusable comparison rule (ignored regions, tolerance thresholds) for feeding into ComparePdfDocuments. Define once per test suite, reuse across cases.

AttachDocument

Attaches a file to the current test result for later review. Useful when ComparePdfDocuments fails — attach both the expected and actual PDF so a reviewer can diff visually.

Synthetic data

Deterministic random generators for test inputs. Each accepts a Seed for reproducibility — same seed produces the same value every run, so failing tests stay failing until fixed.

Always seed when the test is expected to be deterministic. An unseeded RandomNumber makes the test non-reproducible — the next run may pass where the previous failed.

Common pitfalls

Pitfall Symptom Fix
MockActivity left in production workflow activity is silently skipped Scope mocks to Tests/ .xaml files only; never InvokeWorkflowFile a mock-bearing test from prod Main
Unseeded random values in assertion flaky tests Pass a fixed Seed to Random* activities
ContinueOnFailure="False" inside a loop one failure aborts all iterations Set ContinueOnFailure="True" when iterating, aggregate failures, assert in summary after the loop
Confusing Test Data Queue with production queue test data leaks into prod queue Test data activities target Test Manager queues; production uses AddQueueItem/GetQueueItem (see xaml-orchestrator.md)
ComparePdfDocuments with no tolerance / excluded regions every run fails on timestamps/dynamic content Use CreateComparisonRule to ignore date/time regions
VerifyExpression expression using = instead of == on non-VB context unexpected assignment semantics Expressions are VB; use = for equality. For C#, use == (specify via language setting)
Testing activities in a workflow that's never invoked by Test Manager activities never execute Test activities only run under Test Manager execution context — put them in Tests/ workflows, not in Main.xaml

Template selection

No golden templates for testing activities yet. Emission is via the data-driven gen_from_annotation engine using entries in references/annotations/testing.json. Reference harvested shapes under references/studio-ground-truth/UiPath.Testing.Activities/25.10/.

Publish your skill

Copy this prompt into Claude Code, Codex or any agent. It walks you through your first skill in about 20 minutes, with you as the author.

Click to copy.