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://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/rust-examples.md

Rust Pipeline Examples

Concrete input→output examples for the test generation pipeline targeting a Rust crate using the built-in test harness. These show what each pipeline phase produces for a small library crate.

Source Under Test

A simple InvoiceService in a Rust crate:

Cargo.toml
src/
  lib.rs
  invoice.rs
  invoice_repository.rs
  invoice_service.rs
// src/invoice_service.rs
use crate::invoice::{Invoice, InvoiceStatus};
use crate::invoice_repository::InvoiceRepository;
use std::time::SystemTime;

#[derive(Debug, PartialEq, Eq)]
pub enum InvoiceError {
    EmptyLineItems,
    NotFound(i32),
    AlreadyPaid,
    Repository(String),
}

pub struct InvoiceService<R, C>
where
    R: InvoiceRepository,
    C: Fn() -> SystemTime,
{
    repository: R,
    clock: C,
}

impl<R, C> InvoiceService<R, C>
where
    R: InvoiceRepository,
    C: Fn() -> SystemTime,
{
    pub fn new(repository: R, clock: C) -> Self {
        Self { repository, clock }
    }

    pub fn calculate_total(&self, invoice: &Invoice) -> Result<f64, InvoiceError> {
        if invoice.line_items.is_empty() {
            return Err(InvoiceError::EmptyLineItems);
        }

        let subtotal: f64 = invoice.line_items.iter().map(|item| item.quantity as f64 * item.unit_price).sum();
        Ok(((subtotal + subtotal * invoice.tax_rate) * 100.0).round() / 100.0)
    }

    pub fn get_by_id(&self, id: i32) -> Result<Invoice, InvoiceError> {
        self.repository.find(id).map_err(InvoiceError::Repository)?.ok_or(InvoiceError::NotFound(id))
    }

    pub fn mark_as_paid(&mut self, id: i32) -> Result<(), InvoiceError> {
        let mut invoice = self.get_by_id(id)?;
        if invoice.status == InvoiceStatus::Paid {
            return Err(InvoiceError::AlreadyPaid);
        }

        invoice.status = InvoiceStatus::Paid;
        invoice.paid_at = Some((self.clock)());
        self.repository.update(invoice).map_err(InvoiceError::Repository)
    }
}

Sample Research Output

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

# Test Generation Research

## Project Overview
- **Path**: /work/contoso-billing
- **Language**: Rust 1.78 (edition 2021, from Cargo.toml)
- **Crate Type**: library
- **Test Framework**: built-in Rust test harness (`#[test]`), no `mockall`/`rstest` dev-dependencies detected

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

## Build & Test Commands
- **Check**: `cargo check --all-targets`
- **Compile tests**: `cargo test --no-run`
- **Test**: `cargo test`
- **Single module**: `cargo test invoice_service::tests`

## Files to Test

### High Priority
| File | Types/Methods | Testability | Notes |
|------|---------------|-------------|-------|
| src/invoice_service.rs | InvoiceService: calculate_total, get_by_id, mark_as_paid | High | Generic repository trait is easy to fake; clock closure is injectable |

## Testing Patterns
- No existing patterns; recommend unit tests in `#[cfg(test)] mod tests` at the bottom of `invoice_service.rs` and a hand-written fake repository.

Sample Plan Output

# Test Implementation Plan

## Overview
Generate built-in Rust unit tests for InvoiceService covering calculation,
lookup, and paid-state transition behavior.

## Commands
- **Check**: `cargo check --all-targets`
- **Compile tests**: `cargo test --no-run`
- **Test**: `cargo test invoice_service::tests`

## Phase 1: InvoiceService

### Files to Test
- **Source**: `src/invoice_service.rs`
- **Test Location**: `#[cfg(test)] mod tests` appended to `src/invoice_service.rs`

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

Sample Generated Test File

// Appended to src/invoice_service.rs
#[cfg(test)]
mod tests {
    use super::*;
    use crate::invoice::{Invoice, InvoiceStatus, LineItem};
    use std::collections::HashMap;
    use std::time::{Duration, UNIX_EPOCH};

    #[derive(Default)]
    struct FakeRepository {
        invoices: HashMap<i32, Invoice>,
        updated: Option<Invoice>,
        find_error: Option<String>,
    }

    impl InvoiceRepository for FakeRepository {
        fn find(&self, id: i32) -> Result<Option<Invoice>, String> {
            if let Some(error) = &self.find_error {
                return Err(error.clone());
            }

            Ok(self.invoices.get(&id).cloned())
        }

        fn update(&mut self, invoice: Invoice) -> Result<(), String> {
            self.updated = Some(invoice.clone());
            self.invoices.insert(invoice.id, invoice);
            Ok(())
        }
    }

    fn make_invoice(id: i32) -> Invoice {
        Invoice {
            id,
            status: InvoiceStatus::Pending,
            tax_rate: 0.10,
            line_items: vec![LineItem { quantity: 1, unit_price: 100.0 }],
            paid_at: None,
        }
    }

    fn service_with(repository: FakeRepository) -> InvoiceService<FakeRepository, fn() -> std::time::SystemTime> {
        InvoiceService::new(repository, || UNIX_EPOCH + Duration::from_secs(123))
    }

    #[test]
    fn calculate_total_valid_line_items_returns_expected_total() {
        let cases = [
            ("single item with tax", vec![LineItem { quantity: 1, unit_price: 100.0 }], 0.10, 110.0),
            ("multi quantity zero tax", vec![LineItem { quantity: 3, unit_price: 25.0 }], 0.0, 75.0),
            ("rounds to two decimals", vec![LineItem { quantity: 2, unit_price: 9.99 }], 0.07, 21.38),
        ];
        let service = service_with(FakeRepository::default());

        for (name, line_items, tax_rate, expected) in cases {
            let mut invoice = make_invoice(1);
            invoice.line_items = line_items;
            invoice.tax_rate = tax_rate;

            let total = service.calculate_total(&invoice).unwrap_or_else(|err| panic!("{name}: unexpected error: {err:?}"));

            assert!((total - expected).abs() < 0.001, "{name}: got {total}, expected {expected}");
        }
    }

    #[test]
    fn calculate_total_empty_line_items_returns_error() {
        let service = service_with(FakeRepository::default());
        let mut invoice = make_invoice(1);
        invoice.line_items.clear();

        assert_eq!(Err(InvoiceError::EmptyLineItems), service.calculate_total(&invoice));
    }

    #[test]
    fn get_by_id_existing_invoice_returns_invoice() {
        let mut repository = FakeRepository::default();
        repository.invoices.insert(42, make_invoice(42));
        let service = service_with(repository);

        let invoice = service.get_by_id(42).expect("invoice should exist");

        assert_eq!(42, invoice.id);
    }

    #[test]
    fn get_by_id_missing_invoice_returns_not_found() {
        let service = service_with(FakeRepository::default());

        assert_eq!(Err(InvoiceError::NotFound(999)), service.get_by_id(999));
    }

    #[test]
    fn get_by_id_repository_error_is_preserved() {
        let repository = FakeRepository { find_error: Some("boom".to_owned()), ..FakeRepository::default() };
        let service = service_with(repository);

        assert_eq!(Err(InvoiceError::Repository("boom".to_owned())), service.get_by_id(1));
    }

    #[test]
    fn mark_as_paid_pending_invoice_updates_status_date_and_repository() {
        let mut repository = FakeRepository::default();
        repository.invoices.insert(1, make_invoice(1));
        let mut service = service_with(repository);

        service.mark_as_paid(1).expect("mark_as_paid should succeed");

        let updated = service.repository.updated.as_ref().expect("repository should be updated");
        assert_eq!(InvoiceStatus::Paid, updated.status);
        assert_eq!(Some(UNIX_EPOCH + Duration::from_secs(123)), updated.paid_at);
    }

    #[test]
    fn mark_as_paid_already_paid_returns_error_without_update() {
        let mut invoice = make_invoice(1);
        invoice.status = InvoiceStatus::Paid;
        let mut repository = FakeRepository::default();
        repository.invoices.insert(1, invoice);
        let mut service = service_with(repository);

        assert_eq!(Err(InvoiceError::AlreadyPaid), service.mark_as_paid(1));
        assert!(service.repository.updated.is_none());
    }

    #[test]
    fn mark_as_paid_missing_invoice_returns_not_found_without_update() {
        let mut service = service_with(FakeRepository::default());

        assert_eq!(Err(InvoiceError::NotFound(999)), service.mark_as_paid(999));
        assert!(service.repository.updated.is_none());
    }
}

Sample Fix Cycle

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

Build output:

error[E0596]: cannot borrow `self.repository` as mutable, as it is behind a `&` reference

Fixer diagnosis: mark_as_paid calls repository.update(...), which requires mutable repository access. The production method must take &mut self, and tests must bind the service as let mut service.

Fix applied: Change the method receiver to &mut self and update tests to use mutable bindings for mark_as_paid cases.

Rebuild + rerun: cargo test --no-run && cargo test invoice_service::tests → SUCCESS


Another common cycle — integration test imports:

Build output:

error[E0432]: unresolved import `crate::invoice_service`

Fixer diagnosis: The test was created under tests/invoice_service.rs, which is an integration test crate. Integration tests import the library by crate name, not crate::.

Fix applied: Move the tests into #[cfg(test)] mod tests in src/invoice_service.rs and use use super::*;.

Rerun: SUCCESS

Sample Final Report

## Test Generation Report

**Project**: contoso-billing (Rust)
**Strategy**: Direct (single module in scope)

### Results
| Metric         | Value |
|----------------|-------|
| Tests created  | 8     |
| Tests passing  | 8     |
| Tests failing  | 0     |
| Files created  | 0 (tests appended to source module) |

### Files Modified
- `src/invoice_service.rs` (8 unit tests in `#[cfg(test)] mod tests`; 3 calculation rows run within one test)

### Coverage
- InvoiceService::calculate_total — 3 happy path, 1 error case
- InvoiceService::get_by_id — found, missing, repository error
- InvoiceService::mark_as_paid — success, already-paid and missing-invoice branches; error cases do not update the repository

### Build / Test Validation
- Check: ✅ `cargo check --all-targets`
- Compile tests: ✅ `cargo test --no-run`
- Test run: ✅ `cargo test invoice_service::tests`

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