Snapshot Testing - cprima-forks/uipath-ai-skills GitHub Wiki

Snapshot Testing

The test suite has three distinct layers with different coverage scopes.

test_generator_snapshots.py — Structural Stability

Generates XAML from the same fixed specs used by test_generator_lint_integration.py, normalises UUIDs to sequential placeholders (UUID_1, UUID_2, ...), and compares the output character-for-character against stored golden files in assets/generator-snapshots/.

What it validates: Any structural change in generator output — added/removed attributes, changed element ordering, modified child structure — causes a test failure. This catches unintentional regressions when refactoring generator code.

What it does not validate:

  • Whether the output is accepted by Studio or uipath pack
  • Whether attributes are valid for a given package version
  • Whether {x:Null} entries are actually required or just inherited verbosity
  • Whether the generated project produces correct automation behaviour

Usage:

python3 scripts/test_generator_snapshots.py           # run tests
python3 scripts/test_generator_snapshots.py --update  # regenerate golden files after intentional changes
python3 scripts/test_generator_snapshots.py --verbose # show diffs on failure

run_lint_tests.py — Lint Rule Coverage

Runs 81 test cases against the 71 lint rules. Each test case is a bad_*.xaml file in assets/lint-test-cases/ expected to produce a specific lint finding. One good_browser_workflow.xaml is expected to pass clean.

What it validates: That the lint rules fire correctly on known-bad patterns and do not false-positive on known-good XAML.

What it does not validate: Generator output — lint tests use hand-crafted XAML, not generator output.

regression_test.py — Golden Template Integrity

18 tests verifying that the golden template files in assets/ (REFramework, sequences, samples) remain well-formed and lint-clean. Guards against accidental corruption of the corpus assets.

The Gap Between Layers

The three layers together give confidence that:

  • Generators produce consistent output (snapshots)
  • Lint rules fire correctly (lint tests)
  • Template assets are intact (regression)

None of the three layers answers: does Studio accept this XAML for the targeted package versions?

That question requires either:

The snapshot golden files were generated by running the generators and committing the output — they were never validated by opening them in Studio. They lock the output to whatever the generators produced at the time the snapshots were created.