diff options
author | Abseil Team <absl-team@google.com> | 2019-07-25 23:04:39 (GMT) |
---|---|---|
committer | Andy Getz <durandal@google.com> | 2019-07-26 00:53:46 (GMT) |
commit | 2134e3fd857d952e03ce76064fad5ac6e9036104 (patch) | |
tree | 5c44ea1333703c6806eaef40ae8e9f2e9b4fea07 /googletest/include/gtest | |
parent | 373ed74af59d344324260bca013656ce41264264 (diff) | |
download | googletest-2134e3fd857d952e03ce76064fad5ac6e9036104.zip googletest-2134e3fd857d952e03ce76064fad5ac6e9036104.tar.gz googletest-2134e3fd857d952e03ce76064fad5ac6e9036104.tar.bz2 |
Googletest export
Adds ISO8601 timestamps to XML output and RFC3339 timestamps to JSON output.
Adds timestamps to testsuites, testsuite and testcases structured JSON/XML output for better reporting how/where time is spent on tests.
PiperOrigin-RevId: 260039817
Diffstat (limited to 'googletest/include/gtest')
-rw-r--r-- | googletest/include/gtest/gtest.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/googletest/include/gtest/gtest.h b/googletest/include/gtest/gtest.h index 0cb5a2e..ff77075 100644 --- a/googletest/include/gtest/gtest.h +++ b/googletest/include/gtest/gtest.h @@ -588,6 +588,10 @@ class GTEST_API_ TestResult { // Returns the elapsed time, in milliseconds. TimeInMillis elapsed_time() const { return elapsed_time_; } + // Gets the time of the test case start, in ms from the start of the + // UNIX epoch. + TimeInMillis start_timestamp() const { return start_timestamp_; } + // Returns the i-th test part result among all the results. i can range from 0 // to total_part_count() - 1. If i is not in that range, aborts the program. const TestPartResult& GetTestPartResult(int i) const; @@ -618,6 +622,9 @@ class GTEST_API_ TestResult { return test_properties_; } + // Sets the start time. + void set_start_timestamp(TimeInMillis start) { start_timestamp_ = start; } + // Sets the elapsed time. void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; } @@ -661,6 +668,8 @@ class GTEST_API_ TestResult { std::vector<TestProperty> test_properties_; // Running count of death tests. int death_test_count_; + // The start time, in milliseconds since UNIX Epoch. + TimeInMillis start_timestamp_; // The elapsed time, in milliseconds. TimeInMillis elapsed_time_; @@ -881,6 +890,10 @@ class GTEST_API_ TestSuite { // Returns the elapsed time, in milliseconds. TimeInMillis elapsed_time() const { return elapsed_time_; } + // Gets the time of the test suite start, in ms from the start of the + // UNIX epoch. + TimeInMillis start_timestamp() const { return start_timestamp_; } + // Returns the i-th test among all the tests. i can range from 0 to // total_test_count() - 1. If i is not in that range, returns NULL. const TestInfo* GetTestInfo(int i) const; @@ -999,6 +1012,8 @@ class GTEST_API_ TestSuite { internal::TearDownTestSuiteFunc tear_down_tc_; // True iff any test in this test suite should run. bool should_run_; + // The start time, in milliseconds since UNIX Epoch. + TimeInMillis start_timestamp_; // Elapsed time, in milliseconds. TimeInMillis elapsed_time_; // Holds test properties recorded during execution of SetUpTestSuite and |