* Complete AL review knowledge readiness Fill telemetry and Query coverage, strengthen thin review domains, correct audited content defects, and add deterministic cheap-model evaluation and reference-integrity safeguards. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9825b012-e653-496a-9310-c1f4b6f8ac27 * Generalize review fixture discovery Derive smoke cases from the leaf, domain, and paired-sample conventions so new leaves require no scoring-contract changes. Keep only exceptional selection/context overrides and fail when retrieval metadata cannot rank the selected article. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9825b012-e653-496a-9310-c1f4b6f8ac27 * Preserve published field IDs in sample Keep the existing Email and Contact Email field IDs unchanged, clarify that the sample represents an independent baseline, and use a local breaking-change rule for the generic smoke evaluation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9825b012-e653-496a-9310-c1f4b6f8ac27 * Clarify published field identity rules State explicitly that a published field keeps its ID, name, and type while a replacement is added as a separate field under an unused ID. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9825b012-e653-496a-9310-c1f4b6f8ac27 * Align field obsoletion sample baselines Use Email field ID 3 as the shared baseline so the bad example demonstrates a same-ID rename while the good example retains the original field and adds a separate replacement. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9825b012-e653-496a-9310-c1f4b6f8ac27 --------- Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com>
1.6 KiB
| bc-version | domain | keywords | technologies | countries | application-area | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
testing |
|
|
|
|
Permission tests must actually lower the execution context
Description
TestPermissions describes how a test runner should establish the permission context; the enum value does not itself assign the business permission set being tested. Restrictive is the default and starts from D365 Full Access, requiring the test to lower permissions. Disabled leaves the test running as SUPER. A test that expects access to be denied while still running with either broad context can pass or fail for the wrong reason and never exercise the intended boundary.
Best Practice
Use TestPermissions::Restrictive for a permission-sensitive test and lower the current test user with the test framework's "Permissions Mock" or "Library - Lower Permissions" before invoking the protected operation. Assign the exact permission set the scenario claims to test and restore or stop the mock afterward. Use Disabled only for suites that do not assert permission behavior.
See sample: permission-tests-must-lower-the-execution-context.good.al.
Anti Pattern
Setting TestPermissions = Disabled or leaving the effective D365 Full Access context in place while asserting that a limited user is denied, or adding a [TestPermissions(...)] attribute without any runner/test-library code that applies the intended permission set.
See sample: permission-tests-must-lower-the-execution-context.bad.al.