...

/

Better Failures

Better Failures

Learn how to improve error messages for failing tests.

Suppose we are testing a complex feature. We might need to run a series of steps and make expectations along the way to be sure everything is working correctly. If in the future, one of the tests fails, it will show a generic error message. However, it can still take some time to work out exactly which expectation has failed.

In order to improve the error messaging for failing tests, we could consider a few approaches:

  • Where it makes sense, split large tests with many expectations into smaller tests. If one ...