SuperAPI AI Directory

dotnet-test

Testing & quality

View repository

Updated 10-15 22:16

About this skill

.NET Test Skill (Entry Map)

Goal: Guide the exact testing procedure.

Quick Start (Choose One)

  • Run Unit Tests → references/run-unit-tests.md
  • Generate Coverage Report → references/generate-coverage.md
  • Run Benchmarks → references/run-benchmarks.md

When to Use

  • Running unit tests (xUnit, NUnit)
  • Generating code coverage reports using coverlet
  • Performing performance benchmarks using BenchmarkDotNet
  • Verifying code changes through the test suite
  • Measuring test execution time

Do not use in the following cases: Code build (dotnet-build), formatting (code-format), or static analysis (code-analyze)

Inputs & Outputs

Input: target (all/project/specific), configuration (Debug/Release), coverage (true/false), project_path (default: all test projects)

Output: Test results (pass/fail counts), coverage report (when requested), benchmark results, exit code (0=success)

Guardrails: Work only within the ./dotnet directory, report failures clearly, and do not skip tests without permission.

Navigation

1. Run Unit Tests → references/run-unit-tests.md

  • Run all tests, run tests for a specific project, troubleshoot test failures

2. Generate Coverage Report → references/generate-coverage.md

  • Collect coverage data, generate reports (HTML/Cobertura), analyze coverage metrics

3. Run Benchmarks → references/run-benchmarks.md

  • Perform performance benchmarks, compare results, data-driven optimization

Common Patterns

Run all tests (fast)

cd ./dotnet
dotnet test

Run tests with detailed output

cd ./dotnet
dotnet test --verbosity normal

Run a specific test project

cd ./dotnet
dotnet test console-app.Tests/PigeonPea.Console.Tests.csproj

Run tests with coverage

cd ./dotnet
dotnet test --collect:"XPlat Code Coverage"

Run tests and generate coverage report

cd ./dotnet
dotnet test --collect:"XPlat Code Coverage" --results-directory ./TestResults
# 커버리지 파일: ./TestResults/{guid}/coverage.cobertura.xml

Filter tests by name

cd ./dotnet
dotnet test --filter "FullyQualifiedName~FrameTests"

Filter tests by category

cd ./dotnet
dotnet test --filter "Category=Unit"

Run tests in Release configuration

cd ./dotnet
dotnet test --configuration Release

Run benchmarks

cd ./dotnet/benchmarks
dotnet run -c Release

Troubleshooting

Test failure: Check the test output for assertion failures. For debugging, refer to references/run-unit-tests.md.

Coverage not generated: Check that coverlet.collector is installed. Refer to references/generate-coverage.md.

Benchmark execution failure: You must use the Release configuration. Refer to references/run-benchmarks.md.

Slow test execution: Use test filters, parallel execution, or the --no-build option after building.

Test discovery failure: Check project references and verify that the test framework package is installed.

Success Indicators

Passed!  - Failed:     0, Passed:    42, Skipped:     0, Total:    42

Test artifact location: ./dotnet/TestResults/

Coverage report location: ./dotnet/TestResults/coverage.cobertura.xml

Integration

Before testing: dotnet-build (verify the code builds) After testing: code-analyze (static analysis), code-review (quality check)

Test framework

This repository uses:

  • for unit tests xUnit (console-app.Tests, shared-app.Tests, windows-app.Tests)
  • for code coverage coverlet.collector
  • for performance benchmarks BenchmarkDotNet

Related links (Related)