Do you want to pick up from where you left of?
Take me there

Lessons: Testing

The first step to writing fault tolerant and scalable code is writing bug free code. In these lessons we explore how best to test our Elixir code.


Testing is an important part of developing software. In this lesson we’ll look at how to test our Elixir code with ExUnit and some best practices for doing so.


When testing our applications there are often times we need to make requests to external services. We may even want to simulate different situations like unexpected server errors. Handling this in an efficient way doesn’t come easy in Elixir without a little help.

In this lesson we’re going to explore how bypass can help us quickly and easily handle these requests in our tests


Mox is a library for designing concurrent mocks in Elixir.


An example-based unit testing library like ExUnit is a wonderful tool to help you verify that your code works the way you think it does. However, example-based unit tests have some drawbacks:

  • It can be easy to miss edge cases, since you’re only testing a few inputs.
  • You can write these tests without thinking through your requirements thoroughly.
  • These tests can be very verbose when you use several examples for one function.

In this lesson we’re going to explore how StreamData can help us overcome some of these drawbacks