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/dotnet.md
.NET Extension
Language-specific guidance for .NET (C#/F#/VB) test generation.
Project System Detection
Determine the project system before choosing any command or editing a manifest.
| Signal | Project system | Consequence |
|---|---|---|
Root <Project Sdk="..."> or an Sdk attribute | SDK-style | dotnet build / dotnet test are normally valid; new *.cs files are usually included by glob |
ToolsVersion, Microsoft.Common.props / Microsoft.CSharp.targets imports, explicit <Reference> and <Compile Include> items | Classic non-SDK | Preserve the repository's MSBuild / test-runner commands; every new source or test file must be added to the project |
packages.config beside the project | Classic NuGet dependency management | Preserve packages.config and assembly references; do not run dotnet add package or introduce PackageReference unless the user explicitly requested a migration |
For classic projects, inspect repository scripts, CI configuration, README*, and
AGENTS.md for the authoritative build and test commands. Common commands are
MSBuild.exe followed by vstest.console.exe or MSTest.exe, but the checked-in
command wins. If no compatible runner is installed, report that blocker instead of
migrating the project or claiming dotnet test succeeded.
Build Commands
| Scope | Command |
|---|---|
| SDK-style test project | dotnet build MyProject.Tests.csproj |
| SDK-style solution (final validation) | dotnet build MySolution.sln --no-incremental |
| Classic non-SDK project | Use the repository's existing MSBuild command (often MSBuild.exe MySolution.sln /t:Build) |
Use
--no-restoreif dependencies are already restoredUse
-v:q(quiet) to reduce output noiseAlways use
--no-incrementalfor the final validation build — incremental builds hide errors like CS7036
Test Commands
| Scope | Command |
|---|---|
| SDK-style all tests | dotnet test |
| SDK-style filtered | dotnet test --filter "FullyQualifiedName~ClassName" |
| SDK-style after build | dotnet test --no-build |
| Classic non-SDK | Use the checked-in runner command; commonly vstest.console.exe <test.dll> after MSBuild |
Use
--no-buildif already builtUse
-v:qfor quieter output
Lint Command
dotnet format --include path/to/file.cs
dotnet format MySolution.sln # full solutionProject Reference Validation
Before writing test code, read the test project's .csproj to verify it has <ProjectReference> entries for the assemblies your tests will use. If a reference is missing, add it:
<ItemGroup>
<ProjectReference Include="../SourceProject/SourceProject.csproj" />
</ItemGroup>This prevents CS0234 ("namespace not found") and CS0246 ("type not found") errors.
In a classic project, preserve its existing <ProjectReference> metadata and
configuration mappings instead of replacing them with the SDK-style shorthand.
Common CS Error Codes
| Error | Meaning | Fix |
|---|---|---|
| CS0234 | Namespace not found | Add <ProjectReference> to the source project in the test .csproj |
| CS0246 | Type not found | Add using Namespace; or add missing <ProjectReference> |
| CS0103 | Name not found | Check spelling, add using statement |
| CS1061 | Missing member | Verify method/property name matches the source code exactly |
| CS0029 | Type mismatch | Cast or change the type to match the expected signature |
| CS7036 | Missing required parameter | Read the constructor/method signature and pass all required arguments |
.csproj / .sln Handling
During phase implementation, build only the specific test
.csprojfor speedFor the final validation, build the full
.slnwith--no-incrementalFull-solution builds catch cross-project reference errors invisible in scoped builds
Registering test code with the build (MANDATORY)
Before writing a new C# test file, inspect the test project's compile items.
SDK-style projects normally include
*.csby glob. Do not add a redundant<Compile Include>unless default compile items are disabled.Classic non-SDK projects require an explicit item for every new file. Add a path relative to the project, preserving its path separator and ordering:
<Compile Include="Services\OrderServiceTests.cs" />After editing, re-open the project and verify the exact new test path appears once. A file on disk that is missing from a classic project's compile items is not part of the test assembly and must never be reported as generated coverage.
Registering a new test project (MANDATORY when dotnet new was used)
A new .csproj is invisible to dotnet test <solution>, to dotnet test run from the repo root, and to any CI/benchmark harness until it is added to the solution. Run dotnet sln add immediately after creating the project as part of Step 3 ("Register Test Project with Build System") — do not defer it to a later step.
Use the exact solution or solution-filter target identified in the research or plan document under
<TESTAGENT_DIR>— do not search for or substitute a different.sln,.slnx, or.slnftarget.If that target is a
.slnor.slnx, rundotnet sln <solution> add <test-project.csproj>.If the target is a
.slnf(solution filter), also ensure the new project is included in the filter; adding only to the underlying.slnmay not be enough for test discovery.Skip this if the project is already included in the solution or solution filter used for testing.
Prefer the researched test command. If you need to run the solution directly, use
dotnet test --solution <solution>only for repos on .NET SDK 10+ with MTP-style syntax; otherwise use the standard positional formdotnet test <solution>.
Harness Discovery Check
Before reporting success, run the harness-equivalent discovery command from the repo root against the exact researched entry point and confirm it enumerates the new tests. Passing a project directly does not prove that the solution/filter command used by CI discovers it.
Select the command mode from the repository's actual runner configuration,
global.json test.runner, evaluated project properties, and installed SDK
using platform-detection. An SDK 10+ installation alone does not select
native MTP.
| Command mode / executed runner | Discovery command after a successful build |
|---|---|
| VSTest mode / VSTest | dotnet test <solution> --list-tests --no-build |
| VSTest mode / bridged MTP | dotnet test <solution> --no-build -- --list-tests |
| SDK 10+ native MTP mode / MTP | dotnet test --solution <solution> --list-tests --no-build |
Preserve the repository's configuration, target framework, and filtering
switches. For project entry points, use --project <test-project> in native
MTP mode and the positional project in VSTest mode.
Run discovery directly and require exit code zero before inspecting its output
or runner-owned discovery artifact. Do not pipe it into grep -c, wc, or a
counting command that hides the runner's exit status. Compare test identities
and counts using the actual runner format; MTP output need not have VSTest's
indentation. Where a count is meaningful, compare the same command before and
after and require the expected delta.
If tests are missing, inspect registration, filters, compile items, and runner configuration before repairing the proven missing edge. A zero delta alone does not prove a project is absent. Do not report success until the harness command sees your new tests.
For a classic non-SDK project, use the repository's normal build and discovery command instead of the example above. The minimum acceptable check is:
the new file is present exactly once as
<Compile Include="...">;the classic project builds with its documented MSBuild command; and
the repository's test runner discovers the new test(s).
If the environment lacks the required Visual Studio/MSBuild/test-runner toolchain,
verify item registration, report that execution is blocked, and do not substitute
dotnet test or modernize the project.
Test Framework Detection
Detect the framework and installed version from the test project's .csproj,
packages.config, and referenced assembly HintPath values. Match the existing
framework, mocking library, base fixtures, and API level:
| Package Reference | Framework | Attributes | Assertion Style |
|---|---|---|---|
MSTest.Sdk or MSTest.TestFramework | MSTest | [TestClass], [TestMethod], [DataRow] | Assert.AreEqual(expected, actual) |
xunit | xUnit | [Fact], [Theory], [InlineData] | Assert.Equal(expected, actual) |
NUnit | NUnit | [TestFixture], [Test], [TestCase] | Assert.That(actual, Is.EqualTo(expected)) |
Use the repo's existing framework — do not introduce a different one.
For MSTest, load writing-mstest-tests only for APIs supported by the installed
version. In particular, Assert.ThrowsExactly and the unified collection
assertions require MSTest 3.8+, while older suites should keep compatible
Assert.ThrowsException, StringAssert, and CollectionAssert patterns. Never
upgrade MSTest, Moq, NBuilder, or another test dependency merely to use a newer
example.
MSTest Template
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ProjectName.Tests;
[TestClass]
public sealed class ClassNameTests
{
[TestMethod]
public void MethodName_Scenario_ExpectedResult()
{
// Arrange
var sut = new ClassName();
// Act
var result = sut.MethodName(input);
// Assert
Assert.AreEqual(expected, result);
}
[TestMethod]
[DataRow(2, 3, 5, DisplayName = "Positive numbers")]
[DataRow(-1, 1, 0, DisplayName = "Negative and positive")]
public void Add_ValidInputs_ReturnsSum(int a, int b, int expected)
{
// Act
var result = _sut.Add(a, b);
// Assert
Assert.AreEqual(expected, result);
}
}Skip Coverage Tools
Do not configure or run code coverage measurement tools (coverlet, dotnet-coverage, XPlat Code Coverage) by default. These tools have inconsistent cross-configuration behavior and waste significant time. Coverage is measured separately by the evaluation harness.
SDK-style exception: if the user or evaluation harness explicitly requires a
Cobertura/XML artifact, add coverlet.collector as a PackageReference so the
harness can produce it. For classic non-SDK projects, preserve packages.config
and use only the repository's existing coverage workflow; never inject a
PackageReference. Do not run the coverage command yourself.
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