...

/

Taking Tests Beyond the Elixir Base

Taking Tests Beyond the Elixir Base

Let’s test our Mastery project and then take a look at some of the more widely used elixer testing techniques.

Basic testing

To execute the most simple form of tests, we’ll enter the following command:

Executable

Press + to interact
mix test

Output

Finished in 0.2 seconds
10 tests, 0 failures

The 10 tests, 0 failures indicates that all tests have successfully passed.

Advanced testing techniques

Testing is a broad and controversial topic. The Elixir community has so far shown pretty basic tastes as far as testing tools go. In this section, we’ll look at a couple of exciting places where Elixir programmers are using more cutting-edge techniques for testing a functional core.

Code coverage

The first technique, code coverage, is to understand what’s tested and what’s not. Elixir has built-in tools to help us do so.

The mix tool allows coverage tracking. We suggest that having a coverage threshold as a metric for our ...