Testing to the Fusion barNaming and boundaries
No narration yet
Module 11 · Lesson 211 min

Naming and boundaries

Two rules catch most test slop. First, the test file is named after what it tests: FlightNumberVoTests tests FlightNumberVo, not after the ticket or the feature (anti-patterns #3, #17). If someone greps for coverage of a class, the file name is how they find it. Second, test the boundaries, not just the happy path (#14): the inclusive bound that passes, the exclusive bound that fails, the empty and null inputs.

Boundary coverage (real DisruptionDelayVoTests)
[Fact] public void DelayAtBoundary0_ReturnsSuccess() =>
    DisruptionDelayVo.Create(false, 0).IsSuccess.ShouldBeTrue();

[Fact] public void DelayAtBoundary24Hours_ReturnsSuccess() =>
    DisruptionDelayVo.Create(false, 24 * 60).IsSuccess.ShouldBeTrue();

[Fact] public void DelayBelowZero_ReturnsFailure() =>
    DisruptionDelayVo.Create(false, -1).IsFailure.ShouldBeTrue();

[Fact] public void DelayAbove24Hours_ReturnsFailure() =>
    DisruptionDelayVo.Create(false, 24 * 60 + 1).IsFailure.ShouldBeTrue();
Practice

Try it yourself

Recall

The boundary set

Name the cases a reviewer expects.

A value object validates that a delay is between 0 and 1440 minutes inclusive. Which test cases does a Fusion reviewer expect beyond a single happy path?

Quiz

Name the test file

You wrote tests for a method ValidateRevertDecision. What should the file be called?