class UnitTest

Defined at line 1113 of file ../../third_party/googletest/src/googletest/include/gtest/gtest.h

A UnitTest consists of a vector of TestSuites.

This is a singleton class. The only instance of UnitTest is

created when UnitTest::GetInstance() is first called. This

instance is never deleted.

UnitTest is not copyable.

This class is thread-safe as long as the methods are called

according to their specification.

Public Methods

UnitTest * GetInstance ()

Gets the singleton UnitTest object. The first time this method

is called, a UnitTest object is constructed and returned.

Consecutive calls will return the same object.

int Run ()

Runs all tests in this UnitTest object and prints the result.

Returns 0 if successful, or 1 otherwise.

This method can only be called from the main thread.

INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.

const char * original_working_dir ()

Returns the working directory when the first TEST() or TEST_F()

was executed. The UnitTest object owns the string.

const TestSuite * current_test_suite ()

Returns the TestSuite object for the test that's currently running,

or NULL if no test is running.

const TestCase * current_test_case ()
const TestInfo * current_test_info ()

Returns the TestInfo object for the test that's currently running,

or NULL if no test is running.

int random_seed ()

Returns the random seed used at the start of the current test run.

internal::ParameterizedTestSuiteRegistry & parameterized_test_registry ()

Returns the ParameterizedTestSuiteRegistry object used to keep track of

value-parameterized tests and instantiate and register them.

INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.

int successful_test_suite_count ()

Gets the number of successful test suites.

int failed_test_suite_count ()

Gets the number of failed test suites.

int total_test_suite_count ()

Gets the number of all test suites.

int test_suite_to_run_count ()

Gets the number of all test suites that contain at least one test

that should run.

int successful_test_case_count ()
int failed_test_case_count ()
int total_test_case_count ()
int test_case_to_run_count ()
int successful_test_count ()

Gets the number of successful tests.

int skipped_test_count ()

Gets the number of skipped tests.

int failed_test_count ()

Gets the number of failed tests.

int reportable_disabled_test_count ()

Gets the number of disabled tests that will be reported in the XML report.

int disabled_test_count ()

Gets the number of disabled tests.

int reportable_test_count ()

Gets the number of tests to be printed in the XML report.

int total_test_count ()

Gets the number of all tests.

int test_to_run_count ()

Gets the number of tests that should run.

TimeInMillis start_timestamp ()

Gets the time of the test program start, in ms from the start of the

UNIX epoch.

TimeInMillis elapsed_time ()

Gets the elapsed time, in milliseconds.

bool Passed ()

Returns true if and only if the unit test passed (i.e. all test suites

passed).

bool Failed ()

Returns true if and only if the unit test failed (i.e. some test suite

failed or something outside of all tests failed).

const TestSuite * GetTestSuite (int i)

Gets the i-th test suite among all the test suites. i can range from 0 to

total_test_suite_count() - 1. If i is not in that range, returns NULL.

const TestCase * GetTestCase (int i)
const TestResult & ad_hoc_test_result ()

Returns the TestResult containing information on test failures and

properties logged outside of individual test suites.

TestEventListeners & listeners ()

Returns the list of event listeners that can be used to track events

inside Google Test.

Friends

void UnitTest (TestPartResult::Type result_type, const std::string & message)
internal::UnitTestImpl * UnitTest ()
std::set<std::string> * UnitTest ()
Environment * UnitTest (Environment * env)
class UnitTestRecordPropertyTestHelper
class StreamingListenerTest
class AssertHelper
class TestSuite
class TestInfo
class Test
class ScopedTrace