Generated banner for Code Testing Extensions
Generated logo for Code Testing Extensions

Code Testing Extensions

.NET (Microsoft)OfficialPublished by .NET (Microsoft)

  • Skill
  • Guidelines
  • Software development
  • MIT
  • Low risk

From the author

Provides file paths to language-specific extension files for the code-testing pipeline. Read this reference-only catalog for extension guidance files (e.g., dotnet.md for .NET, cpp.md for C++). Agents and skills read its bundled files directly; do not invoke this catalog through the model's skill tool.
— the description by .NET (Microsoft)

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

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/dotnet/code-testing-extensions/download
  2. Unzip 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

FileLanguageContents
extensions/dotnet.md.NET (C#/F#/VB)Build commands, test commands, project reference validation, common CS error codes, MSTest template
extensions/python.mdPythonFramework-adaptive test commands (pytest, custom runners), project layout detection, mocking guidelines, common errors
extensions/typescript.mdTypeScript/JavaScriptBuild/test commands (Jest/Vitest/Mocha), framework detection, mocking, TS-specific considerations
extensions/powershell.mdPowerShellTest commands (Pester v5), module import patterns, discovery/run pitfalls, mocking, common errors
extensions/cpp.mdC++Testing internals with friend declarations
extensions/go.mdGogo test commands, table-driven tests, integration vs unit layout, mocking via interfaces, common errors
extensions/java.mdJavaMaven/Gradle commands, JUnit 4/5 and TestNG detection, Mockito, Spring Boot slices, common errors
extensions/rust.mdRustcargo test commands, unit vs integration vs doc tests, features, async test harnesses, common errors
extensions/ruby.mdRubyRSpec and Minitest commands, Bundler usage, Rails specifics, mocking patterns, common errors
extensions/swift.mdSwiftSPM and Xcode test commands, XCTest vs Swift Testing, @testable import, async/throws tests, common errors
extensions/kotlin.mdKotlinGradle 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.mdPythonConcrete pipeline examples (pytest): research, plan, generated test file, fix cycles, final report
extensions/typescript-examples.mdTypeScript/JavaScriptConcrete pipeline examples (Vitest, applicable to Jest): research, plan, generated test file, fix cycles, final report
extensions/go-examples.mdGoConcrete pipeline examples (standard testing): research, plan, table-driven test file, fix cycles, final report
extensions/java-examples.mdJavaConcrete 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

extensions/cpp-examples.md

C++ Pipeline Examples

Concrete input→output examples for the test generation pipeline targeting a C++ codebase using CMake + Catch2. These show what each pipeline phase produces for a small library project.

GoogleTest follows the same shape. Replace TEST_CASE / SECTION / REQUIRE with TEST / EXPECT_* and link the test executable to GTest::gtest_main instead of Catch2::Catch2WithMain.

Source Under Test

A simple InvoiceService in a CMake project:

CMakeLists.txt
include/contoso/billing/
  invoice.hpp
  invoice_repository.hpp
  invoice_service.hpp
src/invoice_service.cpp
tests/CMakeLists.txt        (links Catch2::Catch2WithMain)
// src/invoice_service.cpp
#include "contoso/billing/invoice_service.hpp"

#include <cmath>
#include <stdexcept>
#include <utility>

namespace contoso::billing {

InvoiceService::InvoiceService(InvoiceRepository& repository, Clock clock)
    : repository_(repository), clock_(std::move(clock)) {}

double InvoiceService::calculate_total(const Invoice& invoice) const {
    if (invoice.line_items.empty()) {
        throw std::invalid_argument("invoice has no line items");
    }

    double subtotal = 0.0;
    for (const LineItem& item : invoice.line_items) {
        subtotal += static_cast<double>(item.quantity) * item.unit_price;
    }

    return std::round((subtotal + subtotal * invoice.tax_rate) * 100.0) / 100.0;
}

Invoice InvoiceService::get_by_id(int id) const {
    auto invoice = repository_.find(id);
    if (!invoice.has_value()) {
        throw std::out_of_range("invoice not found");
    }

    return *invoice;
}

void InvoiceService::mark_as_paid(int id) {
    auto invoice = repository_.find(id);
    if (!invoice.has_value()) {
        throw std::out_of_range("invoice not found");
    }
    if (invoice->status == InvoiceStatus::paid) {
        throw std::logic_error("invoice is already paid");
    }

    invoice->status = InvoiceStatus::paid;
    invoice->paid_at = clock_();
    repository_.update(*invoice);
}

} // namespace contoso::billing

Sample Research Output

What code-testing-researcher produces in <TESTAGENT_DIR>/research.md:

# Test Generation Research

## Project Overview
- **Path**: /work/contoso-billing
- **Language**: C++20
- **Build System**: CMake (preset `ninja-debug` present)
- **Test Framework**: Catch2 v3 (detected via `find_package(Catch2 3 REQUIRED)`)

## Coverage Baseline
- **Initial Line Coverage**: unknown
- **Strategy**: broad
- **Existing Test Count**: 0 tests across 0 files

## Build & Test Commands
- **Configure**: `cmake --preset ninja-debug`
- **Build tests**: `cmake --build --preset ninja-debug --target invoice_service_tests`
- **Test**: `ctest --preset ninja-debug --output-on-failure`
- **Coverage (if configured)**: rebuild with `--coverage`, then use `gcov` or `llvm-cov`

## Files to Test

### High Priority
| File | Classes/Functions | Testability | Notes |
|------|-------------------|-------------|-------|
| src/invoice_service.cpp | InvoiceService: calculate_total, get_by_id, mark_as_paid | High | Repository is an interface; clock dependency is injectable |

## Testing Patterns
- No existing patterns; recommend Catch2 `TEST_CASE` blocks, `SECTION` cases, `Approx` for floating-point assertions, and a hand-written fake repository.

Sample Plan Output

# Test Implementation Plan

## Overview
Generate Catch2 tests for InvoiceService covering pure calculation logic,
repository lookup behavior, and the paid-state transition.

## Commands
- **Build**: `cmake --build --preset ninja-debug --target invoice_service_tests`
- **Test**: `ctest --preset ninja-debug --output-on-failure`

## Phase 1: InvoiceService

### Files to Test
- **Source**: `src/invoice_service.cpp`
- **Test File**: `tests/invoice_service_tests.cpp`

**Methods to Test**:
1. `calculate_total` — tax, zero tax, rounding, empty line items
2. `get_by_id` — existing invoice and missing invoice
3. `mark_as_paid` — success with fixed clock, already-paid, missing

Sample Generated Test File

// tests/invoice_service_tests.cpp
#include "contoso/billing/invoice_service.hpp"

#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <catch2/matchers/catch_matchers_string.hpp>

#include <chrono>
#include <optional>
#include <stdexcept>
#include <unordered_map>

using Catch::Matchers::ContainsSubstring;

namespace contoso::billing {
namespace {

class FakeRepository final : public InvoiceRepository {
public:
    std::optional<Invoice> find(int id) override {
        auto it = invoices.find(id);
        return it == invoices.end() ? std::nullopt : std::optional<Invoice>{it->second};
    }

    void update(const Invoice& invoice) override {
        updated = invoice;
        invoices[invoice.id] = invoice;
    }

    std::unordered_map<int, Invoice> invoices;
    std::optional<Invoice> updated;
};

Invoice make_invoice(int id = 1) {
    return Invoice{
        .id = id,
        .status = InvoiceStatus::pending,
        .tax_rate = 0.10,
        .line_items = {LineItem{.quantity = 1, .unit_price = 100.0}},
    };
}

} // namespace

TEST_CASE("InvoiceService calculates totals", "[invoice-service]") {
    FakeRepository repository;
    InvoiceService sut(repository, [] { return std::chrono::system_clock::time_point{}; });

    SECTION("single item with tax") {
        REQUIRE(sut.calculate_total(make_invoice()) == Catch::Approx(110.0));
    }

    SECTION("multi quantity with zero tax") {
        Invoice invoice = make_invoice();
        invoice.tax_rate = 0.0;
        invoice.line_items = {LineItem{.quantity = 3, .unit_price = 25.0}};

        REQUIRE(sut.calculate_total(invoice) == Catch::Approx(75.0));
    }

    SECTION("rounds to two decimals") {
        Invoice invoice = make_invoice();
        invoice.tax_rate = 0.07;
        invoice.line_items = {LineItem{.quantity = 2, .unit_price = 9.99}};

        REQUIRE(sut.calculate_total(invoice) == Catch::Approx(21.38).epsilon(0.001));
    }

    SECTION("empty line items throw") {
        Invoice invoice = make_invoice();
        invoice.line_items.clear();

        REQUIRE_THROWS_WITH(sut.calculate_total(invoice), ContainsSubstring("no line items"));
    }
}

TEST_CASE("InvoiceService uses the repository", "[invoice-service]") {
    const auto fixed_time = std::chrono::system_clock::time_point{std::chrono::seconds{123}};
    FakeRepository repository;
    repository.invoices.emplace(42, make_invoice(42));
    InvoiceService sut(repository, [fixed_time] { return fixed_time; });

    SECTION("get_by_id returns an existing invoice") {
        REQUIRE(sut.get_by_id(42).id == 42);
    }

    SECTION("get_by_id throws when missing") {
        REQUIRE_THROWS_WITH(sut.get_by_id(999), ContainsSubstring("not found"));
    }

    SECTION("mark_as_paid updates status, date, and repository") {
        repository.invoices.emplace(1, make_invoice(1));

        sut.mark_as_paid(1);

        REQUIRE(repository.updated.has_value());
        REQUIRE(repository.updated->status == InvoiceStatus::paid);
        REQUIRE(repository.updated->paid_at == fixed_time);
    }

    SECTION("mark_as_paid rejects an already-paid invoice") {
        Invoice invoice = make_invoice(2);
        invoice.status = InvoiceStatus::paid;
        repository.invoices.emplace(2, invoice);

        REQUIRE_THROWS_WITH(sut.mark_as_paid(2), ContainsSubstring("already paid"));
    }

    SECTION("mark_as_paid rejects a missing invoice without updating") {
        REQUIRE_THROWS_WITH(sut.mark_as_paid(999), ContainsSubstring("not found"));
        REQUIRE_FALSE(repository.updated.has_value());
    }
}

} // namespace contoso::billing

Sample Fix Cycle

When the implementer hits a compile or runner issue, the fixer agent diagnoses and resolves it.

Build output:

error: cannot declare variable 'repository' to be of abstract type 'FakeRepository'
note: missing pure virtual method 'InvoiceRepository::update'

Fixer diagnosis: The fake repository implemented find but not the full InvoiceRepository interface.

Fix applied: Add void update(const Invoice& invoice) override to FakeRepository and record the updated invoice for assertions.

Rebuild + rerun: cmake --build --preset ninja-debug --target invoice_service_tests && ctest --preset ninja-debug --output-on-failure → SUCCESS

Sample Final Report

## Test Generation Report

**Project**: contoso-billing (C++ / CMake)
**Strategy**: Direct (single source file in scope)

### Results
| Metric         | Value |
|----------------|-------|
| Tests created  | 9     |
| Tests passing  | 9     |
| Tests failing  | 0     |
| Files created  | 1     |

### Files Created
- `tests/invoice_service_tests.cpp` (2 Catch2 test cases, 9 sections)

### Coverage
- InvoiceService.calculate_total — tax, zero tax, rounding, empty input
- InvoiceService.get_by_id — found and missing branches
- InvoiceService.mark_as_paid — success, already-paid, and missing-invoice branches; missing invoices never update the repository

### Build / Test Validation
- Configure: ✅ `cmake --preset ninja-debug`
- Build: ✅ `cmake --build --preset ninja-debug --target invoice_service_tests`
- Test: ✅ `ctest --preset ninja-debug --output-on-failure`

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