0
我有一個C++ CMake項目,我使用Google Test進行單元測試,並且對使用ctest -T Test
生成的XML報告感到滿意。現在我想實施幾個運行特定應用程序場景的集成測試,並期望獲得特定的輸出,例如運行具有默認值的C++可執行文件應該產生一個特定的輸出,以下integration_test_01.sh
的bash shell會是這樣一個測試:使用bash與CMake和CTest進行簡單的集成測試?
#!/bin/bash
./my_algorithm > out && grep "mse\=1\.2345e\-6" out
if [ $? == 0 ]; then
echo "integration test succeeded"
else
echo "integration test failed" >&2
fi
rm out | cat
有沒有這樣的測試與CMake的或CTEST整合的方式,甚至可能得到一些XML輸出?
優秀的答案,謝謝! –