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. ...

Get Functional Programming: A PragPub Anthology 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.