Testing Testing v1.0.0

NUnit Testing

Write, run, or repair .NET tests that use NUnit. Use when a repo uses `NUnit`, `[Test]`, `[TestCase]`, `[TestFixture]`, or NUnit3TestAdapter for VSTest or Microsoft.Testing.Platform execution. USE FOR: writing or reviewing NUnit tests; using [Test], [TestCase], [TestFixture], [SetUp], [TearDown] attributes; configuring NUnit3TestAdapter or NUnit.Analyzers. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.

Trigger On

  • writing or reviewing NUnit tests
  • using [Test], [TestCase], [TestFixture], [SetUp], [TearDown] attributes
  • configuring NUnit3TestAdapter or NUnit.Analyzers
  • migrating between NUnit versions
  • integrating NUnit with CI pipelines

Workflow

  1. Detect whether the project uses NUnit 3.x or 4.x and which runner path is active: VSTest, Microsoft.Testing.Platform, IDE runner, or CI wrapper.
  2. Keep test fixtures small, prefer focused assertions with Assert.That, and use TestCase or TestCaseSource only when parameterization improves signal.
  3. Add NUnit3TestAdapter, Microsoft.NET.Test.Sdk, and NUnit.Analyzers when CLI discovery or analyzer coverage is missing.
  4. Validate with the repo's real test command before changing assertion style or lifecycle hooks.

References

Deliver

  • NUnit tests following the Arrange-Act-Assert pattern
  • Parameterized tests with [TestCase] and [TestCaseSource]
  • Constraint-based assertions with Assert.That
  • Proper test lifecycle management

Validate

  • Tests are independent and isolated
  • No hardcoded test data where parameterization is appropriate
  • Async tests use async Task not async void
  • Resources are properly disposed in [TearDown] or [OneTimeTearDown]
  • NUnit.Analyzers enabled to catch common issues

Related skills

Testing Testing 1,167 tokens

Use the open-source free `coverlet` toolchain for .NET code coverage.

coverlet.collectorcoverlet.msbuild
Testing Testing 1,227 tokens

Write, run, or repair .NET tests that use MSTest.

MSTestMSTest.TestFrameworkMSTest.TestAdapter