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-examples.md
.NET Pipeline Examples
Concrete input→output examples for the test generation pipeline targeting a .NET/C# codebase. These show what each pipeline phase produces for a small project.
Source Under Test
A simple InvoiceService in a .NET 9 project using MSTest:
src/
Contoso.Billing/
Contoso.Billing.csproj
InvoiceService.cs
Invoice.cs
IInvoiceRepository.cs
tests/
Contoso.Billing.Tests/
Contoso.Billing.Tests.csproj (exists, references Contoso.Billing)
Contoso.Billing.sln// InvoiceService.cs
namespace Contoso.Billing;
public class InvoiceService(IInvoiceRepository repository)
{
public decimal CalculateTotal(Invoice invoice)
{
if (invoice is null) throw new ArgumentNullException(nameof(invoice));
if (invoice.LineItems.Count == 0) throw new InvalidOperationException("Invoice has no line items.");
var subtotal = invoice.LineItems.Sum(li => li.Quantity * li.UnitPrice);
var tax = subtotal * invoice.TaxRate;
return Math.Round(subtotal + tax, 2);
}
public async Task<Invoice> GetByIdAsync(int id)
{
var invoice = await repository.FindAsync(id);
return invoice ?? throw new KeyNotFoundException($"Invoice {id} not found.");
}
public async Task MarkAsPaidAsync(int id)
{
var invoice = await repository.FindAsync(id)
?? throw new KeyNotFoundException($"Invoice {id} not found.");
if (invoice.Status == InvoiceStatus.Paid)
throw new InvalidOperationException("Invoice is already paid.");
invoice.Status = InvoiceStatus.Paid;
invoice.PaidDate = DateTime.UtcNow;
await repository.UpdateAsync(invoice);
}
}Sample Research Output
What code-testing-researcher produces in <TESTAGENT_DIR>/research.md:
# Test Generation Research
## Project Overview
- **Path**: C:\src\Contoso.Billing
- **Language**: C# (.NET 9)
- **Framework**: .NET 9 (net9.0)
- **Test Framework**: MSTest 3.8
## Coverage Baseline
- **Initial Line Coverage**: unknown
- **Strategy**: broad
- **Existing Test Count**: 0 tests across 0 files
## Build & Test Commands
- **Build**: `dotnet build Contoso.Billing.sln`
- **Test**: `dotnet test Contoso.Billing.sln`
- **Lint**: `dotnet format Contoso.Billing.sln`
## Project Structure
- Source: `src/Contoso.Billing/`
- Tests: `tests/Contoso.Billing.Tests/` (exists, empty)
## Files to Test
### High Priority
| File | Classes/Functions | Testability | Notes |
|------|-------------------|-------------|-------|
| src/Contoso.Billing/InvoiceService.cs | InvoiceService: CalculateTotal, GetByIdAsync, MarkAsPaidAsync | High | Core business logic, repository dependency needs mocking |
### Low Priority / Skip
| File | Reason |
|------|--------|
| src/Contoso.Billing/Invoice.cs | Data model, no logic |
| src/Contoso.Billing/IInvoiceRepository.cs | Interface, no implementation |
## Existing Tests
- No existing tests found
## Existing Test Projects
- **Project file**: `tests/Contoso.Billing.Tests/Contoso.Billing.Tests.csproj`
- **Target source project**: `src/Contoso.Billing/Contoso.Billing.csproj`
- **Test files**: none
## Testing Patterns
- No existing patterns; recommend sealed test classes, AAA structure, `Moq` for mocking IInvoiceRepository
## Recommendations
- Start with InvoiceService.CalculateTotal (pure logic, easy to test)
- Then async methods (require mocking IInvoiceRepository)Sample Plan Output
What code-testing-planner produces in <TESTAGENT_DIR>/plan.md:
# Test Implementation Plan
## Overview
Generate MSTest 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
- **Build**: `dotnet build tests/Contoso.Billing.Tests/Contoso.Billing.Tests.csproj`
- **Test**: `dotnet test tests/Contoso.Billing.Tests/Contoso.Billing.Tests.csproj`
- **Lint**: `dotnet format --include tests/Contoso.Billing.Tests/`
## Phase Summary
| Phase | Focus | Files | Est. Tests |
|-------|-------|-------|------------|
| 1 | InvoiceService | 1 | 9-12 |
---
## Phase 1: InvoiceService
### Overview
Cover all public methods of InvoiceService. CalculateTotal is pure logic tested
with DataRow. Async methods require a mocked IInvoiceRepository.
### Files to Test
#### 1. InvoiceService.cs
- **Source**: `src/Contoso.Billing/InvoiceService.cs`
- **Test File**: `tests/Contoso.Billing.Tests/InvoiceServiceTests.cs`
- **Test Class**: `InvoiceServiceTests`
**Methods to Test**:
1. `CalculateTotal` — 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: null invoice throws ArgumentNullException
- Error case: empty line items throws InvalidOperationException
2. `GetByIdAsync` — Repository lookup
- Happy path: existing ID returns invoice
- Error case: non-existent ID throws KeyNotFoundException
3. `MarkAsPaidAsync` — State transition
- Happy path: unpaid invoice transitions to Paid with PaidDate set
- Error case: already paid throws InvalidOperationException
- Error case: non-existent ID throws KeyNotFoundException
### Success Criteria
- [ ] All test files created
- [ ] Tests compile with `dotnet build`
- [ ] All tests pass with `dotnet test`Sample Generated Test File
What code-testing-implementer produces:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Contoso.Billing;
namespace Contoso.Billing.Tests;
[TestClass]
public sealed class InvoiceServiceTests
{
private readonly Mock<IInvoiceRepository> _repositoryMock = new();
private readonly InvoiceService _sut;
public InvoiceServiceTests()
{
_sut = new InvoiceService(_repositoryMock.Object);
}
// --- CalculateTotal ---
[TestMethod]
[DataRow(1, 100.00, 0.10, 110.00, DisplayName = "Single item with 10% tax")]
[DataRow(3, 25.00, 0.0, 75.00, DisplayName = "Multiple quantity, zero tax")]
public void CalculateTotal_ValidLineItems_ReturnsExpectedTotal(
int quantity, double unitPrice, double taxRate, double expected)
{
// Arrange
var invoice = new Invoice
{
TaxRate = (decimal)taxRate,
LineItems = [new LineItem { Quantity = quantity, UnitPrice = (decimal)unitPrice }]
};
// Act
var total = _sut.CalculateTotal(invoice);
// Assert
Assert.AreEqual((decimal)expected, total);
}
[TestMethod]
public void CalculateTotal_NullInvoice_ThrowsArgumentNullException()
{
Assert.ThrowsExactly<ArgumentNullException>(() => _sut.CalculateTotal(null!));
}
[TestMethod]
public void CalculateTotal_EmptyLineItems_ThrowsInvalidOperationException()
{
// Arrange
var invoice = new Invoice { LineItems = [] };
// Act & Assert
Assert.ThrowsExactly<InvalidOperationException>(() => _sut.CalculateTotal(invoice));
}
// --- GetByIdAsync ---
[TestMethod]
public async Task GetByIdAsync_ExistingId_ReturnsInvoice()
{
// Arrange
var expected = new Invoice { Id = 42 };
_repositoryMock.Setup(r => r.FindAsync(42)).ReturnsAsync(expected);
// Act
var result = await _sut.GetByIdAsync(42);
// Assert
Assert.AreSame(expected, result);
}
[TestMethod]
public async Task GetByIdAsync_NonExistentId_ThrowsKeyNotFoundException()
{
// Arrange
_repositoryMock.Setup(r => r.FindAsync(999)).ReturnsAsync((Invoice?)null);
// Act & Assert
await Assert.ThrowsExactlyAsync<KeyNotFoundException>(
() => _sut.GetByIdAsync(999));
}
// --- MarkAsPaidAsync ---
[TestMethod]
public async Task MarkAsPaidAsync_UnpaidInvoice_SetsStatusAndDate()
{
// Arrange
var invoice = new Invoice { Id = 1, Status = InvoiceStatus.Pending };
_repositoryMock.Setup(r => r.FindAsync(1)).ReturnsAsync(invoice);
// Act
await _sut.MarkAsPaidAsync(1);
// Assert
Assert.AreEqual(InvoiceStatus.Paid, invoice.Status);
Assert.IsNotNull(invoice.PaidDate);
_repositoryMock.Verify(r => r.UpdateAsync(invoice), Times.Once);
}
[TestMethod]
public async Task MarkAsPaidAsync_AlreadyPaid_ThrowsInvalidOperationException()
{
// Arrange
var invoice = new Invoice { Id = 1, Status = InvoiceStatus.Paid };
_repositoryMock.Setup(r => r.FindAsync(1)).ReturnsAsync(invoice);
// Act & Assert
await Assert.ThrowsExactlyAsync<InvalidOperationException>(
() => _sut.MarkAsPaidAsync(1));
}
}Sample Fix Cycle
When the implementer encounters a build error, the fixer agent diagnoses and resolves it:
Build output:
error CS0246: The type or namespace name 'Moq' could not be found (are you missing a using directive or an assembly reference?)Fixer diagnosis: The test project is missing the Moq NuGet package.
Fix applied:
dotnet add tests/Contoso.Billing.Tests/Contoso.Billing.Tests.csproj package MoqRebuild: dotnet build tests/Contoso.Billing.Tests/Contoso.Billing.Tests.csproj → SUCCESS
Another common cycle:
Build output:
error CS7036: There is no argument given that corresponds to the required parameter 'repository' of 'InvoiceService.InvoiceService(IInvoiceRepository)'Fixer diagnosis: Test code instantiated new InvoiceService() without passing the required constructor parameter. The source uses a primary constructor with an IInvoiceRepository dependency.
Fix applied:
// Before (wrong)
var sut = new InvoiceService();
// After (fixed)
var repositoryMock = new Mock<IInvoiceRepository>();
var sut = new InvoiceService(repositoryMock.Object);Rebuild: SUCCESS
Sample Final Report
What test-engineer produces at Step 9:
## Test Generation Report
**Project**: Contoso.Billing
**Strategy**: Single pass
### Results
| Metric | Value |
|----------------|-------|
| Tests created | 9 |
| Tests passing | 9 |
| Tests failing | 0 |
| Files created | 1 |
### Files Created
- `tests/Contoso.Billing.Tests/InvoiceServiceTests.cs` (9 tests)
### Coverage
- InvoiceService.CalculateTotal — 3 happy path, 2 error cases
- InvoiceService.GetByIdAsync — 1 happy path, 1 error case
- InvoiceService.MarkAsPaidAsync — 1 happy path, 1 error case
### Build Validation
- Scoped build: ✅ passed
- Full solution build (`dotnet build --no-incremental`): ✅ passed
### Next Steps
- Add integration tests for repository layer if needed
- Consider testing with multiple line items for CalculateTotalRequirements 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