Agent skill

qa-testing-nunit

Design and refactor C# test suites with NUnit for API, component, and integration scenarios. Use when creating or fixing NUnit fixtures, structuring test projects, setting up WireMock and Testcontainers dependencies, and reducing flaky behavior in CI or local runs. For general backend service implementation use $software-csharp-backend, for pipeline target changes use $ops-nuke-cicd, and for logging-migration rewrites use $dev-structured-logs.

Stars 50
Forks 11

Install this agent skill to your Project

npx add-skill https://github.com/vasilyu1983/AI-Agents-public/tree/main/frameworks/shared-skills/skills/qa-testing-nunit

SKILL.md

C# Testing NUnit Fixtures

Quick Reference

  • Classify test scope first: API, component, or integration.
  • Lock runtime constraints before execution: Docker availability, framework target, and explicitly excluded suites.
  • Use this skill for test-suite architecture and fixture behavior, not for general service implementation or CI graph refactors.
  • Default to two files per handler/use case: <Feature>Fixture.cs and <Feature>Tests.cs.
  • For full-cycle API tests, use controller-focused structure: one fixture per controller/test family and one base ApiTest.cs + ApiFixture.cs (split by scenario family only when needed).
  • Do not translate SpecFlow/Taffy step definitions into C# line-by-line; rewrite scenario intent into idiomatic API tests.
  • For API migrations, avoid one global shared setup fixture; each controller/test family fixture owns its own dependencies.
  • Fixture ownership for API tests should include DB launcher + migrators + WireMock + WebApplicationFactory + client.
  • Reset mutable state in [SetUp]; dispose all owned infra in [OneTimeTearDown].
  • For DB bootstrapping, follow pricing-style DatabaseLauncher + MigratorContainer from tests/utils/Sc.Fin.Pricing.Tests.Utils/Testcontainers.
  • Use canonical migrator command dotnet Sc.Tool.FluentMigrator.dll migrateup -m /sql and avoid custom ready-check arguments in tests.
  • Keep migrator ordering explicit (dependency migrators first, domain migrator last) and support fixture-level optional migrator toggles when some suites do not need all DBs.
  • Add explicit migrator verification tests that assert launcher startup, migrator completion/order, and required tables.
  • Use iterative quality loop: code -> build -> run tests -> fix -> repeat.
  • For health endpoints, use [Test] + [TestCase] + [CancelAfter(...)] with method signature (string url, CancellationToken cancellationToken); keep [Test] together with [TestCase] to avoid NUnit analyzer issues.
  • If user excludes infra-dependent suites (for example component tests requiring Docker), run feasible categories first and report exactly what remains unvalidated.
  • If the task shifts into service design or backend refactoring, switch to $software-csharp-backend.
  • If the task shifts into nuke/Build.cs, category target wiring, or CI artifact publication, switch to $ops-nuke-cicd.

Workflow

  1. Define boundary, dependencies, expected assertion depth, and environment constraints. Load references/nunit-structure.md.
  2. Select fixture composition and lifecycle. Load references/fixture-pattern.md and references/testing-templates.md.
  3. Implement scenario tests for the target layer. Load references/api-testing-nunit.md or references/component-testing-nunit.md.
  4. Choose double vs real dependency strategy. Load references/dependency-strategy-matrix.md, then references/wiremock-setup.md or references/testcontainers-setup.md.
  5. Add resilient async and eventual-consistency assertions. Load references/async-eventual-assertions.md.
  6. Harden suite against flaky behavior. Load references/anti-flakiness.md.
  7. Tune execution in CI. Load references/ci-parallelism-sharding.md and references/infrastructure-troubleshooting.md.
  8. Validate changed suites through build-test feedback targets. For NUKE-based repositories, run BuildAll, LocalUnitTest, ApiTest/DbTest as needed, then TestAll; use $ops-nuke-cicd for pipeline-target changes.
  9. If this is a migration from SpecFlow-style assets, produce migration trace artifacts. Use $docs-codebase with migration matrix and feature trace templates.

Resources

  • NUnit Structure: project layout, naming, categories, and lifecycle conventions.
  • Fixture Pattern: fixture boundaries, shared setup, teardown, and composition.
  • Testing Templates: copy-ready fixture/Testcontainers/WireMock templates.
  • API Testing with NUnit: endpoint-level tests with HTTP assertions and contract checks.
  • Component Testing with NUnit: in-process integration tests across collaborating components.
  • Dependency Strategy Matrix: decide WireMock vs Testcontainers by scenario.
  • WireMock Setup: deterministic stubs, request verification, and failure simulation.
  • Testcontainers Setup: container lifecycle, readiness, and test isolation.
  • Async Eventual Assertions: polling, timeouts, and message-driven verification.
  • Anti-Flakiness: reliability rules for stable execution.
  • CI Parallelism and Sharding: split test execution safely and efficiently.
  • Infrastructure Troubleshooting: diagnose startup failures, port collisions, and readiness issues.
  • Skill Data: curated Microsoft and .NET testing references for this skill.

Templates

  • NUnit Handler Fixture Template: base fixture for setup wiring and deterministic scenario configuration.
  • NUnit Handler Tests Template: base test class using fixture with Arrange/Act/Assert flow.
  • NUnit API Fixture Template: API fixture for controller-focused API-to-database full-cycle tests.
  • NUnit API Tests Template: base API test class with fixture isolation and parallel-safe lifecycle.
  • NUnit API Request Builder Template: deterministic request builder for scenario setup.
  • NUnit API TestCaseSources Template: reusable TestCaseData source methods.
  • NUnit WireMock Template: pricing-style WireMockServerWrapper and per-dependency *WiremockServer helper pattern.
  • NUnit Database Launcher Template: pricing-style DatabaseLauncher, ordered migrator chain, optional migrator toggles, and startup verification hooks.

Expand your agent's capabilities with these related and highly-rated skills.

vasilyu1983/AI-Agents-public

software-localisation

Production-grade i18n/l10n for React, Vue, Angular, and Next.js with ICU format and RTL support. Use when setting up or debugging localisation.

50 11
Explore
vasilyu1983/AI-Agents-public

ops-nuke-cicd

Design, implement, and troubleshoot NUKE-based CI/CD pipelines for .NET services with fast local-to-CI feedback loops. Use when creating or refactoring `nuke/Build.cs` target graphs, tuning `DependsOn`/`After`/`Triggers`/`OnlyWhenDynamic` behavior, orchestrating unit/API/DB test categories, merging and publishing coverage and test reports, building and pushing Docker images with traceable tags and digests, producing artifact contracts such as `deploy.env`, and diagnosing flaky or slow pipeline execution. For service code changes use $software-csharp-backend, for NUnit fixture design use $qa-testing-nunit, and for safe logging rewrites use $dev-structured-logs.

50 11
Explore
vasilyu1983/AI-Agents-public

qa-debugging

Systematic debugging for crashes, regressions, flakes, and production bugs. Use when diagnosing stack traces, logs, traces, or profiling data.

50 11
Explore
vasilyu1983/AI-Agents-public

ai-llm

Full LLM lifecycle skill — strategy selection, PEFT/LoRA, evaluation, and deployment. Use when building, fine-tuning, or operating LLM systems.

50 11
Explore
vasilyu1983/AI-Agents-public

qa-testing-playwright

E2E web testing with Playwright. Use when writing tests, debugging flakes, or setting up CI with selectors, sharding, and network mocking.

50 11
Explore
vasilyu1983/AI-Agents-public

software-frontend

Production-grade frontend for Next.js, Vue, Angular, and Svelte. Use when building UI, fixing hydration errors, or setting up a new web project.

50 11
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results