Code Testing Extensions
.NET (Microsoft)OfficialPublished by .NET (Microsoft)
- Skill
- Guidelines
- Software development
- MIT
- Low risk
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
Code Testing Extensions is a non-invocable reference library designed to support automated testing workflows. It provides a structured collection of documentation files covering various programming languages, including .NET, Python, TypeScript, Go, Java, and more. Each entry offers essential guidance on build and test commands, framework-specific patterns, mocking strategies, and common error resolution. Additionally, the catalog includes example files that demonstrate complete testing pipeline cycles, from research and planning to test generation and reporting.
What it does
- Provides language-specific testing guidance for multiple programming environments.
- Lists standard build and test commands for various testing frameworks.
- Offers best practices for mocking, project layout, and framework detection.
- Includes concrete examples of full testing pipeline workflows.
- Serves as a centralized reference for agents to ensure consistent testing standards.
When to use it
- When an agent needs to determine the correct testing commands for a specific language.
- When implementing or debugging a testing pipeline for a new project.
- When guidance on framework-specific mocking or test structure is required.
- When looking for representative examples of a complete test generation cycle.
Advantages
- Ensures consistency across different testing environments.
- Reduces ambiguity by providing standardized commands and patterns.
- Provides both high-level guidance and concrete implementation examples.
- Supports a wide range of modern programming languages and frameworks.
Usage examples
- “Read extensions/python.md to understand the preferred testing patterns for a pytest project.”
- The agent retrieves the Python-specific guidance, identifying the correct test runner commands and mocking strategies to apply.
- “Consult extensions/java-examples.md to see how to structure a JUnit 5 test suite.”
- The agent reviews the provided example to replicate the established project structure and testing conventions for the Java codebase.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/dotnet/code-testing-extensions/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip code-testing-extensions.zip -d .agents/skills
Documentation by .NET (Microsoft)
Code Testing Extensions
This reference-only catalog lists bundled guidance for the code-testing pipeline. Read the matching file directly; do not invoke this catalog as a skill. Resource paths are relative to this catalog, not the project workspace.
Available Extension Files
| File | Language | Contents |
|---|---|---|
| extensions/dotnet.md | .NET (C#/F#/VB) | Build commands, test commands, project reference validation, common CS error codes, MSTest template |
| extensions/python.md | Python | Framework-adaptive test commands (pytest, custom runners), project layout detection, mocking guidelines, common errors |
| extensions/typescript.md | TypeScript/JavaScript | Build/test commands (Jest/Vitest/Mocha), framework detection, mocking, TS-specific considerations |
| extensions/powershell.md | PowerShell | Test commands (Pester v5), module import patterns, discovery/run pitfalls, mocking, common errors |
| extensions/cpp.md | C++ | Testing internals with friend declarations |
| extensions/go.md | Go | go test commands, table-driven tests, integration vs unit layout, mocking via interfaces, common errors |
| extensions/java.md | Java | Maven/Gradle commands, JUnit 4/5 and TestNG detection, Mockito, Spring Boot slices, common errors |
| extensions/rust.md | Rust | cargo test commands, unit vs integration vs doc tests, features, async test harnesses, common errors |
| extensions/ruby.md | Ruby | RSpec and Minitest commands, Bundler usage, Rails specifics, mocking patterns, common errors |
| extensions/swift.md | Swift | SPM and Xcode test commands, XCTest vs Swift Testing, @testable import, async/throws tests, common errors |
| extensions/kotlin.md | Kotlin | Gradle commands, JUnit/Kotest detection, MockK, coroutines test, KMP and Android specifics, common errors |
| extensions/dotnet-examples.md | .NET (C#/F#/VB) | Concrete pipeline examples: sample research output, plan, generated tests, fix cycles, final report |
| extensions/python-examples.md | Python | Concrete pipeline examples (pytest): research, plan, generated test file, fix cycles, final report |
| extensions/typescript-examples.md | TypeScript/JavaScript | Concrete pipeline examples (Vitest, applicable to Jest): research, plan, generated test file, fix cycles, final report |
| extensions/go-examples.md | Go | Concrete pipeline examples (standard testing): research, plan, table-driven test file, fix cycles, final report |
| extensions/java-examples.md | Java | Concrete pipeline examples (JUnit 5 + Mockito on Maven): research, plan, generated test file, fix cycles, final report |
Usage
Read the appropriate base extension before writing test code. Load an
<language>-examples.md file only when the repository has no representative
tests and the base extension does not resolve the needed pattern. Do not load
end-to-end examples for a focused request with established local conventions.
Files
- ATTRIBUTION.mdAdded by AutoGineer857 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md3.7 KiB
- extensions/cpp-examples.md9.1 KiB
- extensions/cpp.md20.1 KiB
- extensions/dotnet-examples.md10.7 KiB
- extensions/dotnet.md10.5 KiB
- extensions/go-examples.md12.4 KiB
- extensions/go.md7.8 KiB
- extensions/java-examples.md11.9 KiB
- extensions/java.md9.7 KiB
- extensions/kotlin-examples.md10.3 KiB
- extensions/kotlin.md11.2 KiB
- extensions/powershell-examples.md9.1 KiB
- extensions/powershell.md12.1 KiB
- extensions/python-examples.md12.1 KiB
- extensions/python.md11.7 KiB
- extensions/ruby-examples.md8.9 KiB
- extensions/ruby.md14.7 KiB
- extensions/rust-examples.md10.6 KiB
- extensions/rust.md8.8 KiB
- extensions/swift.md9.4 KiB
- extensions/typescript-examples.md12.7 KiB
- extensions/typescript.md7.9 KiB
extensions/typescript.md
TypeScript Extension
Language-specific guidance for TypeScript (and JavaScript) test generation.
Rule #1: Investigate the Repo First
Before writing any test or running any command, read:
Existing tests — find
*.test.ts/*.spec.tsfiles and copy their style (imports, describe/it vs test, assertion patterns, mock approach)package.json—scripts.test,devDependencies,typefieldConfig files —
tsconfig.json,jest.config.*,vitest.config.*,eslint.config.*
Use the repo's existing test runner and conventions — do not switch frameworks. If multiple runners are configured, follow whichever scripts.test invokes. Only introduce a framework if the repo has no tests at all.
Package Manager Detection
Detect the package manager from lockfiles and use it consistently for all commands:
| Indicator | Manager | Run script | Execute binary |
|---|---|---|---|
pnpm-lock.yaml | pnpm | pnpm test | pnpm exec <tool> |
yarn.lock | Yarn | yarn test | yarn <tool> |
bun.lockb / bun.lock | Bun | bun test | bunx <tool> |
package-lock.json or none | npm | npm test | npx <tool> |
Use <exec> below as shorthand for the detected exec command.
Build Commands
| Scope | Command |
|---|---|
| Type check | <exec> tsc --noEmit or the repo's typecheck script |
| Build (if configured) | The repo's build script |
Many projects don't need an explicit build step — the test runner handles transpilation.
Test Commands
Detect the runner from devDependencies and scripts.test. Always prefer the repo's test script first.
| Runner | Run once | Filter by file | Filter by name |
|---|---|---|---|
| Jest | <exec> jest | <exec> jest path/to/file | <exec> jest -t "name" |
| Vitest | <exec> vitest run | <exec> vitest run path/to/file | <exec> vitest run -t "name" |
| Mocha | <exec> mocha | (use config or positional args) | <exec> mocha --grep "name" |
Always use
vitest run(not barevitest) — bareviteststarts watch modeNever use
--watch— the agent must not start interactive/watch modeFor Jest:
--bailto stop on first failure,--verbosefor detailMocha
--grepfilters by test name, not file path
Lint Command
Use the repo's lint script first. Otherwise detect from devDependencies and config:
eslint.config.*or.eslintrc.*→<exec> eslint --fix path/to/file.tsprettier→<exec> prettier --write path/to/file.tsbiome.json→<exec> biome check --write path/to/file.ts
Project Layout and Imports
| Layout | Import Style |
|---|---|
Colocated (src/module.test.ts) | import { X } from './module' |
__tests__/ dir | import { X } from '../module' |
Top-level tests/ | import { X } from '../src/module' |
Match existing test imports — copy path style from neighboring tests
If
tsconfig.jsonhaspathsaliases (e.g.,@/), use them in tests tooFor monorepos: import from the package name, not relative cross-package paths
For monorepo workspaces (Nx, Turborepo, Lerna): run tests via the workspace tool (
nx test <project>,turbo test), not from a random package directory
Test File Naming
Match existing convention — check for
.test.tsvs.spec.tsJest/Vitest default:
*.test.ts,*.spec.ts, or files inside__tests__/Place test files to mirror the existing project pattern
Parameterized Test Display Names
Apply Report-safe test names and result validation.
For Jest it.each/test.each, interpolate only a safe label ($Name for object
rows), or use a short behavior label with %# for the case index. Do not use
%p, %s, or $Input/$Expected to render arbitrary data in the title.
Harmless numeric placeholders such as %i remain fine.
For a word counter whose contract treats form-feed as whitespace, keep the real U+000C input but give the case a safe name:
it.each([
{ Name: "form-feed separator", Input: "one\ftwo", Expected: 2 },
{ Name: "space separator", Input: "one two", Expected: 2 },
])("countWords: $Name", ({ Input, Expected }) => {
expect(countWords(Input)).toBe(Expected);
});The escape in Input becomes an actual control character at runtime; the title
does not contain it. Reuse the configured reporter and validate its exported
artifact when required/configured; do not install jest-junit just for this check.
Common Errors
| Error | Fix |
|---|---|
Cannot find module 'X' | Check existing imports for correct paths; verify tsconfig.json paths; check moduleNameMapper (Jest) or resolve.alias (Vitest) |
TS2305: has no exported member | Verify the exact export name from the source file |
TS2345: type not assignable | Match the expected type; use type assertion only for mock objects |
SyntaxError: Unexpected token / Jest encountered an unexpected token | Verify TS transform config (ts-jest, @swc/jest, or Vitest handles natively) |
ReferenceError: describe is not defined | Vitest: import from vitest or set globals: true in config; Jest: ensure tests run under Jest not bare node |
Cannot use import statement outside a module / ERR_REQUIRE_ESM | ESM/CJS mismatch — align runner config with the project's module system (see ESM section); do not blindly set "type": "module" |
ReferenceError: document is not defined | Set test environment: testEnvironment: 'jsdom' (Jest) or environment: 'jsdom' (Vitest) |
jest.mock() ... out-of-scope variables | Keep jest.mock() at top level; don't reference variables declared after the mock call (Jest hoists mocks) |
Cannot find module '@/...' | Mirror the project's alias config in the test runner's module resolution |
Warning: not wrapped in act(...) | Await async UI updates using the repo's existing pattern (waitFor, act) |
ESM vs CommonJS
Check these signals to determine the project's module system:
"type": "module"inpackage.json→ ESM"module": "ESNext"or"NodeNext"intsconfig.json→ ESM output (but not sufficient alone).mjs/.mtsextensions → ESM files
If the test runner fails with ESM errors, align the runner's config with the project's module system. Do not change package.json type field — align the test runner to match whatever the project uses:
Jest:
--experimental-vm-modules+ts-jestwithuseESM: true, or@swc/jestVitest: handles ESM natively
Mocha:
--loader ts-node/esm
Mocking Rules
Prefer dependency injection over module mocking
Use typed mocks:
jest.Mocked<T>,vi.mocked(obj), orPartial<T>withas TJest:
jest.mock()is hoisted — keep at top level, don't close over local variablesVitest:
vi.mock()follows the same hoisting rulesIf a test needs more than 3–4 mocks, flag it as a design smell
Mock reset: rely on
clearMocks/restoreMocksconfig if present; otherwise reset inbeforeEach
Framework-Specific Notes
React/Preact: use
@testing-library/react, wrap with necessary providers (router, query client, theme) matching existing test setupExpress/Koa: use
supertestfor HTTP testing if the repo already uses itNestJS: build testing module with
Test.createTestingModule— don't instantiate controllers directly
Dependency Installation (Last Resort)
Only install packages after investigation confirms they are missing. Use the detected package manager:
<manager> add --save-dev jest ts-jest @types/jest
<manager> add --save-dev vitestNever install test infrastructure that conflicts with what the repo already uses.
Skip Coverage Tools
Do not configure or run coverage tools (istanbul, c8, vitest --coverage). Coverage is measured separately by the evaluation harness.
Requirements and compatibility
Written for: Claude Code
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Claude Code frontmatter, Needs Python
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- .NET (Microsoft)
- Publisher
- .NET (Microsoft) (Official)
- Source
- dotnet/skills · plugins/dotnet-test/skills/code-testing-extensions · commit 96c3d68
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by .NET (Microsoft) or .NET (Microsoft).
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download code-testing-extensions.zip