Create Your First Test

Tests can get complex when the code you’re testing includes dependencies or complex flows. So, we’ll start simple and work our way up to more complex testing cases. But first, let’s spend a little time comparing Ruby’s testing ideas to Elixir’s.

Ruby testing has historically been dominated by RSpec, but Minitest has made a resurgence in recent years. Minitest is rooted in providing a minimal set of assertions so that tests remain simple. RSpec rooted itself in a more comprehensive assertion library and has many options for setting up data.

Elixir’s testing framework—ExUnit—is included with the language. You don’t need to install anything to use it. In some languages, the built-in testing framework isn’t great, but ExUnit ...

Get From Ruby to Elixir 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.