Continuous integration 与GTest和Buildbot的持续集成

Continuous integration 与GTest和Buildbot的持续集成,continuous-integration,googletest,buildbot,Continuous Integration,Googletest,Buildbot,我想用buildbot和gtest设置一个持续集成服务器。我已经成功地设置了环境,在单元测试步骤之后,该环境将产生以下输出: Running main() from gtest_main.cc [==========] Running 7 tests from 3 test cases. [----------] Global test environment set-up. [----------] 4 tests from VectorTest [ RUN ] VectorTest

我想用buildbot和gtest设置一个持续集成服务器。我已经成功地设置了环境,在单元测试步骤之后,该环境将产生以下输出:

Running main() from gtest_main.cc
[==========] Running 7 tests from 3 test cases.
[----------] Global test environment set-up.
[----------] 4 tests from VectorTest
[ RUN      ] VectorTest.size_is_correct
[       OK ] VectorTest.size_is_correct (0 ms)
[ RUN      ] VectorTest.min_index
[       OK ] VectorTest.min_index (0 ms)
[ RUN      ] VectorTest.sort_is_correct
[       OK ] VectorTest.sort_is_correct (0 ms)
[ RUN      ] VectorTest.indices_of_smallest_are_correct
[       OK ] VectorTest.indices_of_smallest_are_correct (0 ms)
[----------] 4 tests from VectorTest (0 ms total)

[----------] 2 tests from MatrixTest
[ RUN      ] MatrixTest.NumberOfColumnsIsCorrect
[       OK ] MatrixTest.NumberOfColumnsIsCorrect (0 ms)
[ RUN      ] MatrixTest.NumberOfRowsIsCorrect
[       OK ] MatrixTest.NumberOfRowsIsCorrect (0 ms)
[----------] 2 tests from MatrixTest (0 ms total)

[----------] 1 test from SparseMatrix
[ RUN      ] SparseMatrix.IteratorIsCorrect

[       OK ] SparseMatrix.IteratorIsCorrect (0 ms)
[----------] 1 test from SparseMatrix (0 ms total)

[----------] Global test environment tear-down
[==========] 7 tests from 3 test cases ran. (2 ms total)
[  PASSED  ] 7 tests.
[100%] Built target unit
我希望buildbot解析这个输出,以便检查传递的关键字是否存在,以便知道在单元测试期间是否出现了错误


您知道怎么做吗?

GoogleTest使用命令行选项支持JUnit格式的XML输出,大多数CI系统已经知道如何解析


我不知道Buildbot是否支持JUnit解析。如果没有,解析XML结构化输出肯定比解析标准纯文本输出更容易。

为什么不检查测试程序的退出代码?如果测试通过,则为成功代码(0),如果测试失败,则为失败代码(通常为1)。

谢谢。我将查看buildbot的文档,看看这样的解析是否可行。我不太清楚为什么当某个单元测试没有通过时,程序的退出代码应该是失败代码。例如,据我记忆所及,CPPUNIT的行为不是这样的。只有当程序中出现错误(如异常)时,程序才应返回故障代码。但是,由于程序预计会在单元测试中检测成功和失败,因此当它检测到单元测试失败时,不能期望它返回失败代码。实际上,这个项目做得很好。他成功地检测到了测试失败。@Aleph建议从RUN_ALL_TESTS()的main()结果返回:因此通常退出代码表示所有测试是否通过。但总的来说,您是对的——由测试程序的作者决定退出代码的含义。