Reputation: 29
Let's say I have to following C++ test test.cpp
:
#include <gtest/gtest.h>
int add(int a, int b);
TEST(AdditionTest, HandlesPositiveInput) {
EXPECT_EQ(add(1, 2), 3);
}
TEST(AdditionTest, HandlesNegativeInput) {
int a = 4 / 0;
EXPECT_EQ(add(-1, -1), -2);
}
TEST(AdditionTest, HandlesLast) {
EXPECT_EQ(add(-2, -4), -6);
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
When running ./runTests --gtest_output=xml:report.xml
, the test execution stops at the 2nd test as there was an uncaught runtime exception even when I add --gtest_catch_exceptions=1
; and the report.xml file is not generated.
I expect the report to be generated and the next tests to be executed. Am I right?
I am using:
GoogleTest v1.16.0
CMake 3.29.4
Make 4.3
Upvotes: -1
Views: 24