Course Content, and Code

Understand the content of this course.

We'll cover the following

Contents of the course

Let’s take a look at what we’ll cover during this course.

  • Unit Tests: We’ll get going and learn about the “smallest” kind of testing: unit testing. We’ll cover how and when to write unit tests, the tools to write them in Elixir, and techniques to isolate code under test.
  • Integration and End-to-End Tests: Then we’ll move on to testing different components of our system that interact with each other. We’ll learn how to test and isolate components to run more focused integration tests. We’ll also touch on end-to-end testing, that is, testing the whole system from the perspective of an outside entity.
  • Testing OTP: Next we’ll learn about testing one of Erlang and Elixir’s most unique features, OTP. In general, OTP and processes present quite a few challenges when it comes to testing. We’ll talk about those and learn techniques to make testing these abstractions easier.
  • Testing Ecto Schemas and Ecto Queries: Next we’ll discuss testing code that uses the Ecto framework to validate data and interact with databases. Ecto is a widely used library in the Elixir landscape, and the community has created patterns on how to test code that makes use of it.
  • Testing Phoenix: Then we’ll cover Elixir’s most used web framework, Phoenix. Phoenix provides several moving pieces. We’ll learn how to test those pieces in isolation as well as how to test to ensure the parts of our Phoenix application work correctly together.
  • Property-Based Testing: Next we’ll explore a technique for introducing randomness into our testing suite to cover large amounts of inputs to our code and increase the chances of finding inconsistencies.

A testing course is a unique venture. Most programming courses show application code when discussing examples and often give little attention to tests or omit them entirely. We want to focus on testing in this course, but we need application code since there’s no point in testing if you don’t have anything to test. At the same time, we don’t want to focus on the application code since it would take away from what we want to talk about, which is testing. As we said, it’s a unique venture.

Throughout this course, we’ll work on two main applications:

  • In the Unit Tests, Integration and End-to-End Tests, and Testing OTP sections, we’ll work with Soggy Waffle. Soggy Waffle is an application that reads the weather forecast for a given area and can send SMS alerts if rain is expected in the next few hours. It’s not a broadly useful application, but it helps illustrate many Elixir testing concepts.
  • In the Testing Ecto Schemas and Testing Ecto Queries sections, we’ll use a fundamental application, Testing Ecto, to illustrate how to test applications using the Ecto framework.
  • In the Testing Phoenix section, we’ll use an application with examples covering the different interfaces provided in the standard Phoenix library.
  • The Property-Based Testing section will use a few different applications to cover various concepts related to property-based testing.

Don’t focus too much on the applications as we move between them. They’re simply there to allow us to examine our testing methods. When we need to test a particular feature that isn’t in one of our main applications, we’ll turn our attention to self-contained examples that will allow us to directly address some testing topics without making our main application a total mess.

So without further ado, let’s jump into our course!

Note: We’ll provide the source code files for each application we run our tests on throughout this course. You’re encouraged to write and update tests and execute them live in our live-coding environment, with the sole motivation of giving you hands-on experience. If you prefer, you can also download the source code files to execute them on your local machine but note that you will be required to install the required dependencies for the respective frameworks.