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/python-examples.md
Python Pipeline Examples
Concrete input→output examples for the test generation pipeline targeting a Python codebase using pytest. These show what each pipeline phase produces for a small project.
Source Under Test
A simple InvoiceService in a Python package using pytest:
src/
contoso_billing/
__init__.py
invoice_service.py
invoice.py
invoice_repository.py
tests/
__init__.py
conftest.py (empty, just marks tests/ as a package root)
pyproject.toml# src/contoso_billing/invoice_service.py
from decimal import Decimal, ROUND_HALF_UP
from .invoice import Invoice, InvoiceStatus
from .invoice_repository import InvoiceRepository
class InvoiceService:
def __init__(self, repository: InvoiceRepository) -> None:
self._repository = repository
def calculate_total(self, invoice: Invoice) -> Decimal:
if invoice is None:
raise ValueError("invoice must not be None")
if not invoice.line_items:
raise ValueError("Invoice has no line items.")
subtotal = sum(
(li.quantity * li.unit_price for li in invoice.line_items),
start=Decimal("0"),
)
tax = subtotal * invoice.tax_rate
return (subtotal + tax).quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)
def get_by_id(self, invoice_id: int) -> Invoice:
invoice = self._repository.find(invoice_id)
if invoice is None:
raise KeyError(f"Invoice {invoice_id} not found.")
return invoice
def mark_as_paid(self, invoice_id: int) -> None:
invoice = self._repository.find(invoice_id)
if invoice is None:
raise KeyError(f"Invoice {invoice_id} not found.")
if invoice.status == InvoiceStatus.PAID:
raise ValueError("Invoice is already paid.")
invoice.status = InvoiceStatus.PAID
invoice.paid_date = _utcnow()
self._repository.update(invoice)
def _utcnow():
from datetime import datetime, timezone
return datetime.now(timezone.utc)Sample Research Output
What code-testing-researcher produces in <TESTAGENT_DIR>/research.md:
# Test Generation Research
## Project Overview
- **Path**: /work/contoso-billing
- **Language**: Python 3.11
- **Framework**: pure library (no Flask/Django)
- **Test Framework**: pytest 8.x (declared in pyproject.toml [project.optional-dependencies].test)
- **Package Layout**: `src/` layout — production package imports as `contoso_billing`
## Coverage Baseline
- **Initial Line Coverage**: unknown
- **Strategy**: broad
- **Existing Test Count**: 0 tests across 0 files
## Build & Test Commands
- **Install (editable)**: `python -m pip install -e ".[test]"`
- **Build/Type-check**: none configured
- **Test**: `python -m pytest`
- **Lint**: none configured
## Project Structure
- Source: `src/contoso_billing/`
- Tests: `tests/` (exists, empty besides `conftest.py`)
## Files to Test
### High Priority
| File | Classes/Functions | Testability | Notes |
|------|-------------------|-------------|-------|
| src/contoso_billing/invoice_service.py | InvoiceService: calculate_total, get_by_id, mark_as_paid | High | Core business logic, repository dependency needs mocking |
### Low Priority / Skip
| File | Reason |
|------|--------|
| src/contoso_billing/invoice.py | Dataclass, no logic |
| src/contoso_billing/invoice_repository.py | Interface/protocol, no implementation |
## Existing Tests
- No existing tests found
## Testing Patterns
- No existing patterns; recommend pytest function-style tests in `tests/test_invoice_service.py`, `unittest.mock.Mock(spec=InvoiceRepository)` for repository fakes, and `@pytest.mark.parametrize` for table-driven cases.
## Recommendations
- Start with `calculate_total` (pure logic, easy to parametrize)
- Then `get_by_id` and `mark_as_paid` (require mocking the repository)
- Use `unittest.mock.patch("contoso_billing.invoice_service._utcnow")` to control the timestamp in `mark_as_paid`Sample Plan Output
What code-testing-planner produces in <TESTAGENT_DIR>/plan.md:
# Test Implementation Plan
## Overview
Generate pytest tests for the Contoso Billing InvoiceService, covering all three
public methods across happy path, edge case, and error scenarios. Single phase
since there is only one source file.
## Commands
- **Install**: `python -m pip install -e ".[test]"`
- **Test**: `python -m pytest tests/test_invoice_service.py -q`
- **Test (file-scoped during dev)**: `python -m pytest tests/test_invoice_service.py::test_calculate_total_valid_line_items_returns_expected_total -q`
## Phase Summary
| Phase | Focus | Files | Est. Tests |
|-------|-------|-------|------------|
| 1 | InvoiceService | 1 | 9-12 |
---
## Phase 1: InvoiceService
### Overview
Cover all public methods of InvoiceService. `calculate_total` is pure logic tested
with `@pytest.mark.parametrize`. The async-looking methods are synchronous but
require a mocked InvoiceRepository.
### Files to Test
#### 1. invoice_service.py
- **Source**: `src/contoso_billing/invoice_service.py`
- **Test File**: `tests/test_invoice_service.py`
**Methods to Test**:
1. `calculate_total` — Pure calculation logic
- Happy path: single line item returns quantity × price + tax
- Happy path: multiple line items summed correctly
- Edge case: zero tax rate returns subtotal only
- Error case: None invoice raises ValueError
- Error case: empty line items raises ValueError
2. `get_by_id` — Repository lookup
- Happy path: existing ID returns invoice
- Error case: missing ID raises KeyError
3. `mark_as_paid` — State transition
- Happy path: pending invoice transitions to PAID with `paid_date` set
- Error case: already-paid raises ValueError
- Error case: missing ID raises KeyError
### Success Criteria
- [ ] Test file created at `tests/test_invoice_service.py`
- [ ] `python -m pytest` reports all tests passed
- [ ] No real network/IO; repository is mocked with `Mock(spec=InvoiceRepository)`Sample Generated Test File
What code-testing-implementer produces:
# tests/test_invoice_service.py
from datetime import datetime, timezone
from decimal import Decimal
from unittest.mock import Mock, patch
import pytest
from contoso_billing.invoice import Invoice, InvoiceStatus, LineItem
from contoso_billing.invoice_repository import InvoiceRepository
from contoso_billing.invoice_service import InvoiceService
@pytest.fixture
def repository() -> Mock:
return Mock(spec=InvoiceRepository)
@pytest.fixture
def sut(repository: Mock) -> InvoiceService:
return InvoiceService(repository)
# --- calculate_total ---
@pytest.mark.parametrize(
"quantity, unit_price, tax_rate, expected",
[
(1, "100.00", "0.10", "110.00"),
(3, "25.00", "0.00", "75.00"),
(2, "9.99", "0.07", "21.38"),
],
ids=["single-item-10pct-tax", "multi-quantity-zero-tax", "rounds-half-up"],
)
def test_calculate_total_valid_line_items_returns_expected_total(
sut: InvoiceService, quantity: int, unit_price: str, tax_rate: str, expected: str
) -> None:
invoice = Invoice(
tax_rate=Decimal(tax_rate),
line_items=[LineItem(quantity=quantity, unit_price=Decimal(unit_price))],
)
total = sut.calculate_total(invoice)
assert total == Decimal(expected)
def test_calculate_total_none_invoice_raises_value_error(sut: InvoiceService) -> None:
with pytest.raises(ValueError, match="invoice must not be None"):
sut.calculate_total(None)
def test_calculate_total_empty_line_items_raises_value_error(sut: InvoiceService) -> None:
invoice = Invoice(tax_rate=Decimal("0"), line_items=[])
with pytest.raises(ValueError, match="no line items"):
sut.calculate_total(invoice)
# --- get_by_id ---
def test_get_by_id_existing_id_returns_invoice(
sut: InvoiceService, repository: Mock
) -> None:
expected = Invoice(id=42, tax_rate=Decimal("0"), line_items=[])
repository.find.return_value = expected
result = sut.get_by_id(42)
assert result is expected
repository.find.assert_called_once_with(42)
def test_get_by_id_missing_id_raises_key_error(
sut: InvoiceService, repository: Mock
) -> None:
repository.find.return_value = None
with pytest.raises(KeyError, match="999"):
sut.get_by_id(999)
# --- mark_as_paid ---
def test_mark_as_paid_pending_invoice_sets_status_and_date(
sut: InvoiceService, repository: Mock
) -> None:
invoice = Invoice(id=1, status=InvoiceStatus.PENDING, tax_rate=Decimal("0"), line_items=[])
repository.find.return_value = invoice
fixed_now = datetime(2025, 1, 1, 12, 0, tzinfo=timezone.utc)
with patch("contoso_billing.invoice_service._utcnow", return_value=fixed_now):
sut.mark_as_paid(1)
assert invoice.status == InvoiceStatus.PAID
assert invoice.paid_date == fixed_now
repository.update.assert_called_once_with(invoice)
def test_mark_as_paid_already_paid_raises_value_error(
sut: InvoiceService, repository: Mock
) -> None:
invoice = Invoice(id=1, status=InvoiceStatus.PAID, tax_rate=Decimal("0"), line_items=[])
repository.find.return_value = invoice
with pytest.raises(ValueError, match="already paid"):
sut.mark_as_paid(1)
repository.update.assert_not_called()
def test_mark_as_paid_missing_id_raises_key_error(
sut: InvoiceService, repository: Mock
) -> None:
repository.find.return_value = None
with pytest.raises(KeyError, match="999"):
sut.mark_as_paid(999)Sample Fix Cycle
When the implementer encounters an import or attribute error, the fixer agent diagnoses and resolves it.
Test output:
ModuleNotFoundError: No module named 'contoso_billing'Fixer diagnosis: The package is not installed in editable mode, so the src/ layout's package is not on sys.path.
Fix applied:
python -m pip install -e ".[test]"Rerun: python -m pytest tests/test_invoice_service.py -q → SUCCESS
Another common cycle — patch target wrong:
Test output:
AttributeError: <module 'datetime'> does not have the attribute '_utcnow'Fixer diagnosis: The test patched datetime._utcnow but the production code defines its own _utcnow helper inside contoso_billing.invoice_service. Patches must target the lookup site, not the definition site.
Fix applied:
# Before (wrong)
with patch("datetime._utcnow", return_value=fixed_now):
# After (fixed) — patch where the name is looked up
with patch("contoso_billing.invoice_service._utcnow", return_value=fixed_now):Rerun: SUCCESS
Another common cycle — Mock without spec:
Test output:
AttributeError: Mock object has no attribute 'find_by_id'(but the actual repository method is find, not find_by_id)
Fixer diagnosis: Mock() happily creates any attribute on access, so a typo in the test went undetected until the production code called repository.find(...). Using Mock(spec=InvoiceRepository) would have failed at setup time.
Fix applied:
# Before
repository = Mock()
repository.find_by_id.return_value = expected # typo, silently accepted
# After
repository = Mock(spec=InvoiceRepository)
repository.find.return_value = expected # typos now raise AttributeErrorRerun: SUCCESS
Sample Final Report
What test-engineer produces at Step 9:
## Test Generation Report
**Project**: contoso-billing
**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/test_invoice_service.py` (9 tests, 3 parametrized)
### Coverage
- InvoiceService.calculate_total — 3 happy path, 2 error cases
- InvoiceService.get_by_id — 1 happy path, 1 error case
- InvoiceService.mark_as_paid — 1 happy path, 2 error cases
### Build / Install Validation
- Editable install: ✅ `python -m pip install -e ".[test]"`
- Test run: ✅ `python -m pytest` — 9 passed in 0.12s
### Next Steps
- Add tests for repository implementations if any exist
- Consider snapshot/property-based testing (`hypothesis`) for `calculate_total` rounding behaviourRequirements 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