Good Elixir TDD resources?

This one comes to mind: Why I use Tape Instead of Mocha & So Should You

Anyway Elixir has a set of "assert"s under ExUnit.Assertions - including ones to test the presence or absence of mailbox messages.

And there are utilities that people “just whip up” when and if the need arises, example: TaskAfter.

Sometimes it’s just more effective to create exactly what you need yourself, rather than to having to learn some other tool or more general library when you only intend to use 5% of its capability.

I learn how to do dependency injection, inversion of control and a myriad of other techniques using such tools to test my applications.

While those design concepts are helpful when it comes to testing and designing for testability, they are not testing centric but rather general software design concepts. For example: Inversion of Control Containers and the Dependency Injection pattern.

To get a notion of the general attitude towards mocking see Mocking and Explicit Contracts - and there is Mox for mocking behaviours (and there have been discussions around Mox like this one).

I do have to say that the ExUnit docs are rather … well for me, it is hard just by reading the docs to see how I can stitch up each function and make a coherent test suite. As for testing in FP… side effects are always present.

You could always try “learn by example” - e.g. pick a project (e.g. Plug or start small with ExUnits own tests) and investigate how testing is approached there. By the time you’re done, you’ll likely know the project as well.

1 Like