Some testing packages: flow_assertions, ecto_flow_assertions, ecto_test_data_builder

In my ElixirConf talk, I showed two testing packages I wrote, one I didn’t, and one I promised to extract from my code. I’ve finished that last, so here are those packages:

  • flow_assertions: Assertions tailored for use in pipelines. Common assertions extracted for easy reuse. Uses the ExUnit mechanisms to get good failure messages.

  • ecto_flow_assertions: Common Ecto schema and changeset assertions, written to be easily used in pipelines.

  • ecto_test_data_builder: Code that uses Ecto needs to be tested. Such tests need the database to be populated. It pays to write a test data builder for that purpose. This package makes writing that builder easier. Contains an example of using the package to write a test data builder for an animal reservation system.

I also showed @boydm’s phoenix_integration, which I think is useful for more than just integration testing. I wrote up my basis for that claim in Using phoenix_integration for unit tests of templates and rendering

While I’m here, I’ll also mention ex_machina, faker, and mockery. I use them all, and they make me happy.


I’ve written up the first part of my ElixirConf talk, which justifies these two libraries.