@@ -932,6 +932,86 @@ class UTTestRunner
932932 }
933933 }
934934
935+ void displayRunSummary ()
936+ {
937+ const ::testing::UnitTest &unit_test = *::testing::UnitTest::GetInstance ();
938+ std::vector<TestSuiteInfo> &suites = UTTestRunner::suites;
939+
940+ int total_suites = unit_test.total_test_suite_count ();
941+ int disabled_suites = 0 ; // GoogleTest does not track disabled test suites directly
942+
943+ int total_tests = unit_test.total_test_count ();
944+ int failed_tests = unit_test.failed_test_count ();
945+ int disabled_tests = unit_test.disabled_test_count ();
946+ int skipped_tests = unit_test.skipped_test_count ();
947+ int passed_tests = total_tests - (failed_tests + disabled_tests + skipped_tests);
948+
949+ int total_asserts = 0 ;
950+ int failed_asserts = 0 ;
951+
952+ // Iterate through test suites to gather assertion details
953+ for (int i = 0 ; i < unit_test.total_test_suite_count (); ++i)
954+ {
955+ const ::testing::TestSuite *test_suite = unit_test.GetTestSuite (i);
956+ if (test_suite)
957+ {
958+ total_asserts += test_suite->test_to_run_count ();
959+ failed_asserts += test_suite->failed_test_count ();
960+ }
961+ }
962+
963+ int passed_asserts = total_asserts - failed_asserts;
964+
965+ for (size_t i = 0 ; i < suites.size (); ++i)
966+ {
967+ if (!suites[i].isActive )
968+ {
969+ ++disabled_suites;
970+ }
971+
972+ for (size_t j = 0 ; j < suites[i].tests .size (); ++j)
973+ {
974+ if (!suites[i].tests [j].isActive )
975+ {
976+ ++disabled_tests;
977+ }
978+ }
979+ }
980+
981+ std::cout << " \n "
982+ << " Run Summary:"
983+ << std::setw (10 ) << " Type"
984+ << std::setw (10 ) << " Total"
985+ << std::setw (10 ) << " Ran"
986+ << std::setw (10 ) << " Passed"
987+ << std::setw (10 ) << " Failed"
988+ << std::setw (10 ) << " Inactive"
989+ << std::setw (10 ) << " Skipped\n "
990+ << std::setw (24 ) << " Suites"
991+ << std::right << std::setw (9 ) << total_suites
992+ << std::right << std::setw (9 ) << total_suites - disabled_suites
993+ << std::right << std::setw (9 ) << " n/a"
994+ << std::right << std::setw (9 ) << " n/a"
995+ << std::right << std::setw (9 ) << disabled_suites
996+ << std::right << std::setw (9 ) << " n/a" << " \n "
997+ << std::setw (23 ) << " Tests"
998+ << std::right << std::setw (10 ) << total_tests
999+ << std::right << std::setw (9 ) << passed_tests + failed_tests + disabled_tests + skipped_tests
1000+ << std::right << std::setw (9 ) << passed_tests
1001+ << std::right << std::setw (9 ) << failed_tests
1002+ << std::right << std::setw (9 ) << disabled_tests
1003+ << std::right << std::setw (9 ) << skipped_tests << " \n "
1004+ << std::setw (25 ) << " Asserts"
1005+ << std::right << std::setw (8 ) << total_asserts
1006+ << std::right << std::setw (9 ) << passed_asserts + failed_asserts
1007+ << std::right << std::setw (9 ) << passed_asserts
1008+ << std::right << std::setw (9 ) << failed_asserts
1009+ << std::right << std::setw (9 ) << " n/a"
1010+ << std::right << std::setw (9 ) << " n/a" << " \n "
1011+ << " \n "
1012+ << " Elapsed time = " << std::fixed << std::setprecision (3 ) << unit_test.elapsed_time () / 1000.0 << " seconds\n " ;
1013+ }
1014+
9351015 /* *
9361016 * @brief Disables a test group by adding it to the disabledGroups set and removing it from the enabledGroups set.
9371017 *
@@ -1153,6 +1233,7 @@ UT_status_t UT_run_tests()
11531233 else if (choice == STRING_FORMAT (" R" )[0 ])
11541234 {
11551235 testRunner.runTests ();
1236+ testRunner.displayRunSummary ();
11561237 }
11571238 else if (choice == STRING_FORMAT (" Q" )[0 ])
11581239 {
@@ -1179,9 +1260,14 @@ UT_status_t UT_run_tests()
11791260 }
11801261 }
11811262 }
1263+ else if (UT_get_test_mode () == UT_MODE_AUTOMATED)
1264+ {
1265+ testRunner.runTests ();
1266+ }
11821267 else
11831268 {
11841269 testRunner.runTests ();
1270+ testRunner.displayRunSummary ();
11851271 }
11861272
11871273 UT_LOG ( UT_LOG_ASCII_GREEN " Logfile" UT_LOG_ASCII_NC " :[" UT_LOG_ASCII_YELLOW " %s" UT_LOG_ASCII_NC " ]\n " , UT_log_getLogFilename () );
0 commit comments