2015-11-30 30 views
0

有沒有辦法自定義測試報告。目前我在每次測試結束時都會看到這一行:定製minitest消息

3 tests, 0 assertions, 0 failures, 0 errors, 0 skips 

我想在此行中包含測試文件名。

+0

你想自定義記者,結帳http://chriskottom.com/blog/2014/06/dress-up-your-minitest-output/和https://github.com/seattlerb/minitest#adding-定製記者。這也適用於每次測試,而不是每個測試。如果你想在測試套件運行時看到每個文件的其他元信息,你將不得不非常自定義 – CWitty

回答

1

Minitest有一個詳細的選項,將顯示每個運行測試的測試名稱和執行時間。如何將-v標誌傳遞給Minitest將取決於您如何運行測試。有關詳細輸出的示例,請參閱http://chriskottom.com/blog/2014/12/command-line-flags-for-minitest-in-the-raw/

另一種辦法是使用MINITEST,記者與SpecReporter將它添加到你的Gemfile,並把這個測試中的幫手:

require "minitest/reporters" 
Minitest::Reporters.use! Minitest::Reporters::SpecReporter.new 

更多信息,請參見https://github.com/kern/minitest-reporters