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/powershell-examples.md
PowerShell Pipeline Examples
Concrete input→output examples for the test generation pipeline targeting a PowerShell module using Pester v5. These show what each pipeline phase produces for a small module.
Source Under Test
A simple InvoiceService module:
src/
Contoso.Billing.psd1
Contoso.Billing.psm1
Tests/ (empty)# src/Contoso.Billing.psm1
enum InvoiceStatus {
Pending
Paid
}
function Get-InvoiceTotal {
[CmdletBinding()]
param([Parameter(Mandatory)][pscustomobject]$Invoice)
if (-not $Invoice.LineItems -or $Invoice.LineItems.Count -eq 0) {
throw 'Invoice has no line items.'
}
$subtotal = 0
foreach ($lineItem in $Invoice.LineItems) {
$subtotal += $lineItem.Quantity * $lineItem.UnitPrice
}
[math]::Round($subtotal + ($subtotal * $Invoice.TaxRate), 2)
}
function Get-InvoiceById {
[CmdletBinding()]
param([Parameter(Mandatory)][int]$Id, [Parameter(Mandatory)][scriptblock]$FindInvoice)
$invoice = & $FindInvoice $Id
if ($null -eq $invoice) {
throw "Invoice $Id not found."
}
$invoice
}
function Set-InvoicePaid {
[CmdletBinding()]
param(
[Parameter(Mandatory)][int]$Id,
[Parameter(Mandatory)][scriptblock]$FindInvoice,
[Parameter(Mandatory)][scriptblock]$UpdateInvoice,
[scriptblock]$GetNow = { Get-Date }
)
$invoice = Get-InvoiceById -Id $Id -FindInvoice $FindInvoice
if ($invoice.Status -eq [InvoiceStatus]::Paid) {
throw 'Invoice is already paid.'
}
$invoice.Status = [InvoiceStatus]::Paid
$invoice.PaidDate = & $GetNow
& $UpdateInvoice $invoice
}
Export-ModuleMember -Function Get-InvoiceTotal, Get-InvoiceById, Set-InvoicePaidSample Research Output
What code-testing-researcher produces in <TESTAGENT_DIR>/research.md:
# Test Generation Research
## Project Overview
- **Path**: C:\work\contoso-billing
- **Language**: PowerShell 7.4
- **Module**: `src/Contoso.Billing.psd1` imports `Contoso.Billing.psm1`
- **Test Framework**: Pester v5
## Coverage Baseline
- **Initial Line Coverage**: unknown
- **Strategy**: broad
- **Existing Test Count**: 0 tests across 0 files
## Build & Test Commands
- **Module load**: `Import-Module ./src/Contoso.Billing.psd1 -Force -ErrorAction Stop`
- **Discovery**: `Invoke-Pester -Configuration @{ Run = @{ Path = './Tests'; PassThru = $true; SkipRun = $true } }`
- **Test**: `Invoke-Pester -Path ./Tests -Output Detailed`
## Files to Test
### High Priority
| File | Functions | Testability | Notes |
|------|-----------|-------------|-------|
| src/Contoso.Billing.psm1 | Get-InvoiceTotal, Get-InvoiceById, Set-InvoicePaid | High | Dependencies are scriptblocks, easy to fake; clock is injectable |
## Testing Patterns
- No existing patterns; recommend Pester v5 `Describe` / `Context` / `It`, top-level `using module ../src/Contoso.Billing.psd1` for the module-defined enum, `-TestCases` for total calculations, and scriptblock fakes for repository operations.Sample Plan Output
# Test Implementation Plan
## Overview
Generate Pester v5 tests for total calculation, repository lookup, and the
paid-state transition. Single phase since there is one module file.
## Commands
- **Import**: `Import-Module ./src/Contoso.Billing.psd1 -Force -ErrorAction Stop`
- **Test**: `Invoke-Pester -Path ./Tests/Contoso.Billing.Tests.ps1 -Output Detailed`
## Phase 1: Contoso.Billing
### Files to Test
- **Source**: `src/Contoso.Billing.psm1`
- **Test File**: `Tests/Contoso.Billing.Tests.ps1`
**Functions to Test**:
1. `Get-InvoiceTotal` — table-driven happy paths and empty-line-items error
2. `Get-InvoiceById` — existing invoice and missing invoice
3. `Set-InvoicePaid` — status/date update and persistence; already-paid error; missing invoice errorSample Generated Test File
# Tests/Contoso.Billing.Tests.ps1
using module ../src/Contoso.Billing.psd1
BeforeAll {
function New-TestInvoice {
param(
[int]$Id = 1,
[InvoiceStatus]$Status = [InvoiceStatus]::Pending,
[double]$TaxRate = 0.10,
[object[]]$LineItems = @(@{ Quantity = 1; UnitPrice = 100.00 })
)
[pscustomobject]@{
Id = $Id
Status = $Status
TaxRate = $TaxRate
LineItems = $LineItems
PaidDate = $null
}
}
}
Describe 'Contoso.Billing invoice functions' {
Context 'Get-InvoiceTotal' {
It 'returns <Expected> for <Name>' -TestCases @(
@{ Name = 'single item with tax'; LineItems = @(@{ Quantity = 1; UnitPrice = 100.00 }); TaxRate = 0.10; Expected = 110.00 }
@{ Name = 'multi quantity zero tax'; LineItems = @(@{ Quantity = 3; UnitPrice = 25.00 }); TaxRate = 0.00; Expected = 75.00 }
@{ Name = 'rounds to two decimals'; LineItems = @(@{ Quantity = 2; UnitPrice = 9.99 }); TaxRate = 0.07; Expected = 21.38 }
) {
param($LineItems, $TaxRate, $Expected)
$invoice = New-TestInvoice -LineItems $LineItems -TaxRate $TaxRate
Get-InvoiceTotal -Invoice $invoice | Should -BeExactly $Expected
}
It 'throws when the invoice has no line items' {
$invoice = New-TestInvoice -LineItems @()
{ Get-InvoiceTotal -Invoice $invoice } | Should -Throw '*no line items*'
}
}
Context 'Get-InvoiceById' {
It 'returns an existing invoice' {
$expected = New-TestInvoice -Id 42
$findInvoice = { param($Id) if ($Id -eq 42) { $expected } }
$result = Get-InvoiceById -Id 42 -FindInvoice $findInvoice
[object]::ReferenceEquals($result, $expected) | Should -BeTrue
}
It 'throws when the invoice is missing' {
$findInvoice = { $null }
{ Get-InvoiceById -Id 999 -FindInvoice $findInvoice } | Should -Throw '*999*'
}
}
Context 'Set-InvoicePaid' {
It 'marks a pending invoice as paid and persists it' {
$invoice = New-TestInvoice -Id 1
$script:updatedInvoice = $null
$fixedNow = [datetime]'2025-01-01T12:00:00Z'
$findInvoice = { param($Id) if ($Id -eq 1) { $invoice } }
$updateInvoice = { param($Invoice) $script:updatedInvoice = $Invoice }
Set-InvoicePaid -Id 1 -FindInvoice $findInvoice -UpdateInvoice $updateInvoice -GetNow { $fixedNow }
$invoice.Status | Should -Be ([InvoiceStatus]::Paid)
$invoice.PaidDate | Should -Be $fixedNow
[object]::ReferenceEquals($script:updatedInvoice, $invoice) | Should -BeTrue
}
It 'throws and does not update an already-paid invoice' {
$invoice = New-TestInvoice -Status ([InvoiceStatus]::Paid)
$script:updatedInvoice = $null
$findInvoice = { $invoice }
$updateInvoice = { param($Invoice) $script:updatedInvoice = $Invoice }
{ Set-InvoicePaid -Id 1 -FindInvoice $findInvoice -UpdateInvoice $updateInvoice } | Should -Throw '*already paid*'
$script:updatedInvoice | Should -BeNullOrEmpty
}
It 'throws and does not update a missing invoice' {
$findInvoice = { $null }
$script:wasUpdated = $false
$updateInvoice = { param($Invoice) $script:wasUpdated = $true }
{ Set-InvoicePaid -Id 999 -FindInvoice $findInvoice -UpdateInvoice $updateInvoice } | Should -Throw -ExpectedMessage 'Invoice 999 not found.'
$script:wasUpdated | Should -BeFalse
}
}
}Sample Fix Cycle
When the implementer hits a Pester discovery or run issue, the fixer agent diagnoses and resolves it.
Test output:
Unable to find type [InvoiceStatus].Fixer diagnosis: Runtime Import-Module does not make a module-defined enum available while the test script is parsed. using module must appear at the top of the file and use a literal path relative to the test script.
Fix applied: Add top-level using module ../src/Contoso.Billing.psd1 and remove the runtime import (as shown above). For identity assertions use [object]::ReferenceEquals(...) | Should -BeTrue; Pester v5 does not provide Should -BeSame.
Rerun: Invoke-Pester -Path ./Tests/Contoso.Billing.Tests.ps1 -Output Detailed → SUCCESS
Sample Final Report
## Test Generation Report
**Project**: contoso-billing (PowerShell)
**Strategy**: Direct (single module in scope)
### Results
| Metric | Value |
|----------------|-------|
| Tests created | 9 |
| Tests passing | 9 |
| Tests failing | 0 |
| Files created | 1 |
### Files Created
- `Tests/Contoso.Billing.Tests.ps1` (9 Pester invocations: 6 ordinary examples and 3 data-driven total rows)
### Coverage
- Get-InvoiceTotal — 3 happy path, 1 error case
- Get-InvoiceById — found and missing branches
- Set-InvoicePaid — success, already-paid and missing-invoice branches; error cases do not update the repository
### Build / Test Validation
- Module load: ✅ `Import-Module ./src/Contoso.Billing.psd1 -Force -ErrorAction Stop`
- Discovery: ✅ Pester found 9 tests
- Test run: ✅ `Invoke-Pester -Path ./Tests -Output Detailed`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