Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ae85afa
Added timeout property
marcominerva Sep 1, 2026
23395d4
Rename RequestTimeout to AttemptTimeout; update tests
marcominerva Sep 1, 2026
2b91be6
Rename namespace to SimpleRetry; update docs and usages
marcominerva Sep 1, 2026
ff018eb
Add StandardResilienceHandler and AddHttpSimpleRetry
marcominerva Sep 1, 2026
4bf36db
Refactor retry logic to use RetryOutcome struct
marcominerva Sep 2, 2026
f1cbade
Merge branch 'outcome' into timeout
marcominerva Sep 2, 2026
df38534
Refactor HTTP retry logic into dedicated handler
marcominerva Sep 2, 2026
810156e
Document new result-based retry features and options
marcominerva Sep 2, 2026
9ef3340
Safely invoke ShouldHandle, default to retry if null
marcominerva Sep 2, 2026
97511ac
Change RetryOutcome ctor param order for clarity
marcominerva Sep 4, 2026
48af1f9
Remove <inheritdoc /> from ExecuteAsync methods
marcominerva Sep 4, 2026
7b8a54d
Target net8.0/net9.0; update deps; set LangVersion to latest
marcominerva Sep 4, 2026
23d0a11
Refactor timeout logic in DefaultRetryExecutor
marcominerva Sep 7, 2026
2c77e75
Increase MaxRetryCount to 3 in retry logic test
marcominerva Sep 7, 2026
48469c8
Add centralized build props and GitVersioning config
marcominerva Sep 10, 2026
4c18db3
Add options for buffering and cloning requests in retries
marcominerva Sep 11, 2026
e84dfe8
Improve pattern matching and nullability annotations
marcominerva Sep 14, 2026
4841d71
Merge commit
marcominerva Sep 14, 2026
4825dd1
Refactor AddRetryExecutor to block-bodied method
marcominerva Sep 14, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
176 changes: 176 additions & 0 deletions .github/skills/assertion-quality/skill.md

Large diffs are not rendered by default.

111 changes: 111 additions & 0 deletions .github/skills/code-testing-agent/extensions/dotnet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# .NET Extension

Language-specific guidance for .NET (C#/F#/VB) test generation.

## Build Commands

| Scope | Command |
|-------|---------|
| Specific test project | `dotnet build MyProject.Tests.csproj` |
| Full solution (final validation) | `dotnet build MySolution.sln --no-incremental` |
| From repo root (no .sln) | `dotnet build --no-incremental` |

- Use `--no-restore` if dependencies are already restored
- Use `-v:q` (quiet) to reduce output noise
- Always use `--no-incremental` for the final validation build — incremental builds hide errors like CS7036

## Test Commands

| Scope | Command |
|-------|---------|
| All tests | `dotnet test` |
| Filtered | `dotnet test --filter "FullyQualifiedName~ClassName"` |
| After build | `dotnet test --no-build` |

- Use `--no-build` if already built
- Use `-v:q` for quieter output

## Lint Command

```bash
dotnet format --include path/to/file.cs
dotnet format MySolution.sln # full solution
```

## Project Reference Validation

Before writing test code, read the test project's `.csproj` to verify it has `<ProjectReference>` entries for the assemblies your tests will use. If a reference is missing, add it:

```xml
<ItemGroup>
<ProjectReference Include="../SourceProject/SourceProject.csproj" />
</ItemGroup>
```

This prevents CS0234 ("namespace not found") and CS0246 ("type not found") errors.

## Common CS Error Codes

| Error | Meaning | Fix |
|-------|---------|-----|
| CS0234 | Namespace not found | Add `<ProjectReference>` to the source project in the test `.csproj` |
| CS0246 | Type not found | Add `using Namespace;` or add missing `<ProjectReference>` |
| CS0103 | Name not found | Check spelling, add `using` statement |
| CS1061 | Missing member | Verify method/property name matches the source code exactly |
| CS0029 | Type mismatch | Cast or change the type to match the expected signature |
| CS7036 | Missing required parameter | Read the constructor/method signature and pass all required arguments |

## `.csproj` / `.sln` Handling

- During phase implementation, build only the specific test `.csproj` for speed
- For the final validation, build the full `.sln` with `--no-incremental`
- Full-solution builds catch cross-project reference errors invisible in scoped builds

## MSTest Template

```csharp
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace ProjectName.Tests;

[TestClass]
public sealed class ClassNameTests
{
[TestMethod]
public void MethodName_Scenario_ExpectedResult()
{
// Arrange
var sut = new ClassName();

// Act
var result = sut.MethodName(input);

// Assert
Assert.AreEqual(expected, result);
}

[TestMethod]
[DataRow(2, 3, 5, DisplayName = "Positive numbers")]
[DataRow(-1, 1, 0, DisplayName = "Negative and positive")]
public void Add_ValidInputs_ReturnsSum(int a, int b, int expected)
{
// Act
var result = _sut.Add(a, b);

// Assert
Assert.AreEqual(expected, result);
}
}
```

## Coverage XML Parsing

If `.testagent/initial_coverage.xml` exists, it uses Cobertura/VS format:

- `module` elements with `line_coverage` attribute — identifies which assemblies have low coverage
- `function` elements with `line_coverage="0.00"` — identifies completely untested methods
- `range` elements with `covered="no"` — identifies specific uncovered lines

## Skip Coverage Tools

Do not configure or run code coverage measurement tools (coverlet, dotnet-coverage, XPlat Code Coverage). These tools have inconsistent cross-configuration behavior and waste significant time. Coverage is measured separately by the evaluation harness.
197 changes: 197 additions & 0 deletions .github/skills/code-testing-agent/skill.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
---
name: code-testing-agent
description: >-
Generates comprehensive, workable unit tests for any programming language
using a multi-agent pipeline. Use when asked to generate tests, write unit
tests, improve test coverage, add test coverage, create test files, or test a
codebase. Supports C#, TypeScript, JavaScript, Python, Go, Rust, Java, and
more. Orchestrates research, planning, and implementation phases to produce
tests that compile, pass, and follow project conventions.
---

# Code Testing Generation Skill

An AI-powered skill that generates comprehensive, workable unit tests for any programming language using a coordinated multi-agent pipeline.

## When to Use This Skill

Use this skill when you need to:

- Generate unit tests for an entire project or specific files
- Improve test coverage for existing codebases
- Create test files that follow project conventions
- Write tests that actually compile and pass
- Add tests for new features or untested code

## When Not to Use

- Running or executing existing tests (use the `run-tests` skill)
- Migrating between test frameworks (use migration skills)
- Writing tests specifically for MSTest patterns (use `writing-mstest-tests`)
- Debugging failing test logic

## How It Works

This skill coordinates multiple specialized agents in a **Research → Plan → Implement** pipeline:

### Pipeline Overview

```
┌─────────────────────────────────────────────────────────────┐
│ TEST GENERATOR │
│ Coordinates the full pipeline and manages state │
└─────────────────────┬───────────────────────────────────────┘
┌─────────────┼─────────────┐
▼ ▼ ▼
┌───────────┐ ┌───────────┐ ┌───────────────┐
│ RESEARCHER│ │ PLANNER │ │ IMPLEMENTER │
│ │ │ │ │ │
│ Analyzes │ │ Creates │ │ Writes tests │
│ codebase │→ │ phased │→ │ per phase │
│ │ │ plan │ │ │
└───────────┘ └───────────┘ └───────┬───────┘
┌─────────┬───────┼───────────┐
▼ ▼ ▼ ▼
┌─────────┐ ┌───────┐ ┌───────┐ ┌───────┐
│ BUILDER │ │TESTER │ │ FIXER │ │LINTER │
│ │ │ │ │ │ │ │
│ Compiles│ │ Runs │ │ Fixes │ │Formats│
│ code │ │ tests │ │ errors│ │ code │
└─────────┘ └───────┘ └───────┘ └───────┘
```

## Step-by-Step Instructions

### Step 1: Determine the user request

Make sure you understand what user is asking and for what scope.
When the user does not express strong requirements for test style, coverage goals, or conventions, source the guidelines from [unit-test-generation.prompt.md](unit-test-generation.prompt.md). This prompt provides best practices for discovering conventions, parameterization strategies, coverage goals (aim for 80%), and language-specific patterns.

### Step 2: Invoke the Test Generator

Start by calling the `code-testing-generator` agent with your test generation request:

```
Generate unit tests for [path or description of what to test], following the [unit-test-generation.prompt.md](unit-test-generation.prompt.md) guidelines
```

The Test Generator will manage the entire pipeline automatically.

### Step 3: Research Phase (Automatic)

The `code-testing-researcher` agent analyzes your codebase to understand:

- **Language & Framework**: Detects C#, TypeScript, Python, Go, Rust, Java, etc.
- **Testing Framework**: Identifies MSTest, xUnit, Jest, pytest, go test, etc.
- **Project Structure**: Maps source files, existing tests, and dependencies
- **Build Commands**: Discovers how to build and test the project

Output: `.testagent/research.md`

### Step 4: Planning Phase (Automatic)

The `code-testing-planner` agent creates a structured implementation plan:

- Groups files into logical phases (2-5 phases typical)
- Prioritizes by complexity and dependencies
- Specifies test cases for each file
- Defines success criteria per phase

Output: `.testagent/plan.md`

### Step 5: Implementation Phase (Automatic)

The `code-testing-implementer` agent executes each phase sequentially:

1. **Read** source files to understand the API
2. **Write** test files following project patterns
3. **Build** using the `code-testing-builder` sub-agent to verify compilation
4. **Test** using the `code-testing-tester` sub-agent to verify tests pass
5. **Fix** using the `code-testing-fixer` sub-agent if errors occur
6. **Lint** using the `code-testing-linter` sub-agent for code formatting

Each phase completes before the next begins, ensuring incremental progress.

### Coverage Types

- **Happy path**: Valid inputs produce expected outputs
- **Edge cases**: Empty values, boundaries, special characters
- **Error cases**: Invalid inputs, null handling, exceptions

## State Management

All pipeline state is stored in `.testagent/` folder:

| File | Purpose |
| ------------------------ | ---------------------------- |
| `.testagent/research.md` | Codebase analysis results |
| `.testagent/plan.md` | Phased implementation plan |
| `.testagent/status.md` | Progress tracking (optional) |

## Examples

### Example 1: Full Project Testing

```
Generate unit tests for my Calculator project at C:\src\Calculator
```

### Example 2: Specific File Testing

```
Generate unit tests for src/services/UserService.ts
```

### Example 3: Targeted Coverage

```
Add tests for the authentication module with focus on edge cases
```

## Agent Reference

| Agent | Purpose |
| -------------------------- | -------------------- |
| `code-testing-generator` | Coordinates pipeline |
| `code-testing-researcher` | Analyzes codebase |
| `code-testing-planner` | Creates test plan |
| `code-testing-implementer` | Writes test files |
| `code-testing-builder` | Compiles code |
| `code-testing-tester` | Runs tests |
| `code-testing-fixer` | Fixes errors |
| `code-testing-linter` | Formats code |

## Requirements

- Project must have a build/test system configured
- Testing framework should be installed (or installable)
- VS Code with GitHub Copilot extension

## Troubleshooting

### Tests don't compile

The `code-testing-fixer` agent will attempt to resolve compilation errors. Check `.testagent/plan.md` for the expected test structure. Check the `extensions/` folder for language-specific error code references (e.g., `extensions/dotnet.md` for .NET).

### Tests fail

Most failures in generated tests are caused by **wrong expected values in assertions**, not production code bugs:

1. Read the actual test output
2. Read the production code to understand correct behavior
3. Fix the assertion, not the production code
4. Never mark tests `[Ignore]` or `[Skip]` just to make them pass

### Wrong testing framework detected

Specify your preferred framework in the initial request: "Generate Jest tests for..."

### Environment-dependent tests fail

Tests that depend on external services, network endpoints, specific ports, or precise timing will fail in CI environments. Focus on unit tests with mocked dependencies instead.

### Build fails on full solution

During phase implementation, build only the specific test project for speed. After all phases, run a full non-incremental workspace build to catch cross-project errors.
Loading