The snippet below is a phoenix framework controller test
defmodule PaymentServiceWeb.Controllers.PaymentTest do use ExUnit.Case, async: false use Plug.Test alias PaymentServiceWeb.Router @tag endpoint: true test "service health check" do conn = conn(:get, "/api") response = Router.call(conn, @opts) assert %Plug.Conn{resp_body: body} = response end end Explanation The test above is going to test an api endpoint, and the simple assertion is just to ensure that a %Plug.Conn struct is received as the response. Read More...