Run Tests (runbook)
Steps
- Build first:
dotnet build /v:q(tests won't be meaningful over a broken build). - Run the suite:
dotnet test(the default VS Code "test" task). Or scope it:dotnet test .\tests\app\UnitTests\<Project>\<Project>.csproj - Read failures: note the test name (its snake_case suffix describes the expected behavior) and the AwesomeAssertions message.
Conventions (see testing-guide)
- NUnit + NSubstitute (mocks) + AwesomeAssertions (never
ClassicAssert, never Moq). - Test names keep the method name and add a snake_case suffix (
MyMethod_should_do_x). - Substitute
IExecutable/IProcessso tests don't spawn realgit. Verify.NUnitsnapshots use.verified.*files — review diffs when they change.- Reach private members via a class's
TestAccessor.
Diagnosing a failure
- Reproduce the single test in isolation before changing code.
- Check whether a
Verifysnapshot legitimately changed (update it) vs a real regression.
STOP conditions / hard rules
- A flaky test → find and fix the root cause; do not dismiss it as pre-existing or retry blindly.
- Do not weaken assertions or add
[Ignore]to make a suite green — fix the underlying issue. - Never use
[DataTestMethod](that's MSTest); this repo uses NUnit[TestCase]/[TestCaseSource].