RunTests action - #2343
Open
spetersenms wants to merge 34 commits into
Open
Conversation
Introduces a new opt-in RunTests action that moves normal test execution (testFolders) out of the RunPipeline action. When useSeparateTestAction is true, RunPipeline compiles, publishes and installs apps and keeps the build container alive, but skips normal tests; the RunTests action then runs those tests against the same container and produces TestResults.xml. BCPT and page scripting tests are unchanged. Behavior is unchanged when the setting is false. Includes the new setting (ReadSettings, settings.schema.json, settings.md), the RunPipeline keep-alive guard, template _BuildALGoProject wiring, release notes and Pester tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The separate RunTests action now runs normal tests through Microsoft's headless al runtests (AlTool) CLI by default instead of BcContainerHelper. The runner resolves the kept-alive container's connection settings host-side from the container name, installs the AL developer tools as a dotnet global tool, runs the test codeunits batched (with an isolated fallback/rerun pass) and emits the same TestResults.xml (JUnit) schema, so downstream test result analysis is unchanged. No RunPipeline change is required. BcContainerHelper remains available via a RunTestsInBcContainer override script, which fully replaces the built-in AlTool runner (this is how, for example, BCApps supplies its own runner and how Legacy test-type tests are handled). The AlTool runner does not run Legacy test types or tests that require UI/client-callback interaction; this is documented as a known limitation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The official released al runtests tool does not support --testplan, so the batch-first path in AlToolTestRunner hard-set �llPassed=false whenever the batch failed to connect and never reset it, making every run falsely report FAILED. Remove the batching path entirely and run each test codeunit in its own �l runtests <codeunitId> --testmethods --raw invocation, with the existing rerun-on-failure pass. �llPassed now derives solely from real per-method outcomes via Add-JUnitTestSuite. - Delete Invoke-AlBatchRunTests, ConvertFrom-AlBatchOutput, ConvertTo-AlTestPlanJson and their Export-ModuleMember entries. - Update README and RELEASENOTES to per-codeunit wording. - Drop the two batch-specific unit test contexts. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in RunTests action that executes normal tests separately against the RunPipeline container.
Changes:
- Adds separate test-action workflow wiring and settings.
- Implements AlTool execution, JUnit output, overrides, and diagnostics.
- Adds documentation and comprehensive Pester coverage.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
Tests/RunTests.Test.ps1 |
Tests test selection and execution. |
Tests/RunTests.Action.Test.ps1 |
Tests action wiring and credentials. |
Tests/AnalyzeTests.Test.ps1 |
Tests generated JUnit analysis. |
Tests/AlToolTestRunner.Test.ps1 |
Tests AlTool runner behavior. |
Templates/Per Tenant Extension/.github/workflows/_BuildALGoProject.yaml |
Adds RunTests workflow step. |
Templates/AppSource App/.github/workflows/_BuildALGoProject.yaml |
Adds RunTests workflow step. |
Scenarios/settings.md |
Documents the new setting. |
RELEASENOTES.md |
Announces separate test execution. |
Actions/RunTests/RunTests.psm1 |
Selects and runs test apps. |
Actions/RunTests/RunTests.ps1 |
Implements the action entry point. |
Actions/RunTests/README.md |
Documents the action. |
Actions/RunTests/AlToolTestRunner.psm1 |
Implements AlTool and JUnit integration. |
Actions/RunTests/action.yaml |
Defines the composite action. |
Actions/RunPipeline/RunPipeline.ps1 |
Keeps eligible containers alive. |
Actions/RunPipeline/README.md |
Documents handoff variables. |
Actions/AnalyzeTests/TestResultAnalyzer.ps1 |
Distinguishes failures from skipped tests. |
Actions/.Modules/settings.schema.json |
Adds setting schema metadata. |
Actions/.Modules/ReadSettings.psm1 |
Adds the default setting. |
Suppressed comments (2)
Actions/RunPipeline/RunPipeline.ps1:559
-keepContainerdisables Run-AlPipeline's normal teardown, but the new RunTests action and both workflows never invokeRemove-BcContainer. Every opt-in build therefore leaves the BC container running; if RunPipeline fails, RunTests is skipped and cannot perform cleanup either. Add an always-run cleanup path after event-log capture for both build and test failure paths, otherwise persistent self-hosted runners will accumulate containers.
-keepContainer:$runTestsInSeparateAction `
Actions/RunTests/RunTests.ps1:88
- Convert settings recursively here. Without
-recurse, nested settings remain PSCustomObjects rather than the hashtables expected by the settings-processing helpers, making the separate action behave differently for nested settings.
$settings = $env:Settings | ConvertFrom-Json | ConvertTo-HashTable
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…. Using -recurse flag for ConvertTo-HashTable
…tersen/separateTestAction
Collaborator
📦 Release Notes Update RequiredAL-Go v9.2 has been released, and your changes to RELEASENOTES.md appear to be under that version's section. Action needed: Please move your release notes entry to above the Example## Changes to be included in the next release
- Your change here ✅
## v9.2
- Already released changesThank you for contributing to AL-Go! 🙏 |
spetersenms
requested review from
Alexander Holstrup (aholstrup1) and
Maria Zhelezova (mazhelez)
August 27, 2026 12:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the preview
useSeparateTestActionsetting, defaulting tofalse, which moves normal test execution fromRunPipelineinto a newRunTestsaction usingal runtests.Flow
RunPipelinebuilds and publishes the apps, creates the container, and keeps it alive.RunTests.RunTestsselects the test apps, executes them with AlTool, and produces JUnit results for the existing analysis step.Notes
RunPipeline.runTestsInAllInstalledTestAppsuses the existinginstallTestAppsJsonhandoff rather than discovering every installed server app.testTypesetting supportsUnitTest,IntegrationTest, andUncategorized.RunTestsInBcContaineroverride can still replace the built-in AlTool runner.✅ Checklist