Skip to content
consulthunterPublic

About

Automated C# Test Extraction

Resources

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

DOI License Language arXiv

TestMap

TestMap is a C# repository analysis and test-generation evaluation tool. It ingests repositories, builds a persisted model of their source and test code, collects coverage and mutation evidence, and uses that evidence to evaluate LLM-generated tests and agentic coding tools.

The core idea is simple: make test-generation experiments measurable. TestMap records what code was targeted, what evidence was provided, what files changed, whether the generated tests compiled and ran, and how coverage and mutation scores changed.

What TestMap Does

  • Clones or reuses C# repositories listed in a target file.
  • Discovers solutions, projects, source files, test files, and test frameworks.
  • Uses Roslyn and repository analysis to persist code entities and source/test relationships.
  • Runs build, test, coverage, mutation, code-metric, and test-smell collection workflows.
  • Selects candidate methods for test generation from existing tests, coverage gaps, mutation data, or metric-driven improvement signals.
  • Runs the built-in LLM generation lane and optional Docker-based agent tool lanes.
  • Persists generation attempts, tool attempts, validation outcomes, changed-file data, token usage where available, and result rows for later analysis.

Directory Layout

TestMap/                      .NET application, config, Docker images, migrations, outputs
TestMap/Config/               example and experiment configuration JSON files
TestMap/Docker/               validation and agent-tool Docker runners
TestMap/Migrations/           EF Core migrations for project/output databases
TestMap/Data/                 pinned YAML target manifests
TestMap.UnitTests/            unit test project
TestMap.IntegrationTests/     integration tests (migration schema, real MSBuild workspace, git)
TestMap.EndToEndTests/        end-to-end command tests
Docs/                         user-facing documentation
specs/                        feature specifications and implementation plans
Analysis/                     Python analysis package, notebooks, and R models for result datasets
Replication/                  replication material for the published studies

Main Commands

dotnet run --project .\TestMap\TestMap.csproj -- setup
dotnet run --project .\TestMap\TestMap.csproj -- check-projects --file .\TestMap\Data\example.yaml
dotnet run --project .\TestMap\TestMap.csproj -- collect-tests --config .\TestMap\Config\default-config.json
dotnet run --project .\TestMap\TestMap.csproj -- generate-tests --config .\TestMap\Config\default-config.json
dotnet run --project .\TestMap\TestMap.csproj -- experiment --config .\TestMap\Config\default-config.json

check-projects screens the exact commit in each pinned YAML target. It publishes a complete YAML report plus directly reusable tests-detected and no-tests-detected target manifests. Repository, commit, and source provenance are preserved; access failures and incomplete provider trees remain indeterminate instead of being treated as evidence that tests are absent. Exit code 2 means an auditable bundle was published but the screening set is incomplete.

Note: generate-tests is experimental. For measured evaluation runs, prefer experiment (see Stable And Experimental Surfaces).

Documentation

  • Research Constitution: non-negotiable principles for reproducibility, measurement validity, lane fairness, provenance, and research review.
  • Setup: dependencies, first-time setup, .env, Docker images, and a first example run.
  • Configuration: config model, override rules, tool model settings, secrets, and experimental switches.
  • How It Works: high-level architecture and execution flow.
  • How To Use: regular generation, experiments, tool evaluation, outputs, and practical workflows.
  • Analysis: building evaluation and MSR datasets from experiment outputs, with the data reference for every derived column.
  • Replication: data and steps for reproducing the published studies.

Stable And Experimental Surfaces

The repository ingestion, analysis, persistence, and validation plumbing are the platform layers. The LLM generation lane, repair loops, metric-driven target selection, and agentic tool comparison are active evaluation surfaces. They are useful, but should be run with small candidate limits first and interpreted as experiment results rather than product guarantees.

The standalone generate-tests command is experimental — it runs the built-in LLM pipeline outside the controlled experiment harness. Use it for ad hoc generation only; use experiment for anything you intend to measure or report.

For Basic Extension generation, keep EnableSpeculativePlanning disabled unless you are deliberately running an ablation. The one-shot structured patch path is the recommended default.

Pinned Repository Experiments

Measured experiment runs consume an immutable YAML target manifest rather than a URL list. Each target binds owner/repository to a full 40-character commit SHA, and TestMap records the requested and resolved revisions in SQLite and schema 3.0 result CSVs. Create and verify a manifest before a pilot:

dotnet run --project TestMap -- targets create --input targets.csv --output targets.yaml
dotnet run --project TestMap -- targets verify --file targets.yaml
dotnet run --project TestMap -- experiment --config TestMap/Config/pinned-target-experiment.example.json

For one GitHub repository, the CSV step is optional:

dotnet run --project TestMap -- targets create `
  --url https://github.com/powershell/platyps `
  --output TestMap/Output/platyps-targets.yaml

URL mode resolves the named default branch and its exact Git commit, confirms repository metadata, then publishes a content-addressed resolution record before the schema-3 manifest. It uses GITHUB_TOKEN when present and records only authenticated or anonymous, never the credential. Downstream commands verify the linked record locally and keep using the recorded commit even if the remote branch later moves. A valid URL that cannot be resolved leaves a categorized resolution record but does not create or replace a target manifest. CSV creation remains the schema-1 workflow.

Discovery commands may still consume documented URL lists. Experiment mode rejects them because an unpinned branch tip cannot support reproducible lane comparisons.

About

Automated C# Test Extraction

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages