Context
Generates missing tests for specified code and runs the test suite. Follows the project's testing standards and patterns.
Inputs
$ARGUMENTS - File paths to generate tests for, or "run" to just run existing tests
Steps
1. Determine Stack and Test Framework
Detect the stack from file extensions:
- •
.csfiles → NUnit, Moq, FluentAssertions - •
.ts/.tsxfiles → Vitest or Jest, React Testing Library - •
.pyfiles → pytest
Read the relevant standards file:
- •
standards/dotnet.md(Testing section) - •
standards/typescript.md(Testing section) - •
standards/python.md(Testing section) - •
standards/testing.md(Cross-stack philosophy)
2. Analyze Code to Test
If $ARGUMENTS includes file paths (not just "run"):
- •Read each file to understand its public API
- •Identify the happy path and error paths
- •Check for existing tests (look for corresponding test file)
- •Identify dependencies that need mocking
3. Generate Tests
Follow these patterns per stack:
.NET (NUnit):
- •Create test class in matching test project directory
- •Use
[TestFixture]withBaseTestif available - •Name:
{ClassName}Tests.cs - •Methods:
{Method}_When{Scenario}_Should{Expected}or{Method}_{Scenario}_{Expected} - •Use
[SetUp]for mock creation - •Use
Assert.EnterMultipleScope()for grouped assertions - •Test both success and error paths for Result<T> methods
TypeScript (Vitest/Jest):
- •Create test file:
{component}.test.tsxor{module}.test.ts - •Use
describeblocks matching the component/function - •Use
itwith descriptive names - •For React components: use
render,screen,fireEventfrom Testing Library
Python (pytest):
- •Create test file:
test_{module}.py - •Use
def test_{function}_{scenario}()naming - •Use
pytest.fixturefor setup - •Use
pytest.raisesfor exception testing
4. Run Tests
Execute the test suite:
- •.NET:
dotnet test - •TypeScript:
npm testornpx vitest run - •Python:
pytest
5. Report Results
code
## Test Results **Status:** PASS | FAIL **Tests:** X passed, Y failed, Z skipped **Coverage:** X% (if available) ### New Tests Created - [file path] - [what it tests] ### Failed Tests (if any) - [test name] - [failure reason]
Verification
- •All new tests pass
- •Tests cover both happy path and error paths
- •Test names are descriptive and follow conventions
- •No hardcoded dates or flaky patterns