Skip to content

Add test stability mode to the test tool#9296

Draft
nikolakukrika wants to merge 1 commit into
mainfrom
nikolakukrika/test-stability-mode
Draft

Add test stability mode to the test tool#9296
nikolakukrika wants to merge 1 commit into
mainfrom
nikolakukrika/test-stability-mode

Conversation

@nikolakukrika

@nikolakukrika nikolakukrika commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a test stability mode to the test tool. It re-runs an existing AL test suite under one or more presets (individually or combined) to surface flaky, order-dependent and data-dependent tests, and captures the outcome of every test method (pass and fail) — including the preset combination, seed, WorkDate, execution order, error message and call stack — so failures are easy to reproduce and troubleshoot.

Runnable from both the UI (AL Test Tool) and PowerShell / CI (Command Line Test Tool).

Presets

Configured as +-separated CODE tokens (one string = one combination):

Token Effect
BASELINE No preset
SEED-<n> Force pseudo-random seed n in Any and Library - Random (even when a test hardcodes its seed)
WORKDATEFUTURE-<n>YEAR / -<n>MONTH Shift WorkDate into the future
ONEBYONE Run each test method in isolation
REVERSE-CODEUNITS / REVERSE-METHODS Reverse execution order

Example: SEED-2+WORKDATEFUTURE-1YEAR+REVERSE-METHODS. A default, editable set is created per suite.

What's included

  • New Stability folder in the Test Runner module (minimal-change, Code-Coverage-style): single-instance context, preset parser, Stability Run Configuration + Stability Run Result tables, event subscribers (OnBeforeTestMethodRun/OnAfterTestMethodRun), orchestrator, two pages, and page extensions on the AL Test Tool and Command Line Test Tool.
  • Seed override lives in the Any app (new Any Seed Override codeunit); Any and Library - Random consult it, so SEED-<n> is effective even for tests that hardcode a seed. The Test Runner app takes a dependency on Any.
  • PowerShell entry point build/scripts/StabilityTests/RunStabilityTestsInBcContainer.ps1 drives a run and writes a JSON artifact (shape mirrors unstable-tests.json).
  • README.md documenting the feature, tokens and grammar.

Order & WorkDate handling

Execution order is realized purely by Line No. numbering when cloning the suite (no Test Runner change). The WorkDate offset is re-applied before every test method and coordinates with ALTestRunner Reset Environment (which restores WorkDate after each codeunit).

Notes

  • Complementary to the existing Test Tolerance feature (this discovers instability; tolerance tolerates known-unstable tests).
  • Wiring stability mode into a GitHub workflow is intentionally deferred to a follow-up PR.
  • Draft: opened for early review; CI provides the authoritative AL build.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Re-runs an existing AL test suite under configurable presets (random seed
variation, WorkDate shift, one-by-one isolation and reverse execution order),
individually or combined, and captures every test outcome to surface flaky and
order/data-dependent tests.

- New Stability folder in the Test Runner module: context, preset parser,
  configuration + result tables, event subscribers, orchestrator, UI pages and
  page extensions on the AL Test Tool and Command Line Test Tool.
- Seed override lives in the Any app (new "Any Seed Override" codeunit); Any and
  Library - Random honor it so SEED-<n> works even when tests hardcode a seed.
  Test Runner takes a dependency on Any for this.
- PowerShell entry point build/scripts/StabilityTests/RunStabilityTestsInBcContainer.ps1
  drives the run and writes a JSON artifact.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added Build: scripts & configs Build scripts and configuration files AL: Tools labels Jul 9, 2026
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Could not find a linked ADO work item. Please link one by using the pattern 'AB#' followed by the relevant work item number. You may use the 'Fixes' keyword to automatically resolve the work item when the pull request is merged. E.g. 'Fixes AB#1234'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: Tools Build: scripts & configs Build scripts and configuration files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant