Skip to content

Add testing knowledge: UI handlers, table relations, asserterror, fixtures (P1+P2)#62

Open
JesperSchulz wants to merge 2 commits into
mainfrom
jesperschulz-testing-knowledge-p1-p2
Open

Add testing knowledge: UI handlers, table relations, asserterror, fixtures (P1+P2)#62
JesperSchulz wants to merge 2 commits into
mainfrom
jesperschulz-testing-knowledge-p1-p2

Conversation

@JesperSchulz

@JesperSchulz JesperSchulz commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

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).

Originally drafted in community/knowledge/testing/; relocated to the microsoft/ layer per maintainer request (pure git mv, no content changes).

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-recordsValidate/Insert(true) enforces TableRelation; 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 via LibraryVariableStorage.Enqueue, assert in the body, finish with AssertEmpty. 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 — bare asserterror passes on any error; pair it with Assert.ExpectedError + Assert.ExpectedErrorCode to verify the specific failure. LLMs treat asserterror as sufficient.
  • use-library-codeunits-for-test-fixturesLibrarySales/LibraryInventory/… create valid records (number series, mandatory fields, relations); hand-rolled Init/Insert skips required setup and rots as the schema evolves. LLMs invent Init/Insert fixtures.

Articles mirror the format/frontmatter of the existing microsoft/knowledge/testing/transactionmodel-attribute-governs-test-transactions article (6-field frontmatter, domain: testing, bc-version: [all], technologies: [al], countries: [w1], application-area: [all]; code in sibling .al files only). Each .md is 24–26 lines (well under the 100-line cap).

Validator outputs

$ python .github/scripts/validate_frontmatter.py --root .
Validator: 0 error(s), 0 warning(s)        (exit 0)

$ pwsh .github/scripts/Test-KnowledgeIndex.ps1 -Root .
BCQuality index: 198 article(s). ...
Knowledge-index check PASSED: 198 articles, deterministic, full coverage, selection inputs intact.   (exit 0)

$ pwsh ./tools/Build-KnowledgeIndex.ps1
BCQuality index: 198 article(s). Index: .../knowledge-index.json
198        (exit 0)

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.

Jesper Schulz-Wedde and others added 2 commits June 29, 2026 16:10
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant