簡體   English   中英

C ++-Google測試-如何在不同目錄中並行運行所有測試?

[英]C++ - Google Test - How to run all tests in different directories in parallel?

我正在使用一個C ++項目,其中包含Google測試平台生成的大量測試文件夾。 例如,在創建項目之后,我將擁有以下可執行的測試文件,每個文件包含多個測試套件:

/proj/build/interface/test/test1_executable
/proj/build/interface/test/test2_executable
/proj/build/module2/test/test1_executable
/proj/build/module2/test/test2_executable

我想在新構建后運行所有測試。 這些方法可以一次運行所有這些文件,還是希望並行運行嗎?

Python有一個稱為nosetests測試的實用程序,可以在項目中運行測試。 C ++程序員如何在項目中運行所有測試?

看起來您正在為每個測試創建一個二進制文件。 那不是您應該使用googletest的方式。

如果編寫單個main函數 ,則所有測試都只有一個二進制文件。 您仍然可以通過添加--gtest_filter=whatever選擇單個測試。

“ C ++程序員如何在項目中運行所有測試?” -這完全取決於所使用的測試框架和構建系統。 沒有標准化的解決方案。

在Windows中,創建一個批處理文件,並在每行前面加上單詞START:

START /proj/build/interface/test/test1_executable
START /proj/build/interface/test/test2_executable
START /proj/build/module2/test/test1_executable
START /proj/build/module2/test/test2_executable

在Linux中,在批處理文件每一行的末尾添加&:

/proj/build/interface/test/test1_executable&
/proj/build/interface/test/test2_executable&
/proj/build/module2/test/test1_executable&
/proj/build/module2/test/test2_executable&

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM