2014-02-19 35 views

回答

57

您現在可以執行mix test path/to/test.exs:13,其中13是測試行。

+1

實際上,現在您可以通過將測試的行號添加到上述mix命令的末尾 – Dokie

+2

對於傘形項目,請勿在文件路徑中包含「apps/app_name」。即使根目錄下的文件路徑是'apps/app_name/test/app_name_test.exs',只需運行'mix test test/app_name_test.exs:13'即可。見[this](https://github.com/elixir-lang/elixir/issues/5650#issuecomment-272390635)。 –

12

我今天問了同樣的問題,在IRC和人回答(感謝新和成和José),現在我能做到這一點與混合。

您可以運行一個測試:

mix test path/to/file_test.exs:42 

如果你用Vim工作,你可以創建一個映射like I did here (based on vim-rspec)

25

爲測試添加標籤(例如wip)並使用mix --only標誌運行。

@tag :wip 
test "only run this test" do 
    assert true 
end 

運行方式:mix test --only wip

這將只運行與定義的標籤測試,跳過所有其他人。

+0

不錯的解決方案!謝謝 –

+0

非常有價值,謝謝! –

相關問題