Add testing knowledge: UI handlers, table relations, asserterror, fixtures (P1+P2)#62
Open
JesperSchulz wants to merge 2 commits into
Open
Add testing knowledge: UI handlers, table relations, asserterror, fixtures (P1+P2)#62JesperSchulz wants to merge 2 commits into
JesperSchulz wants to merge 2 commits into
Conversation
…tures (P1+P2) Six BC-specific testing-domain knowledge articles in community/knowledge/testing/, each with .good.al/.bad.al samples: - ui-calls-require-test-handlers - tablerelation-requires-prerequisite-records - handlers-enqueue-never-assert - handlerfunctions-attribute-must-match-ui-path - asserterror-needs-expectederror-and-code - use-library-codeunits-for-test-fixtures Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Relocates the six P1+P2 testing-domain articles (18 files: .md + .good.al + .bad.al each) from community/knowledge/testing/ to microsoft/knowledge/testing/ per maintainer request. Pure git-mv rename; no content or frontmatter changes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
Summary
Adds six BC-platform-specific testing-domain knowledge articles under
microsoft/knowledge/testing/, each as a trio (<slug>.md+<slug>.good.al+<slug>.bad.al) — 18 files total. Every article clears the README admission test: a modern LLM reviewing or generating BC test code would get the mechanic wrong without it. None drift into generic test-writing advice (AAA, naming, one-assert-per-test).The six articles & admission-test rationale
P1 trio
ui-calls-require-test-handlers— UI calls (Confirm,Message,Page.RunModal,StrMenu,Notification.Send, …) need a registered handler +[HandlerFunctions], or the test aborts with an unhandled-UI runtime error — not an assertion failure. LLMs routinely omit handlers.tablerelation-requires-prerequisite-records—Validate/Insert(true)enforcesTableRelation; fixtures must be built parent-before-child or the test aborts on a relation error. LLMs assemble test data bottom-up.handlers-enqueue-never-assert— handlers run in a separate context; an assertion inside a handler can be swallowed, so the test passes while broken. Capture viaLibraryVariableStorage.Enqueue, assert in the body, finish withAssertEmpty. Non-obvious platform behavior.P2 trio
handlerfunctions-attribute-must-match-ui-path— two-sided rule: a missing handler → unhandled UI; an unused listed handler → "handler function was not executed". Both are runtime failures. LLMs get the bidirectional contract wrong.asserterror-needs-expectederror-and-code— bareasserterrorpasses on any error; pair it withAssert.ExpectedError+Assert.ExpectedErrorCodeto verify the specific failure. LLMs treatasserterroras sufficient.use-library-codeunits-for-test-fixtures—LibrarySales/LibraryInventory/… create valid records (number series, mandatory fields, relations); hand-rolledInit/Insertskips required setup and rots as the schema evolves. LLMs inventInit/Insertfixtures.Articles mirror the format/frontmatter of the existing
microsoft/knowledge/testing/transactionmodel-attribute-governs-test-transactionsarticle (6-field frontmatter,domain: testing,bc-version: [all],technologies: [al],countries: [w1],application-area: [all]; code in sibling.alfiles only). Each.mdis 24–26 lines (well under the 100-line cap).Validator outputs
Article count invariant
Baseline on
main: 192 articles → after adding 6: 198 articles. Delta = +6. (The community→microsoft relocation is a move, so it leaves the count unchanged at 198.)CODEOWNERS note
These files now live under
microsoft/knowledge/testing/, which CODEOWNERS gates with the testing domain experts (@nikolakukrika @ventselartur @pchriste-microsoft-com). The PR therefore auto-requests them and is expected to sit BLOCKED on the 2-approval ruleset until they review. CODEOWNERS was not edited.Do not merge — open for maintainer review.