UTF-8
Errata: February 19, 2021

Thank you for purchasing Unit Testing Principles, Practices, and Patterns. Please add corrections not noted below to the book's liveBook forum. We'll update this list as necessary. Corrections were made during the second printing (December 2020).


Page 8: Production code vs. test code sidebar:

This correction has not been made.

The line, It's always better to solve problems with as little code as possible is more accurate as

It's always better to solve problems with the minimum amount of code.

In chapter 1, page 10, section 1.3.1:

In the code snippet that immediately follows the line "Now, what if I refactor the method and inline..." change:

return input.Length > 5;
to

return input.Length > 5 ? true : false;

public static bool IsStringLong(string input)
{
    return input.Length > 5 ? true : false;;
}

public void Test()
{
    bool result = IsStringLong("abc");
    Assert.Equal(false, result);
}

Page 11:

In listing that immediately follows the line "To calculate the branch coverage metric, you need to sum up all..." change:

return input.Length > 5;
to

return input.Length > 5 ? true : false;

Page 12:

In listing 1.2 change:

bool result = input.Length > 5;
to

bool result = input.Length > 5 ? true : false;

Page 18

This correction has not been made.

The last summary point on this page, should be
Branch coverage provides better insight into the completeness of the test suite than code coverage, but still can't indicate whether the suite is...

Page 175:

This correction has not been made.

The first line in section 7.4.2 uses the word deduct instead of deduce.
It’s sometimes hard to deduce what steps led the domain model to the current state

Page 250, Listing 10.13:

This correction has not been made.

The first line, public static class UserExternsions, should be:
public static class UserExtensions