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://mp-staging.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/go.md
Go Extension
Language-specific guidance for Go test generation.
Rule #1: Investigate the Repo First
Before writing any test or running any command, read:
Existing tests — find
*_test.gofiles and copy their style (table-driven layout, helper usage, assertion library, build tags)go.mod/go.sum— module path, Go version, dependencies (e.g.testify,gomock,mockery)Build/CI scripts —
Makefile,magefile.go,Taskfile.yml,.github/workflows/*.ymlgo.work— if present, you are in a workspace; tests for a module must run from that module's directory or use-C(Go 1.20+)
Use whatever assertion style and test layout the repo already uses. Do not introduce testify if the repo uses the standard library only.
Toolchain Detection
| Indicator | Meaning |
|---|---|
go.mod go 1.x directive | Minimum Go version — match it locally with go version |
go.work at the root | Multi-module workspace; commands resolve dependent modules from sibling directories |
vendor/ directory | Vendored deps; many commands implicitly add -mod=vendor |
tools.go with //go:build tools | Tool versions pinned in go.mod (e.g. mockgen); install with go install from the listed paths |
Build Commands
| Scope | Command |
|---|---|
| Compile a package | go build ./path/to/pkg |
| Vet (static analysis) | go vet ./... |
| Compile tests without running | go test -count=1 -run=^$ ./path/to/pkg |
| Whole module | go build ./... |
go build ./... is the closest thing to a "does it compile" gate. It does not exercise test files — use go test -run=^$ to type-check tests as well.
Test Commands
| Scope | Command |
|---|---|
| All tests in a package | go test ./path/to/pkg |
| All tests in module | go test ./... |
| Single test | go test -run '^TestName$' ./path/to/pkg |
| Subtest | go test -run '^TestName$/^subname$' ./path/to/pkg |
| Verbose | go test -v ./path/to/pkg |
| Race detector | go test -race ./... |
| Disable cache | go test -count=1 ./... |
| Short mode | go test -short ./... |
-runarguments are regular expressions anchored with^...$; without anchors the pattern matches as a substringgo test -count=1is the canonical way to bypass the test result cache; never use a fake-count=2or environment hacks-racesignificantly slows tests and requires CGO — only enable if the repo's CI does
Lint Command
Use the repo's lint script first (make lint, task lint). Otherwise detect from .golangci.yml/.golangci.yaml:
.golangci.ymlpresent →golangci-lint run ./...No config →
gofmt -w .andgo vet ./...goimportsconfig / pre-commit hook →goimports -w path/to/file.go
Never disable existing linters in the test files you generate.
Project Layout and Imports
Go uses package paths derived from the module path in go.mod.
| Scenario | Test placement | Package declaration |
|---|---|---|
| Internal-only test (white-box) | foo_test.go next to foo.go | package foo (same as production) |
| External-only test (black-box) | foo_test.go next to foo.go | package foo_test (forces use of public API) |
| Integration / build-tag gated | foo_integration_test.go | Add //go:build integration at top |
Test files must end with
_test.go— the toolchain ignores other namesA package directory may contain both
package fooandpackage foo_testtest files simultaneouslyHelpers shared across tests in one package go in
helpers_test.go— do not export them; put them in the_testpackage only if integration tests in another package need themImports use the full module path:
import "github.com/org/module/pkg"— copy the exact module path fromgo.mod
Test Function Signatures
| Kind | Signature |
|---|---|
| Standard test | func TestThing(t *testing.T) |
| Subtests | t.Run("name", func(t *testing.T) { ... }) |
| Benchmark | func BenchmarkThing(b *testing.B) |
| Example (godoc) | func ExampleThing() with // Output: comment |
| Fuzz (Go 1.18+) | func FuzzThing(f *testing.F) |
| Per-package setup | func TestMain(m *testing.M) — call m.Run() and os.Exit with its code |
Use table-driven tests when generating multiple cases for the same behavior — this is idiomatic Go and matches what most repos already use:
func TestAdd(t *testing.T) {
tests := []struct {
name string
a, b int
want int
}{
{"positives", 2, 3, 5},
{"negatives", -1, -1, -2},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := Add(tt.a, tt.b); got != tt.want {
t.Errorf("Add(%d,%d) = %d, want %d", tt.a, tt.b, got, tt.want)
}
})
}
}When iterating with t.Run over a loop variable on Go < 1.22, capture it with tt := tt to avoid closure-over-loop-variable bugs.
Common Errors
| Error | Fix |
|---|---|
package X is not in std / cannot find module providing package X | Add the import to go.mod: go get path/to/module@version, then go mod tidy |
import cycle not allowed in test | Move shared helpers to a separate package, or switch to a _test package for black-box tests |
undefined: X in _test package | The symbol is unexported; either use package foo (white-box) or export it intentionally |
t.Parallel called multiple times | Each subtest can call t.Parallel() once; do not call it twice in the same test |
panic: test executed panic(nil) or runtime.Goexit | A goroutine called t.Fatal outside the test goroutine; only the main test goroutine may call Fatal/FailNow |
flag provided but not defined: -X | Flags registered in init() of test files must use flag.NewFlagSet carefully; place test-only flags in TestMain |
go: cannot find main module | Run inside the module directory (where go.mod lives), or use -C path (Go 1.20+) |
build constraints exclude all Go files in... | Build tags filtered out every file — match the repo's tag with -tags=integration etc. |
missing go.sum entry for module | Run go mod download or go mod tidy |
| Race detector reports data race | Fix the race; do not silence it. CGO must be enabled |
Mocking Rules
Go has no reflection-based mocking framework that's universally adopted. Pick what the repo already uses:
Interfaces + hand-written fakes (most idiomatic) — define a small interface in the consumer package and pass a struct that implements it
gomock/mockgen— if the repo has//go:generate mockgen ...directives ormocks/directories, regenerate viago generate ./...rather than editing generated filestestify/mock— used in many repos; instantiate withnew(MockX)and chain.On("Method", ...).Return(...)httptest— for HTTP clients/servers; spin uphttptest.NewServerinstead of mockinghttp.Client
Always prefer dependency injection over global function patching. If a test needs more than 3 mocks, flag it as a design smell.
Concurrency and Cleanup
Use
t.Cleanup(func() { ... })instead of deferring in test bodies — runs even ift.FailNowfiresUse
t.TempDir()for temp files — auto-cleaned at test endUse
t.Context()(Go 1.24+) or pass an explicitcontext.Background()— never call real network or filesystem APIs without one in long-running tests
Dependency Installation (Last Resort)
Only install packages after investigation confirms they are missing:
go get github.com/stretchr/testify@latest
go mod tidyRun go mod tidy after any go get to keep go.sum consistent. Never edit go.sum by hand.
Skip Coverage Tools
Do not configure or run coverage tools (-cover, -coverprofile, go tool cover). 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).
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download code-testing-extensions.zip