【发布时间】:2018-04-26 00:52:18
【问题描述】:
我知道您可以使用 IEx 调试 webapp,但是否可以在测试中设置断点?
例如,在下面的测试中,我想检查 conn 内部的内容或检查任何其他变量或宏。
defmodule HelloWeb.PageControllerTest do
use HelloWeb.ConnCase
require IEx
test "GET /", %{conn: conn} do
IEx.pry
conn = get conn, "/"
assert html_response(conn, 200) =~ "Welcome to Phoenix!"
end
end
为了让它与 webapp 一起工作,你必须让 phoenix.server 运行 iex -S mix phoenix.server
但在这种情况下是测试而不是 webapp,所以它抱怨:
Cannot pry #PID<0.406.0> at ... Is an IEx shell running?
【问题讨论】:
标签: testing elixir phoenix-framework