Unit Tester Skill
Specialized agent for MSTest, Moq, and Reqnroll testing.
Expertise Areas
- MSTest framework
- Moq mocking library
- Reqnroll BDD testing
- Test-Driven Development (TDD)
- Unit test organization
- Integration testing
- Test coverage analysis
Responsibilities
- Create Unit Tests
- Test all CQRS handlers
- Test business logic thoroughly
- Test edge cases and error conditions
- Use descriptive test names
- Write BDD Scenarios
- Create Gherkin feature files
- Implement step definitions
- Cover happy paths and error cases
- Make scenarios readable for non-technical stakeholders
- Mock Dependencies
- Mock DataContext operations
- Mock external services
- Setup return values
- Verify method calls
- Ensure Coverage
- Aim for 80%+ code coverage
- Cover all public methods
- Test validation logic
- Test error handling
Test Frameworks (REQUIRED)
- Unit/Integration: MSTest (NOT xUnit, NOT NUnit)
- BDD: Reqnroll (NOT SpecFlow)
- Mocking: Moq
- Assertions: MSTest Assert class
Test Naming Convention
MethodName_Scenario_ExpectedResult
Examples:
HandleAsync_ValidCommand_Creates{Entity}Successfully
HandleAsync_NullCommand_ThrowsArgumentNullException
HandleAsync_NegativeAmount_ThrowsArgumentException
Test Structure (AAA Pattern)
[TestMethod]
public async Task MethodName_Scenario_ExpectedResult()
{
// Arrange
var command = new Create{Entity}Command(...);
// Act
var result = await _handler.HandleAsync(command);
// Assert
Assert.IsNotNull(result);
_mockContext.Verify(x => x.Method(...), Times.Once);
}
Gherkin Scenario Template
Feature: {Entity} Management
As a user
I want to manage {entities}
So that I can achieve a business goal
Scenario: Description of scenario
Given precondition
When action
Then expected result
And additional assertion
Templates to Use
.ai/reference/templates/test-class.cs.txt.ai/reference/templates/feature-file.feature.txt.ai/reference/templates/test-plan.md.txt.ai/reference/templates/test-incident-report.md.txt
Patterns to Follow
.ai/patterns/testing-patterns.md.ai/reference/traceability.md.ai/reference/test-documentation.md
Test Documentation
The test artifacts this skill produces are mapped to ISO/IEC/IEEE 29119-3, right-sized, in
.ai/reference/test-documentation.md. Three consequences:
- Test plan — one per vertical slice. Written from
docs/slices/{Domain}/{Entity}.{Operation}/blueprint.json to
docs/slices/{Domain}/{Entity}.{Operation}/test-plan.md, using
.ai/reference/templates/test-plan.md.txt. Its entry and exit criteria are what the traceability
validator's checks T5/T6 measure against, so keep them concrete.
- Test case specification — do not write one. The
AC-↔ scenario ↔ test mapping in
.ai/reference/traceability.md is that document. A second, hand-written copy is the one that
goes stale.
- Test incident report — one per failure that outlives the change, using
.ai/reference/templates/test-incident-report.md.txt. A failure fixed in the same edit needs no
report. The completion report (Clause 7.4) is written per release, not per slice, and this skill's
run results feed it.
Checklist Before Completion
- [ ] All handlers have unit tests
- [ ] All tests use MSTest (not xUnit/NUnit)
- [ ] Descriptive test names following convention
- [ ] AAA pattern used consistently
- [ ] Mocks setup and verified correctly
- [ ] BDD scenarios for complex workflows
- [ ] All tests pass
- [ ] Coverage meets 80%+ target
- [ ] Test plan written for the slice from its blueprint, with entry and exit criteria
(docs/slices/{Domain}/{Entity}.{Operation}/test-plan.md)
- [ ] Every criterion in the slice's
source.acceptance_criteriaappears in that plan and is
referenced from a test — validate-traceability.py reports no unresolved reference and no
T5/T6 warning for it
- [ ] No separate test case specification authored — the
AC-↔ scenario ↔ test trace is the document - [ ] Every failure that outlives the change has a test incident report with reproduce steps,
expected vs actual results, a severity from .ai/reference/quality-model.md, and a status