Search⌘ K
AI Features

Test Driving the Quiz Session

Explore how to implement and test a quiz session using GenServer in Elixir. Learn to start processes, manage state, and handle client API calls to validate and answer quiz questions within an isolated OTP process.

Running our second GenServer

We will connect to our server with the GenServer module and the various functions we’ve built in the QuizManager module. We’ll open up iex with iex -S mix.

Setting up aliases

We’ll want to set up the aliases and start up the server:

Executable

C++
alias Mastery.Boundary.QuizSession
C++
alias Mastery.Boundary.QuizSession

Output

iex(1)> alias Mastery.Boundary.QuizSession 
Mastery.Boundary.QuizSession
iex(2)> alias Mastery.Examples.Math 
Mastery.Examples.Math

We alias the two modules we need: ...