4 ms·
To easily see in test failures what went wrong we follow the naming convention: UnitOfWorkUnderTest_Scenario_ExpectedBehavior Which mimics the internal GWT st
by splittingTimes 6y ago
To easily see in test failures what went wrong we follow the naming convention:
UnitOfWorkUnderTest_Scenario_ExpectedBehavior
Which mimics the internal GWT structure.
- hackerm0nkey 6y agoI love this. I started with trying to have simple, short and descriptive names for the test methods but then it doesn't work quite well with more complicated test cases. So I grew to like something along these lines: given_someInput_someOtherInput_when_doX_then_thisThingHappen_thatThingHappen which has the advantage to be optimised for reading. When I want to skim over the test class quickly I can simply look at the method names to get an idea on what the test is doing and if I want more details I can look further at it's implementation
- joshka 6y agoI have suggested the same previously, but the display name approach is better. Now test names should be short: @DisplayName("throws IllegalArgumentException when given bad data") void badData() {