7

Tidying up Test Suites

Have you ever felt frustrated when working with your test suites? They can easily become messy and overgrown, unless you’re actively tending to them. In this chapter, we’ll look at some of the ways you can keep your test suites tidy.

The techniques you’ll use to tidy test suites differ from the techniques you’d use in your application code. Application code requires building abstractions and encapsulating details, with deep layers of connecting objects. However, tests benefit from being shallow, with each test statement having a clear effect.

Another way to think of it is that normal program flow can take many different paths through the code, but test suites have just one flow – they are scripts that run from top to ...

Get Svelte with Test-Driven Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.