Home > The Unit Test Framework > Usage recommendations > Command-line (non-GUI) users specific
Prev

Command line usage recommendations

If you got fatal exception somewhere within test case, make program generate coredump by adding extra command line argument
How to use test module build with Boost.Test framework under management of automated regression test facilities?

If you got fatal exception somewhere within test case, make program generate coredump by adding extra command line argument
如果在測試用例中碰到了致使異常,添加額外的命令行參數讓程序生成核心轉儲

If you got "memory access violation" message (or any other message indication fatal or system error) when you run you test, to get more information about the error location add --catch_system_errors=no to the test run command line. Now run the test again and it will create a coredump you could analyze using you preferable debugger. Or run it under debugger in a first place and it will break at the point of failure.
如果你在運行測試時碰到 "內存訪問越界" 信息 (或其它表示致使或系統錯誤的信息), 要得到關於錯誤地點的更多信息,在測試運行的命令行中添加 --catch_system_errors=no。 現在再次運行測試,會生成核心轉儲文件,你可以使用喜歡的調試器分析了。 或在調試下測試它,它會中斷在失敗的點上。

How to use test module build with Boost.Test framework under management of automated regression test facilities?
如何使用自動註冊測試工具管理的 Boost.Test 框架生成的測試模塊?

My first recommendation is to make sure that the test framework catches all fatal errors by adding argument --catch_system_error=yes to all test modules invocations. Otherwise test program may produce unwanted dialogs (depends on compiler and OS) that will halt you regression tests run. The second recommendation is to suppress result report output by adding --report_level=no argument and test log output by adding --log_level=nothing argument, so that test module won't produce undesirable output no one is going to look at anyway. I recommend relying only on result code that will be consistent for all test programs. An alternative to my second recommendation is direct both log and report to separate file you could analyze later on. Moreover you can make Boost.Test to produce them in XML format using output_format=XML and use some automated tool that will format this information as you like.
我的第一個建議是在所有測試模塊調用中添加參數 --catch_system_error=yes,確保測試框架捕獲所有的致命錯誤。 否則測試程序可能會產生不想要的對話框 (依賴於編譯器和 OS),這會中斷你的回歸測試運行。 第二個建議是添加 --report_level=no 參數禁止結果報告輸出,添加 --log_level=nothing 參數禁止測試日誌輸出, 這樣測試模塊不會產生沒有人想看的,不想要的輸出。 我建議只依賴於結果代碼,這樣就可以將所有測試程序連貫起來。 我第二個建議的備選方案是將日誌和報告重定向到獨立的文件,以供稍後分析。 另外,你可以使用 output_format=XML 參數讓 Boost.Test 生成 XML 格式的日誌和報告, 並使用某些自動化工具將這種信息格式化為你想要的。


PrevUpHome