Read more

The Self-Contained Test

Henning Koch
June 02, 2020Software engineer at makandra GmbH

One of the earliest pieces of wisdom we are given as programmers is to not write duplicate code: Don’t Repeat Yourself (or DRY if you prefer). Identical blocks of code to set up a test sure does look like repetition, so we extract it into a before block.

This is a mistake for tests.

The article explains about how sharing setup between examples make test files harder to read and evolve.

Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

A related frustration I have is working on ultra-DRY & betterspecs-like test files where shared setup has worked for all existing tests, but won't work for the test I need to add. I now need to refactor a huge file to add a small test.

Posted by Henning Koch to makandra dev (2020-06-02 09:16)