Tests as docs? 🤔

Notes

One of the nice things about tests is that they can serve as documentation.

By default, running mix test (or mix test path/to/file) doesn’t give us good information that can serve as documentation.

Thankfully, we can add two flags that make it really nice:

  • --trace sets max-cases to 1 (i.e. concurrency to 1), and more importantly, it prints more details!

  • --seed 0 which makes the tests run in the order in which they’re defined.

By adding those two flags, we can now print out our tests’ descriptions in a very clear way – allowing us to see what our tests say they are testing.

Want the latest Elixir Streams in your inbox?

    No spam. Unsubscribe any time.