Fix data-driven AI tests failing when TestPermissions is not Disabled#8438
Merged
Conversation
The data-driven test framework reads the "Test Input" table from a subscriber to OnBeforeTestMethodRun (codeunit 130460 "Test Input"). The platform raises that event inside the test method's TestPermissions scope. When a test declares a TestPermissions value other than Disabled, the platform overrides the effective permissions and the IndirectRead on table "Test Input" fails: Sorry, the current permissions prevented the action. (TableData 130452 Test Input IndirectRead: Test Runner) The user permissions have been overridden by the TestPermissions property. Because the permission execution context is overridden by TestPermissions, the codeunit's own Permissions property is not honored during that window, so the read cannot succeed there. Load the test input earlier, while still running under full permissions: the AI Test Toolkit input handler already has a pre-permission hook (OnBeforeRunTestMethodLine, raised before the test runner is invoked). It now pre-loads the input into the single-instance "Test Input" globals via the new PreloadTestInput method, so the later read inside the restricted scope is a no-op. Fixes AB#636024 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
nikolakukrika
previously approved these changes
Jun 4, 2026
darjoo
previously approved these changes
Jun 4, 2026
Contributor
Author
|
@copilot Can you look at darjoos comment to follow standard? |
Contributor
Fixed in e64f55d by converting the |
darjoo
approved these changes
Jun 4, 2026
gggdttt
approved these changes
Jun 4, 2026
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
Data-driven tests run by the AI Test Suite Runner fail when the test method declares a
TestPermissionsvalue other thanDisabled.The data-driven test framework reads the
Test Inputtable from a subscriber toOnBeforeTestMethodRun(codeunit 130460Test Input). The platform raises that event inside the test method'sTestPermissionsscope, so the effective permissions are overridden and theIndirectReadon tableTest Inputfails:Because the permission execution context is overridden by
TestPermissions, the codeunit's ownPermissionsproperty is not honored in that window, so the read cannot succeed there.Work Item(s)
Fixes AB#636024
Fix
Load the test input earlier, while still running under full permissions. The AI Test Toolkit input handler already has a pre-permission hook (
OnBeforeRunTestMethodLine, raised before the test runner codeunit is invoked). It now pre-loads the input into the single-instanceTest Inputglobals via a newPreloadTestInputmethod, so the later read inside the restrictedTestPermissionsscope becomes a no-op (the existing early-exit guard returns before theGet).Test Input(130460): extracted the load logic into a sharedLoadTestInputhelper and exposedPreloadTestInput(GroupCode, InputCode).AIT Test Run Input Handler(149045): callsPreloadTestInputfrom its existingOnBeforeRunTestMethodLinesubscriber.🤖 Generated with Claude Code