Home > The Unit Test Framework > Usage recommendations > Microsoft Visual Studio .NET users specific
PrevNext

Microsoft Visual Studio .NET usage recommendations

Use custom build step to automatically start test program after compilation
If you got fatal exception somewhere within test case, make debugger break at the point the failure by adding extra command line argument

Use custom build step to automatically start test program after compilation
使用自定義編譯步驟在編譯完成後自動開始測試程序

I found it most convenient to put test program execution as a post-build step in compilation. To do so use project property page:
我發現將測試運行的執行放在編譯的 post-build 步驟是非常方便的。使用工程屬性頁:

Full command you need in "Command Line" field is:
"Common Line" 中需要的全部命令是:

"$(TargetDir)\$(TargetName).exe" --result_code=no --report_level=no

Note that both report level and result code are suppressed. This way the only output you may see from this command are possible runtime errors. But the best part is that you could jump through these errors using usual keyboard shortcuts/mouse clicks you use for compilation error analysis:
注意報告級別和結果代碼都被禁止。這樣你從這命令中看到的唯一輸出可能就是運行錯誤。 但最好的地方是你可以像分析編譯錯誤一樣,使用鍵盤快捷方式 / 鼠標點擊,從這些錯誤進行跳轉:

If you got fatal exception somewhere within test case, make debugger break at the point the failure 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 of error location add --catch_system_errors=no to the test run command line:
如果你在運行測試時碰到 "內存訪問越界" 的信息 (或其它表示致命或系統錯誤的信息),, 想要得到關於錯誤位置的更多信息,在測試運行命令行中添加 --catch_system_errors=no:

Now run the test again under debugger and it will break at the point of failure.
現在在調試器中再次運行測試,就會中斷在失敗的點上。


PrevUpHomeNext