【问题标题】:How to stop GTest test-case execution, when first test failed第一次测试失败时如何停止 GTest 测试用例的执行
【发布时间】:2018-05-09 14:21:11
【问题描述】:

我正在寻找一些#define,如果第一次测试失败,它可以停止测试用例的执行

TEST_F(TestInitializer, 1st-test) {
  Initiator.call();      
  EXPECT_CALL(mock_obj, onAction(false)).Times(AtLeast(0));

  // some define I want
  ::testing::stopIfFailed();
}

TEST_F(TestInitializer, 2nd-test) {
  // this test must not be executed if first test failed
}

【问题讨论】:

    标签: unit-testing integration-testing googletest gmock


    【解决方案1】:

    运行带有标志 --gtest_break_on_failure 的二进制文件

    【讨论】:

      猜你喜欢
      • 2013-03-30
      • 2016-01-24
      • 1970-01-01
      • 2021-03-19
      • 2013-04-11
      • 1970-01-01
      • 2019-03-07
      • 1970-01-01
      • 2021-04-17
      相关资源
      最近更新 更多