Search⌘ K

Taking Tests Beyond the Elixir Base

Learn to enhance Elixir application testing beyond basic tests by exploring code coverage analysis, property-based testing frameworks like PropEr, and the ExCoveralls tool. Gain skills to better assess test completeness and generate diverse test inputs to ensure robust functional core verification.

Basic testing

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

Executable

C++
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 project. If the coverage falls below the metric, ...