class Test
Defined at line 242 of file ../../third_party/googletest/src/googletest/include/gtest/gtest.h
The abstract class that all tests inherit from.
In Google Test, a unit test program contains one or many TestSuites, and
each TestSuite contains one or many Tests.
When you define a test using the TEST macro, you don't need to
explicitly derive from Test - the TEST macro automatically does
this for you.
The only time you derive from Test is when defining a test fixture
to be used in a TEST_F. For example:
class FooTest : public testing::Test {
protected:
void SetUp() override { ... }
void TearDown() override { ... }
...
};
TEST_F(FooTest, Bar) { ... }
TEST_F(FooTest, Baz) { ... }
Test is not copyable.
Public Methods
void SetUpTestSuite ()
Sets up the stuff shared by all tests in this test suite.
Google Test will call Foo::SetUpTestSuite() before running the first
test in test suite Foo. Hence a sub-class can define its own
SetUpTestSuite() method to shadow the one defined in the super
class.
Defined at line 255 of file ../../third_party/googletest/src/googletest/include/gtest/gtest.h
void TearDownTestSuite ()
Tears down the stuff shared by all tests in this test suite.
Google Test will call Foo::TearDownTestSuite() after running the last
test in test suite Foo. Hence a sub-class can define its own
TearDownTestSuite() method to shadow the one defined in the super
class.
Defined at line 263 of file ../../third_party/googletest/src/googletest/include/gtest/gtest.h
void TearDownTestCase ()
Defined at line 268 of file ../../third_party/googletest/src/googletest/include/gtest/gtest.h
void SetUpTestCase ()
Defined at line 269 of file ../../third_party/googletest/src/googletest/include/gtest/gtest.h
bool HasFailure ()
Returns true if and only if the current test has a (either fatal or
non-fatal) failure.
Defined at line 283 of file ../../third_party/googletest/src/googletest/include/gtest/gtest.h
void ~Test ()
The d'tor is virtual as we intend to inherit from Test.
bool HasFatalFailure ()
Returns true if and only if the current test has a fatal failure.
bool HasNonfatalFailure ()
Returns true if and only if the current test has a non-fatal failure.
bool IsSkipped ()
Returns true if and only if the current test was skipped.
void RecordProperty (const std::string & key, const std::string & value)
Logs a property for the current test, test suite, or for the entire
invocation of the test program when used outside of the context of a
test suite. Only the last value for a given key is remembered. These
are public static so they can be called from utility functions that are
not members of the test fixture. Calls to RecordProperty made during
lifespan of the test (from the moment its constructor starts to the
moment its destructor finishes) will be output in XML as attributes of
the
<testcase
> element. Properties recorded from fixture's
SetUpTestSuite or TearDownTestSuite are logged as attributes of the
corresponding
<testsuite
> element. Calls to RecordProperty made in the
global context (before or after invocation of RUN_ALL_TESTS and from
SetUp/TearDown method of Environment objects registered with Google
Test) will be output as attributes of the
<testsuites
> element.
template <typename T, std::enable_if_t<std::is_convertible<T, int64_t>::value,
bool> = true>
void RecordProperty (const std::string & key, const T & value)
We do not define a custom serialization except for values that can be
converted to int64_t, but other values could be logged in this way.
Defined at line 303 of file ../../third_party/googletest/src/googletest/include/gtest/gtest.h
Protected Methods
void Test ()
Creates a Test object.
void SetUp ()
Sets up the test fixture.
void TearDown ()
Tears down the test fixture.
Friends
class TestInfo