The Beauty of Isolation

Testing in isolation means when you write a test, try to focus on testing one thing or concept at a time.

For example, look what happens if we rearrange our shape calculator tests slightly so that instead of trying to test all geometric shapes at once, we test only rectangles.

images/org/one-thing.png

Way cleaner. By focusing only on the rectangle, the test name is now clearer. No more confusing data to have to sift through (we keep only what we need). And all the tests that appear are related to rectangles, and nothing else.

While all our tests obviously won’t be this simple or neat, this is the attitude we shoot for going into any new test—simple, ...

Get The Way of the Web Tester 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.