create-recorded-test
Skill887 starsChanged 29 days agoMITView on GitHub
Generate a new recorded integration test
In this repository22 other files it gives its agents.
- AGENTS.mdAGENTS.md
- eng/tools/generate_api/AGENTS.mdAGENTS.md
- samples/AGENTS.mdAGENTS.md
- sdk/core/AGENTS.mdAGENTS.md
- sdk/cosmos/AGENTS.mdAGENTS.md
- sdk/cosmos/azure_data_cosmos_emulator/AGENTS.mdAGENTS.md
- sdk/cosmos/docs/AGENTS.mdAGENTS.md
- agentic-workflowsSkill
- analyze-codeSkill
- check-spellingSkill
- create-crateSkill
- create-hotfixSkill
- create-perf-testSkill
- document-cratesSkill
- export-apiSkill
- lint-markdownSkill
- prepare-releaseSkill
- review-doc-commentsSkill
- update-emitterSkill
- update-rustSkill
- cosmos-design-structSkill
- cosmos-pre-commit-validationSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
If PowerShell is not installed, stop and ask the user to install it first using PowerShell installation instructions.
- Very specific: line 35
Use the signature async fn ${input:testName}(ctx: TestContext) -> Result<()>.
- Distinctive: line 36
Start each test with:
- Very specific: line 41
Use sdk/keyvault/azure_security_keyvault_secrets/tests/secret_client.rs as the example for function signatures, TestContext, and required …
- Distinctive: line 43
Prefer asserting on returned models or observable state instead of only checking success.
- Distinctive: line 54
Run playback to make sure tests were properly recorded:
- Very specific: line 60
After recording and playback succeeds, publish updated recordings only if test-proxy is already installed and available:
- Distinctive: line 68
Remove provisioned test resources using the full script path when they are no longer needed:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 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
Generate a new recorded integration test
You will generate one or more recorded integration tests under the sdk/{service-directory}/{crate-name}/tests directory in ${input:testFile:test_file}.rs where:
{repo-root}is the root directory containingCargo.toml.{service-directory}is the directory name under sdk for the current ${file} e.g.,keyvault.{crate-name}is the crate directory name undersdk/{service-directory}for the current ${file} e.g.,azure_security_keyvault_secrets.
Set up
These instructions only need to be done once. If changes described are already present, do not make the changes again.
- Recorded tests must always be integration tests under the
sdk/{service-directory}/{crate-name}/testsdirectory. Do not add recorded tests tosrc/,examples/, orREADME.md. - If PowerShell is not installed, stop and ask the user to install it first using PowerShell installation instructions.
Provision test resources using the full script path:
{repo-root}/eng/common/TestResources/New-TestResources.ps1 -ServiceDirectory {service-directory}- To run recorded tests, rely on the existing test infrastructure. Test Proxy is acquired automatically for test runs when needed, but not for
test-proxy push -a sdk/{service-directory}/assets.json. - For manual Test Proxy usage or asset publishing, see CONTRIBUTING.md and the Test Proxy documentation.
Adding a new recorded test
For each new recorded test:
- In
sdk/{service-directory}/{crate-name}/tests/${input:testFile}.rs, add or update async integration tests attributed with#[recorded::test]. - Use the signature
async fn ${input:testName}(ctx: TestContext) -> Result<()>. - Start each test with:
let recording = ctx.recording();let mut options = {Client}Options::default();recording.instrument(&mut options.client_options);
- Construct clients with
recording.var("{ENV_VAR}", None).as_str(),recording.credential(), andSome(options). - Use sdk/keyvault/azure_security_keyvault_secrets/tests/secret_client.rs as the example for function signatures,
TestContext, and requiredClientOptionsinstrumentation. - Generate one test per client method or scenario the user wants to cover. If multiple methods share setup and belong together, keep them in the same integration test file as separate
#[recorded::test]functions. - Prefer asserting on returned models or observable state instead of only checking success.
- Reuse existing crate patterns for imports, helper types, resource naming, and environment variables.
Recording and playback
Record or update sessions against live resources:
AZURE_TEST_MODE=record cargo test -p {crate-name} --test ${input:testFile}Run playback to make sure tests were properly recorded:
cargo test -p {crate-name} --test ${input:testFile}After recording and playback succeeds, publish updated recordings only if
test-proxyis already installed and available:test-proxy push -a sdk/{service-directory}/assets.json
Tear down
Remove provisioned test resources using the full script path when they are no longer needed:
{repo-root}/eng/common/TestResources/Remove-TestResources.ps1 -ServiceDirectory {service-directory}
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.

