Search code examples
unit-testingintegration-testinggoogletestgooglemock

How to stop GTest test-case execution, when first test failed


I'm looking for some #define which can stop test-case execution if first test failed

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
}

Solution

  • run binary with flag --gtest_break_on_failure