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

Ruby Pipeline Examples

Concrete input→output examples for the test generation pipeline targeting a Ruby codebase using RSpec. These show what each pipeline phase produces for a small gem-style project.

Minitest follows the same coverage shape. Replace RSpec.describe / it / expect with Minitest::Test methods and assertions, and run through bundle exec rake test or the repo's established Minitest command.

Source Under Test

A simple InvoiceService in a Ruby gem:

Gemfile
lib/
  contoso_billing.rb
  contoso_billing/invoice.rb
  contoso_billing/invoice_repository.rb
  contoso_billing/invoice_service.rb
spec/spec_helper.rb
# lib/contoso_billing/invoice_service.rb
require 'bigdecimal'
require 'time'

module ContosoBilling
  class InvoiceService
    def initialize(repository:, clock: -> { Time.now.utc })
      @repository = repository
      @clock = clock
    end

    def calculate_total(invoice)
      raise ArgumentError, 'invoice must not be nil' if invoice.nil?
      raise ArgumentError, 'Invoice has no line items.' if invoice.line_items.empty?

      subtotal = invoice.line_items.sum { |item| item.quantity * item.unit_price }
      tax = subtotal * invoice.tax_rate
      (subtotal + tax).round(2)
    end

    def get_by_id(id)
      invoice = @repository.find(id)
      raise KeyError, "Invoice #{id} not found." if invoice.nil?

      invoice
    end

    def mark_as_paid(id)
      invoice = get_by_id(id)
      raise StandardError, 'Invoice is already paid.' if invoice.status == :paid

      invoice.status = :paid
      invoice.paid_at = @clock.call
      @repository.update(invoice)
    end
  end
end

Sample Research Output

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

# Test Generation Research

## Project Overview
- **Path**: /work/contoso-billing
- **Language**: Ruby 3.3 (from `.ruby-version`)
- **Project Type**: Plain gem
- **Test Framework**: RSpec 3.x (detected in Gemfile.lock and `spec/spec_helper.rb`)
- **Run Prefix**: `bundle exec` required because Gemfile.lock is present

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

## Build & Test Commands
- **Syntax**: `ruby -c lib/contoso_billing/invoice_service.rb`
- **Discovery**: `bundle exec rspec --dry-run`
- **Single file**: `bundle exec rspec spec/contoso_billing/invoice_service_spec.rb`
- **All specs**: `bundle exec rspec`

## Files to Test

### High Priority
| File | Classes/Methods | Testability | Notes |
|------|-----------------|-------------|-------|
| lib/contoso_billing/invoice_service.rb | InvoiceService: calculate_total, get_by_id, mark_as_paid | High | Repository dependency and clock are injected |

## Testing Patterns
- Existing specs use `RSpec.describe`, `subject`, `let`, and `instance_double`.
- Recommend `instance_double('InvoiceRepository')` for the repository and a fixed clock lambda for time-dependent behavior.

Sample Plan Output

# Test Implementation Plan

## Overview
Generate RSpec tests for ContosoBilling::InvoiceService, covering calculation,
lookup, and paid-state transition behavior.

## Commands
- **Syntax**: `ruby -c spec/contoso_billing/invoice_service_spec.rb`
- **Discovery**: `bundle exec rspec --dry-run`
- **Test**: `bundle exec rspec spec/contoso_billing/invoice_service_spec.rb`

## Phase 1: InvoiceService

### Files to Test
- **Source**: `lib/contoso_billing/invoice_service.rb`
- **Test File**: `spec/contoso_billing/invoice_service_spec.rb`

**Methods to Test**:
1. `calculate_total` — tax, zero tax, rounding, nil, and 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

# spec/contoso_billing/invoice_service_spec.rb
require 'spec_helper'
require 'bigdecimal'
require 'ostruct'
require 'time'
require 'contoso_billing/invoice_service'

RSpec.describe ContosoBilling::InvoiceService do
  subject(:service) { described_class.new(repository: repository, clock: clock) }

  let(:repository) { instance_double('InvoiceRepository') }
  let(:fixed_time) { Time.utc(2025, 1, 1, 12, 0, 0) }
  let(:clock) { -> { fixed_time } }

  def build_invoice(id: 1, status: :pending, tax_rate: BigDecimal('0.10'), line_items: [OpenStruct.new(quantity: 1, unit_price: BigDecimal('100.00'))])
    OpenStruct.new(id: id, status: status, tax_rate: tax_rate, line_items: line_items, paid_at: nil)
  end

  describe '#calculate_total' do
    it 'returns the total for a single item with tax' do
      expect(service.calculate_total(build_invoice)).to eq(BigDecimal('110.00'))
    end

    it 'returns the subtotal when tax is zero' do
      invoice = build_invoice(
        tax_rate: BigDecimal('0'),
        line_items: [OpenStruct.new(quantity: 3, unit_price: BigDecimal('25.00'))]
      )

      expect(service.calculate_total(invoice)).to eq(BigDecimal('75.00'))
    end

    it 'rounds to two decimals' do
      invoice = build_invoice(
        tax_rate: BigDecimal('0.07'),
        line_items: [OpenStruct.new(quantity: 2, unit_price: BigDecimal('9.99'))]
      )

      expect(service.calculate_total(invoice)).to eq(BigDecimal('21.38'))
    end

    it 'raises for a nil invoice' do
      expect { service.calculate_total(nil) }.to raise_error(ArgumentError, /must not be nil/)
    end

    it 'raises when there are no line items' do
      expect { service.calculate_total(build_invoice(line_items: [])) }.to raise_error(ArgumentError, /no line items/)
    end
  end

  describe '#get_by_id' do
    it 'returns an existing invoice' do
      invoice = build_invoice(id: 42)
      allow(repository).to receive(:find).with(42).and_return(invoice)

      expect(service.get_by_id(42)).to be(invoice)
    end

    it 'raises KeyError for a missing invoice' do
      allow(repository).to receive(:find).with(999).and_return(nil)

      expect { service.get_by_id(999) }.to raise_error(KeyError, /999/)
    end
  end

  describe '#mark_as_paid' do
    it 'marks a pending invoice as paid and persists it' do
      invoice = build_invoice(id: 1)
      allow(repository).to receive(:find).with(1).and_return(invoice)
      allow(repository).to receive(:update)

      service.mark_as_paid(1)

      expect(invoice.status).to eq(:paid)
      expect(invoice.paid_at).to eq(fixed_time)
      expect(repository).to have_received(:update).with(invoice)
    end

    it 'raises and does not update an already-paid invoice' do
      invoice = build_invoice(id: 1, status: :paid)
      allow(repository).to receive(:find).with(1).and_return(invoice)
      allow(repository).to receive(:update)

      expect { service.mark_as_paid(1) }.to raise_error(StandardError, /already paid/)
      expect(repository).not_to have_received(:update)
    end

    it 'raises KeyError and does not update a missing invoice' do
      allow(repository).to receive(:find).with(999).and_return(nil)
      allow(repository).to receive(:update)

      expect { service.mark_as_paid(999) }.to raise_error(KeyError, 'Invoice 999 not found.')
      expect(repository).not_to have_received(:update)
    end
  end
end

Sample Fix Cycle

When the implementer encounters a load or mock issue, the fixer agent diagnoses and resolves it.

Test output:

LoadError: cannot load such file -- contoso_billing/invoice_service

Fixer diagnosis: The generated spec omitted require 'spec_helper', so the gem's load-path setup did not run.

Fix applied: Add require 'spec_helper' as the first require and keep source requires consistent with existing specs.

Rerun: bundle exec rspec spec/contoso_billing/invoice_service_spec.rb → SUCCESS


Another common cycle — verifying double mismatch:

Test output:

The InvoiceRepository class does not implement the instance method: find_by_id

Fixer diagnosis: instance_double caught a typo in the test setup. The production code calls repository.find, not find_by_id.

Fix applied: Stub find with the expected id instead of find_by_id.

Rerun: SUCCESS

Sample Final Report

## Test Generation Report

**Project**: contoso-billing (Ruby)
**Strategy**: Direct (single source file in scope)

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

### Files Created
- `spec/contoso_billing/invoice_service_spec.rb` (10 RSpec examples)

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

### Build / Test Validation
- Syntax: ✅ `ruby -c spec/contoso_billing/invoice_service_spec.rb`
- Discovery: ✅ `bundle exec rspec --dry-run` found the new examples
- Test run: ✅ `bundle exec rspec spec/contoso_billing/invoice_service_spec.rb`

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