Keep Elixir test output clean

Does your Elixir test output look like this? If so, keep reading. It is common to use the Logger library, to log things that happen in your application. def query_api(url) do with {:ok, %{status_code: 200, body: body}} <- HTTPoison.get(url), {:ok, json} <- Jason.decode(body) do {:ok, json} else e -> Logger.error("impossible to query api: #{inspect(e)}") {:error, "api service unavailable"} end end It is also common to test the behavior of your application, in different scenarios....

July 23, 2022 · 2 min · Francis Chabouis