Introduction to the series
I’ve been using the Elixir programming language more and more lately for my own projects, while most of the test automation work I do for clients is done in Ruby.
I would like for more people to discover Elixir for both development and testing and wanted to write this series to show that the tools are already there to make Elixir a viable option, not only for building scalable distributed web applications but also as a language for implementing a test automation suite. It might even be easier to get a foothold for a new language in testing.
While a test website with an API is implemented as a part of this series, this is not a tutorial of how to test a Phoenix application, a popular web framework for Elixir but rather how to use Elixir and it’s tools to build test automation for any website or API.
Elixir testing tools
Elixir comes with a built-in test framework, which can be used for all types of testing. In this series I’m going to concentrate and show how to use the ExUnit framework for building automated tests for a website (using WebDriver) and a RESTful API.
There are many other options available too. A comprehensive list can be found in the Awesome Elixir repo, which has a specific section for testing related tools on Github. There are tools similar to some of the popular Ruby test/BDD frameworks, i.e. RSpec and Cucumber if that is the preference of the organisation.
To me, Elixir provides the same flexibility and productivity as Ruby for development. Functional programming style fits very well for testing too and there are some language features, which work especially well, i.e. pattern matching and the pipeline operator.
While Erlang VM fault tolerance and low latency are usually associated with mission critical applications, there are situations where they can bring great benefits to testing as well. Running tests in parallel or connecting several nodes are things that can be done with ease using Elixir. Using Elixir as the testing language might actually make the backend team jealous (as suggested in this Elm talk by Richard Feldman): Make the Back-End Team Jealous: Elm in Production"
The next part will be about Elixir language features.
Part 2: Elixir Language Features