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/java.md
Java Extension
Language-specific guidance for Java test generation.
Rule #1: Investigate the Repo First
Before writing any test or running any command, read:
Existing tests — find
*Test.java/*Tests.java/*IT.java(integration) files and copy their style (JUnit version, assertion library, mock library, lifecycle methods)Build file —
pom.xml(Maven),build.gradle/build.gradle.kts(Gradle),BUILD/BUILD.bazel(Bazel)Java version —
<maven.compiler.release>,sourceCompatibility, ortoolchainsblockWrapper scripts — always prefer
./mvnwor./gradlewover a system-installed Maven/Gradle so you match the project's pinned version
Use whatever framework the repo already uses (JUnit 4, JUnit 5/Jupiter, TestNG). Do not migrate to a different framework as a side effect of writing tests.
Build Tool Detection
| Indicator | Build tool | Default test command |
|---|---|---|
pom.xml | Maven | ./mvnw test |
build.gradle / build.gradle.kts | Gradle | ./gradlew test |
settings.gradle* with include 'subproject' | Gradle multi-project | ./gradlew :subproject:test |
BUILD / BUILD.bazel | Bazel | bazel test //path/to:test |
If both pom.xml and build.gradle exist, pick the one used by CI.
Build Commands
| Scope | Maven | Gradle |
|---|---|---|
| Compile main + test | ./mvnw test-compile | ./gradlew testClasses |
| Compile only | ./mvnw compile | ./gradlew classes |
| Full build | ./mvnw verify | ./gradlew build |
| Skip tests during build | ./mvnw -DskipTests package | ./gradlew assemble |
Use
-q(Maven) /--console=plain(Gradle) to reduce output noiseFor Gradle, prefer
--no-daemononly in CI; locally the daemon makes incremental builds far faster
Test Commands
| Scope | Maven | Gradle |
|---|---|---|
| All unit tests | ./mvnw test | ./gradlew test |
| Single class | ./mvnw test -Dtest=MyClassTest | ./gradlew test --tests MyClassTest |
| Single method | ./mvnw test -Dtest=MyClassTest#myMethod | ./gradlew test --tests MyClassTest.myMethod |
| Tag filter (JUnit 5) | ./mvnw test -Dgroups=fast | ./gradlew test -PincludeTags=fast (if configured) or --tests |
| Integration tests | ./mvnw verify -DskipUnitTests (with failsafe-plugin) | ./gradlew integrationTest (if registered) |
Surefireruns unit tests (*Test.java);Failsaferuns integration tests (*IT.java) — do not put long integration tests under SurefireGradle's
--testsaccepts wildcards:--tests "*MyMethod*"Use
--rerun-tasks(Gradle) or-DforkCount=...(Surefire) only when troubleshooting cache issues
Lint Command
Use the repo's existing lint task first. Otherwise check for:
Checkstyle (
checkstyle.xml,<plugin>checkstyle</plugin>) →./mvnw checkstyle:checkor./gradlew checkstyleMainSpotless (
spotlessblock / plugin) →./mvnw spotless:applyor./gradlew spotlessApplyErrorProne / NullAway → integrated into compilation; run a normal build
google-java-format / palantir-java-format → use the repo's configured formatter
Never disable existing checks in the test files you generate.
Project Layout and Imports
Maven/Gradle conventional layout:
src/
├── main/java/com/example/foo/Bar.java
├── main/resources/
├── test/java/com/example/foo/BarTest.java
└── test/resources/| Layout | Test placement |
|---|---|
| Standard | src/test/java/<same package as production class>/<ClassName>Test.java |
| Integration tests separated | src/integrationTest/java/... (Gradle) or src/it/java/... (Maven w/ failsafe) |
| Multi-module Maven | Tests live in the same module as the code under test |
Test classes must mirror the production class's package to access package-private members
Avoid wildcard imports unless the repo already uses them — match the explicit imports shown in the templates below
For JUnit 5: import
org.junit.jupiter.api.Test(and other annotations as needed) andorg.junit.jupiter.api.Assertions.assertEqualsetc. as static importsFor JUnit 4: import
org.junit.Test,org.junit.Before, etc., andorg.junit.Assert.assertEqualsetc. as static imports
Test Framework Detection
| Indicator | Framework | Annotations | Assertion style |
|---|---|---|---|
junit-jupiter-* deps | JUnit 5 | @Test, @ParameterizedTest, @BeforeEach, @DisplayName | Assertions.assertEquals(expected, actual) |
junit:junit:4.x | JUnit 4 | @Test, @Before, @RunWith | Assert.assertEquals(expected, actual) |
org.testng:testng | TestNG | @Test(groups=...), @BeforeMethod | Assert.assertEquals(actual, expected) (note reversed order) |
org.assertj:assertj-core | AssertJ (assertions only) | n/a | assertThat(actual).isEqualTo(expected) |
org.hamcrest:hamcrest | Hamcrest matchers | n/a | assertThat(actual, is(equalTo(expected))) |
Argument order matters: JUnit/AssertJ use (expected, actual); TestNG uses (actual, expected). Reversing them produces confusing failure messages.
JUnit 5 Template
package com.example.foo;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
class CalculatorTest {
@Test
@DisplayName("add returns sum of two positive numbers")
void add_positiveNumbers_returnsSum() {
Calculator sut = new Calculator();
assertEquals(5, sut.add(2, 3));
}
@ParameterizedTest
@CsvSource({
"2, 3, 5",
"-1, 1, 0"
})
void add_validInputs_returnsSum(int a, int b, int expected) {
assertEquals(expected, new Calculator().add(a, b));
}
@Test
void divide_byZero_throws() {
Calculator sut = new Calculator();
assertThrows(ArithmeticException.class, () -> sut.divide(1, 0));
}
}Common Errors
| Error | Fix |
|---|---|
package X does not exist | Add the dependency to pom.xml / build.gradle; run ./mvnw dependency:resolve or ./gradlew --refresh-dependencies |
cannot find symbol | Verify class name and import path; check that the test source set sees the production source set |
No tests found for given includes (Gradle) | --tests pattern doesn't match; verify the class/method names, that test methods are annotated with @Test, and that the class name matches the test task's include pattern (default **/*Test*.class). For JUnit 4 only, the class must also be public with a public no-arg constructor — JUnit 5 allows package-private classes and methods |
Test class should have exactly one public zero-argument constructor (JUnit 4) | Remove constructors with parameters; use @Before for setup |
org.junit.runners.model.InvalidTestClassError (JUnit 4) | Class is missing public, has wrong constructor, or method signature is wrong |
Mixing org.junit.Test (4) and org.junit.jupiter.api.Test (5) | Pick one framework per test class — imports must match the framework annotation |
java.lang.NoClassDefFoundError at runtime | Test runtime classpath is missing a transitive dep; add it to testRuntimeOnly (Gradle) or <scope>test</scope> (Maven) |
UnsupportedClassVersionError | JDK used to run tests is older than the JDK used to compile; align toolchains |
Mockito cannot mock final class | Use Mockito's inline mock maker — Mockito 5+ uses it by default; for Mockito 3.x/4.x add the mockito-inline artifact (replaces mockito-core). Or switch to MockK for Kotlin. mockito-subclass does not mock final classes |
WrongTypeOfReturnValue (Mockito) | The stubbed method returns a different type than the mock was set up for — check return type signatures |
Mocking Rules
Use whatever the repo already uses: Mockito (most common), EasyMock, JMockit, or hand-written fakes
For JUnit 5 + Mockito, use
@ExtendWith(MockitoExtension.class)with@Mock/@InjectMocksfieldsFor JUnit 4 + Mockito, use
@RunWith(MockitoJUnitRunner.class)orMockitoAnnotations.openMocks(this)in@BeforeUse
when(mock.method(...)).thenReturn(...)for stubs andverify(mock).method(...)for interactionsUse
ArgumentCaptorto assert on complex argument values rather than over-specifying matchersPrefer constructor injection so production code stays testable without
@InjectMocksIf a test needs more than 3 mocks, flag it as a design smell
Spring Boot
If the repo uses Spring Boot:
@SpringBootTestloads the full context — slow; use only when neededSlice tests are faster:
@WebMvcTest,@DataJpaTest,@JsonTestUse
@MockBean(Spring) only inside Spring tests; in plain unit tests use@MockUse
@Testcontainersfor real-DB integration tests if the repo already has it on the classpath
Dependency Installation (Last Resort)
Only add dependencies after investigation confirms they are missing.
Maven (pom.xml):
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>Gradle (build.gradle.kts):
testImplementation("org.junit.jupiter:junit-jupiter:5.10.2")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")If the repo uses BOMs (<dependencyManagement> or Gradle platforms), reuse them — don't pin a different version than the BOM publishes.
Skip Coverage Tools
Do not configure or run coverage tools (JaCoCo, Cobertura, OpenClover). 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