Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Elixir ExUnit配置:在没有监控树的情况下启动测试_Elixir_Erlang Supervisor_Ex Unit - Fatal编程技术网

Elixir ExUnit配置:在没有监控树的情况下启动测试

Elixir ExUnit配置:在没有监控树的情况下启动测试,elixir,erlang-supervisor,ex-unit,Elixir,Erlang Supervisor,Ex Unit,我试图在Elixir项目中模拟单独的单元测试和集成测试。对于单元测试,我不需要运行监督树,因此理想情况下,我希望使用类似模块标记的东西,即@moduletag:integration,它将需要运行应用程序的测试分组。我可以手动运行测试两次: mix test --no-start --only integration:false mix test --only integration:true 但是我更喜欢一些集成的解决方案,这样我就只需要运行混合测试。对于ExUnit.configure/s

我试图在Elixir项目中模拟单独的单元测试和集成测试。对于单元测试,我不需要运行监督树,因此理想情况下,我希望使用类似模块标记的东西,即
@moduletag:integration
,它将需要运行应用程序的测试分组。我可以手动运行测试两次:

mix test --no-start --only integration:false
mix test --only integration:true
但是我更喜欢一些集成的解决方案,这样我就只需要运行
混合测试
。对于ExUnit.configure/start,有一些选项,例如
start
autorun
,但它们似乎不会产生任何影响。有什么建议吗?

您可以在
mix.exs
中创建一个用于运行测试套件的

# also add "aliases: aliases()" to project/0 list
defp aliases do
  [testproj: ["test --no-start --only integration:false", "test --only integration:true"]]
end
然后在项目目录中尝试:
mix testproj

您可以在
mix.exs
中创建将运行测试套件的

# also add "aliases: aliases()" to project/0 list
defp aliases do
  [testproj: ["test --no-start --only integration:false", "test --only integration:true"]]
end
然后在项目目录中尝试:
mixtestproj

是的,似乎不起作用。但它仍然感觉像是一个解决方法,问题的主要点是如何实际使用ExUnit.configure来控制测试。我天真地建议,如果有run函数和autorun选项,那么必须可以从一个点用不同的参数手动运行测试两次。但它仍然感觉像是一个解决方法,问题的主要点是如何实际使用ExUnit.configure来控制测试。我天真地建议,如果有run函数和autorun选项,那么必须能够从一个点使用不同的参数手动运行测试两次。