azd-extension-unit-testing
Skill573 starsChanged 26 days agoMITView on GitHub
Write, update, and statically review feature-aligned Go unit tests for azure.ai.agents, azure.ai.connections, azure.ai.inspector, azure.ai.projects, azure.ai.routines, azure.ai.skills, and azure.ai.toolboxes. USE FOR: unit test cases, regression tests, acceptance-criteria mapping, mock assertions, and unit coverage gaps. Establish expected behavior from requirements, not the implementation alone. DO NOT USE FOR: CLI subprocess tests, recorded HTTP playback, live integration, E2E, CI changes, or skill migration.
In this repository29 other files it gives its agents.
- AGENTS.mdAGENTS.md
- cli/azd/AGENTS.mdAGENTS.md
- cli/azd/extensions/AGENTS.mdAGENTS.md
- cli/azd/extensions/azure.ai.agents/AGENTS.mdAGENTS.md
- cli/azd/extensions/azure.ai.connections/AGENTS.mdAGENTS.md
- cli/azd/extensions/azure.ai.inspector/AGENTS.mdAGENTS.md
- cli/azd/extensions/azure.ai.projects/AGENTS.mdAGENTS.md
- cli/azd/extensions/azure.ai.routines/AGENTS.mdAGENTS.md
- cli/azd/extensions/azure.ai.skills/AGENTS.mdAGENTS.md
- cli/azd/extensions/azure.ai.toolboxes/AGENTS.mdAGENTS.md
- ext/vscode/AGENTS.mdAGENTS.md
- .github/skills/extension-user-contract-review/evals/fixtures/cli/azd/AGENTS.mdAGENTS.md
- ext/vscode/.github/copilot-instructions.mdCopilot instructions
- azd-extension-e2e-testingSkill
- azd-extension-spec-authoringSkill
- azdSkill
- agentic-workflowsSkill
- azd-code-reviewerSkill
- azd-grpc-contractsSkill
- azd-preflightSkill
- changelog-generationSkill
- extension-user-contract-reviewSkill
- foundry-extension-scenario-authoringSkill
- foundry-extension-scenario-pr-regressionSkill
- foundry-extension-scenario-suite-runSkill
- senseiSkill
- tool-version-upgradeSkill
- weekly-demo-videoSkill
- weekly-reportSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. About 0 are common, 23 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈23
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 26
Do not add dependencies, change CI, migrate skills, or modify production behavior unless separately requested.
- Distinctive: line 38
Read the implementation to locate the behavior and test seams, not to derive the expected answer from whatever the implementation currently …
- Distinctive: line 42
If requirements are clear, proceed.
- Distinctive: line 44
If the user asks only for a test plan or review, do not implement tests.
- Distinctive: line 52
Call the relevant production logic in-process.
- Distinctive: line 54
Do not mock the function under test or assert only a value configured on a mock.
- Distinctive: line 55
Do not contact Azure, use developer credentials, create resources, replay HTTP recordings, or launch azd/extension binaries.
- Distinctive: line 57
Use synthetic inputs and existing in-memory fixtures.
- Distinctive: line 60
If the required claim needs a real process or service, report that it belongs to another test level rather than silently expanding this …
- Distinctive: line 65
Use Arrange / Act / Assert and behavior-based test names.
- Distinctive: line 71
Verify meaningful interactions, such as no mutation request after validation fails.
- Distinctive: line 73
Check structured output semantically.
- Distinctive: line 75
When applicable, cover explicit flag conflicts, defaults, tenant selection, redaction, cancellation/timeout decisions, and local state …
- Distinctive: line 78
Use realistic response shapes and make unexpected mock calls fail.
- Distinctive: line 91
Do not share mutable user configuration or depend on test order.
- Distinctive: line 92
Use the repository's temporary-directory and cleanup helpers.
- Distinctive: line 94
Avoid arbitrary sleeps and unbounded retries.
- Distinctive: line 96
Keep secrets and customer data out of fixtures and failure output.
- Distinctive: line 97
Do not weaken assertions, change expected results, or add skips merely to match a product defect.
- Distinctive: line 102
Test authoring: Run the smallest relevant tests using the repository's configured runner.
- Distinctive: line 113
Check module boundaries, build tags, and platform constraints.
- Distinctive: line 115
When reporting coverage, state the tested module, revision, platform, and exclusions.
- Distinctive: line 122
Do not claim owner approval, CI execution, or complete coverage without evidence.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AZD Extension Unit Testing
Purpose and boundaries
Detect feature regressions through focused, deterministic unit tests. Higher coverage is not a substitute for meaningful assertions.
Work only on the requested feature and extension. Read applicable AGENTS.md
and existing tests first. Reuse the module's framework, mocks, and helpers.
Do not add dependencies, change CI, migrate skills, or modify production behavior
unless separately requested. Report defects exposed by a tests-only task.
Review-only tasks, including PR/code reviews, are static-only: inspect code and supplied evidence without editing files, building, running tests, installing tools, or executing PR code. Execution guidance below applies only to test-authoring tasks and never overrides a reviewer's read-only restrictions.
1. Define the expected behavior
- Identify the user goal and its requirement source: acceptance criteria, test plan, issue/specification, documented contract, or existing supported behavior.
- Read the implementation to locate the behavior and test seams, not to derive the expected answer from whatever the implementation currently does.
- State the relevant Given / When / Then: preconditions, action, result, and any forbidden side effects. Keep this brief; no separate plan file is required.
- If requirements are clear, proceed. If a material expectation is missing or conflicts with current behavior, ask for clarification instead of inventing it.
- If the user asks only for a test plan or review, do not implement tests.
Choose cases by impact and the change: success, relevant invalid inputs, boundary conditions, error propagation, and state transitions. Do not generate a full parameter matrix or add tests solely to increase coverage.
2. Keep the test at unit scope
- Call the relevant production logic in-process. Mock or fake external boundaries such as Azure clients, credentials, the clock, or process execution as needed.
- Do not mock the function under test or assert only a value configured on a mock.
- Do not contact Azure, use developer credentials, create resources, replay HTTP recordings, or launch azd/extension binaries.
- Use synthetic inputs and existing in-memory fixtures. Where file behavior requires real files, use isolated temporary directories and describe that boundary; do not claim this proves the installed CLI works.
- If the required claim needs a real process or service, report that it belongs to another test level rather than silently expanding this task.
3. Assert the feature contract
- Use Arrange / Act / Assert and behavior-based test names. Use Go table-driven cases when they improve clarity, not to hide unrelated behaviors in one test.
- Derive expected values independently. Do not use the same production logic for both the actual result and the expected result.
- Assert relevant values, error codes/content, state, and side effects. "No error," "no panic," or nonempty output alone rarely proves a feature.
- Verify meaningful interactions, such as no mutation request after validation fails. Avoid private call-order assertions unless ordering is the contract.
- Check structured output semantically. Require exact text only when exact wording is a supported contract.
- When applicable, cover explicit flag conflicts, defaults, tenant selection, redaction, cancellation/timeout decisions, and local state cleanup. Do not treat these as mandatory cases for unrelated features.
- Use realistic response shapes and make unexpected mock calls fail.
Example contract: Given conflicting inputs to azd ai agent invoke, input
validation returns the defined error and does not call the service client.
Exercise the in-process validation/action; do not deploy an agent for this test.
Confirm the actual command contract before choosing the conflicting inputs.
For AI-authored tests, check whether a plausible wrong result would still pass. A constant result, ignored input, swallowed error, or skipped side effect should be rejected when it violates the selected scenario.
4. Keep tests independent and maintainable
- Do not share mutable user configuration or depend on test order.
- Use the repository's temporary-directory and cleanup helpers. Restore modified process state; do not combine global environment mutation with parallel tests.
- Avoid arbitrary sleeps and unbounded retries. Use fake time or controlled state transitions where timing is part of the behavior.
- Keep secrets and customer data out of fixtures and failure output.
- Do not weaken assertions, change expected results, or add skips merely to match a product defect. Harmless internal refactors should not break tests.
5. Verify or review the evidence
- Test authoring: Run the smallest relevant tests using the repository's configured runner. Record the exact command and outcome. For a bug regression, verify failure on the unfixed behavior and success after the fix when safely feasible; do not disturb unrelated work to obtain this evidence.
- Review only: Inspect assertions, mocks, CI selection, and existing evidence statically. Do not execute code to obtain missing evidence. Assess whether failure-before/success-after evidence was supplied without claiming independent verification. Return only relevant findings in the host reviewer's required format; do not add a separate evidence summary.
- A compile error, missing fixture/tool, or environment failure is not evidence that an assertion detects the intended defect.
- Check module boundaries, build tags, and platform constraints. A local pass does not prove CI selects the test; nested Go modules may need separate runs.
- When reporting coverage, state the tested module, revision, platform, and exclusions. Use it to identify relevant gaps, not to claim functional completeness or average unrelated package percentages.
Test-authoring summary: State the requirement/scenario covered, assertions added, commands run and results, skipped or unverified cases, and whether the CI configuration selects the tests. This summary does not apply to review mode. Do not claim owner approval, CI execution, or complete coverage without evidence.
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

