【发布时间】:2016-07-24 01:09:43
【问题描述】:
我正在使用我无法模拟的外部库来实现有点棘手的功能。他们需要实现对服务器的真实请求。所以,
如何在测试实施期间运行网络服务器?
附:我的config/test.exs:
config :my_reelty, MyReelty.Endpoint,
http: [port: {:system, "PORT"}],
url: [host: "localhost", port: 5000] # Specific port
我正在尝试curl http://localhost:5000,但得到curl: (7) Failed to connect to localhost port 5000: Connection refused
【问题讨论】:
-
您想在为同一个应用程序运行测试时在端口 5000 上运行您的 Phoenix 应用程序?抱歉,我没有按照您在此处尝试实现的目标。
-
是的,我想在端口 5000 上运行应用程序来运行测试
-
config/test.exs中有config :my_reelty, MyReelty.Endpoint, server: true吗?如果没有,请尝试添加。我可以使用server: true从我的测试中访问服务器。 -
很好,请回答
-
@asiniy,我正在尝试听起来与您的问题标题相似的东西。你能多解释一下你是怎么做到的吗?
标签: elixir phoenix-framework ex-unit