feat(TA0002): report actions invoked on a directly opened part test page - #549
Merged
Merged
Conversation
Reports Invoke(), Enabled() and Visible() on an action of a TestPage variable whose target page has PageType = ListPart or CardPart. A part page opened directly renders no actions at runtime. The working pattern is to reach the action through the part control of the hosting page. Not reported: actions through a part control, field access and TestPage built-ins, built-in OK/Cancel/Yes/No/View/Edit actions, HeadlinePart, TestRequestPage, obsolete test code. EnumProvider: NavTypeKind.TestPage, PageTypeKind.CardPart. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Purpose, design decisions, deliberate non-reports and the SDK facts (TestPage receiver type, TestActionAccess versus TestPartAccess, the TestAction built-in class) that the analyzer relies on. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…e 13.0 AL 12 rejects a pageextension whose target page is declared in the same module (AL0334), so the fixture cannot compile on those SDK versions. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…order Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ction access alone The test runner still executes an obsolete test method or codeunit, so skipping obsolete code hid a real runtime failure. The built-in class and method-kind checks were implied by the ITestActionAccess receiver: its type is TestAction, whose only members are Invoke, Enabled and Visible. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Arthurvdv
added a commit
to ALCops/alcops.dev
that referenced
this pull request
Sep 13, 2026
Documents TestAutomationCop rule TA0002 InvokeActionOnPartTestPage: Invoke(), Enabled() and Visible() on an action of a TestPage variable whose page is a ListPart or CardPart fail at runtime because a part opened directly renders no actions; the action must be reached through the part control of the hosting page. The page covers the triggering conditions, the exceptions (field access, TestPage built-ins, built-in system actions, TestRequestPage) and a suppression example, and the TestAutomationCop index gains the TA0002 row. Related: ALCops/Analyzers#549 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Why
A test that opens a
ListPartorCardPartpage directly through its ownTestPagevariable and then invokes an action on it fails at runtime with "The action with ID = xxx is not found on the page." A part page opened on its own renders no actions (same in the client), so the test framework cannot find them. The working pattern is to reach the action through the part control of the hosting page (HostPage.SubPagePart.MyAction.Invoke()). Discussion: #455What
New TestAutomationCop rule TA0002
InvokeActionOnPartTestPage(Warning,Usage, enabled by default).Reports
Invoke(),Enabled()andVisible()on an action of aTestPagevariable whose target page hasPageType = ListPartorCardPart.Message (3 placeholders): Action '{0}' cannot be invoked on page '{1}' opened directly because its PageType is {2}; invoke it through the part control of the hosting page instead.
EnumProvider additions:
NavTypeKind.TestPage,PageTypeKind.CardPart(both exist at the ns2.0 12.0 floor).Deliberate non-reports
MainPage.SubPagePart.MyAction.Invoke()) — receiver isTestPart, notTestPageOpenView/OpenEdit/OpenNewand otherTestPagebuilt-insOK/Cancel/Yes/No/View/Edit—SubPage.OK().Invoke()has an invocation as the outerInstance, not anITestActionAccessHeadlinePartand every otherPageTypenot confirmed to failTestRequestPage—RequestPageTypeSymbolisIPageBaseTypeSymbolbut notIPageTypeSymbolObsolete test code is not exempt: the test runner still executes an obsolete test method or codeunit, so the failure is real. The call is identified by its
ITestActionAccessreceiver alone; the built-inTestActionclass has exactlyInvoke,EnabledandVisible.Test notes
19 tests total: 9 HasDiagnostic, 10 NoDiagnostic — all pass.
Regression-first evidence (stub analyzer with no registration):
There is no issue reported for TA0002 at [...]RequestPageHandlerparameter syntax)Verification:
dotnet build ALCops.sln— 0 errorsdotnet test src/ALCops.TestAutomationCop.Test/ --filter "FullyQualifiedName~InvokeActionOnPartTestPage"— 19 passeddotnet test src/ALCops.Common.Test/— 159 passeddotnet format ALCops.sln --verify-no-changes— exit 0Docs companion: ALCops/alcops.dev#187
Resolves #455
🤖 Generated with Claude Code