我已经使用下面的代码成功安装并运行了 gtest。我想将测试输出打印到文本文件而不是在控制台中显示。有办法做到这一点吗?
我使用控制台从
我使用控制台从
cmake
运行测试:cmake CMakeLists.txt && make && ./runTests
。#include "cw-test.c"
#include <stdio.h>
#include <gtest/gtest.h>
TEST(InputValidationTest, ValidateEntryLine)
{
...
}
...
int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
cmake CMakeLists.txt && make && ./runTests &> test_output.txt
(参见此处)? - crayzeewulf--gtest_output=xml
和--gtest_output=xml:./
与当前文件夹中的结果一起工作(我认为是解决方案所在的文件夹)。 - Liviu