O'Reilly logo

Functional Programming: A PragPub Anthology by Michael Swaine

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Optimizing Setup with TrueStory

In our testing experience, we believe when testing commercial applications, the bulk of the work you’ll do is building setup code, but that’s precisely the code that gets the least amount of attention in a typical test.

Around October of last year, we began working on a testing library called TrueStory.[25] By restructuring our tests using macros into clear areas of responsibility, we can do a better job of writing single-purposed tests.

For this philosophy, we find that a story metaphor works well. We chose to use the noun story to define the setup and run our experiment. In short, we tell a story. Then, in another block called verify, we measure the impact on the real world with straight ExUnit assertions. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required