From eae109afc3f3e95e01f3e658d12262539047cc25 Mon Sep 17 00:00:00 2001 From: Florence Yernaux Date: Mon, 13 Feb 2023 15:51:25 +0100 Subject: [PATCH 1/3] Parse test execution time in unity fixture output --- auto/parse_output.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/auto/parse_output.rb b/auto/parse_output.rb index 864104be..85ec6ff1 100644 --- a/auto/parse_output.rb +++ b/auto/parse_output.rb @@ -131,10 +131,11 @@ def prepare_fixture_line(line) def test_passed_unity_fixture(array) class_name = array[0] test_name = array[1] + test_time = get_test_time(array[array.length - 1]) test_suite_verify(class_name) - printf "%-40s PASS\n", test_name + printf "%-40s PASS %10d ms\n", test_name, test_time - push_xml_output_passed(test_name) if @xml_out + push_xml_output_passed(test_name, test_time) if @xml_out end # Test was flagged as having failed so format the output. From 42997fbf14689d80ca8fd729e20fdae0cb8b2dd0 Mon Sep 17 00:00:00 2001 From: Florence Yernaux Date: Wed, 17 May 2023 08:59:32 +0200 Subject: [PATCH 2/3] fixup! Parse test execution time in unity fixture output --- auto/parse_output.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/auto/parse_output.rb b/auto/parse_output.rb index 85ec6ff1..126c36bd 100644 --- a/auto/parse_output.rb +++ b/auto/parse_output.rb @@ -143,13 +143,14 @@ def test_passed_unity_fixture(array) def test_failed_unity_fixture(array) class_name = array[0] test_name = array[1] + test_time = get_test_time(array[array.length - 1]) test_suite_verify(class_name) reason_array = array[2].split(':') reason = reason_array[-1].lstrip.chomp + ' at line: ' + reason_array[-4] - printf "%-40s FAILED\n", test_name + printf "%-40s FAILED %10d ms\n", test_name, test_time - push_xml_output_failed(test_name, reason) if @xml_out + push_xml_output_failed(test_name, reason, test_time) if @xml_out end # Test was flagged as being ignored so format the output. @@ -157,6 +158,7 @@ def test_failed_unity_fixture(array) def test_ignored_unity_fixture(array) class_name = array[0] test_name = array[1] + test_time = get_test_time(array[array.length - 1]) reason = 'No reason given' if array.size > 2 reason_array = array[2].split(':') @@ -164,9 +166,9 @@ def test_ignored_unity_fixture(array) reason = tmp_reason == 'IGNORE' ? 'No reason given' : tmp_reason end test_suite_verify(class_name) - printf "%-40s IGNORED\n", test_name + printf "%-40s IGNORED %10d ms\n", test_name, test_time - push_xml_output_ignored(test_name, reason) if @xml_out + push_xml_output_ignored(test_name, reason, test_time) if @xml_out end # Test was flagged as having passed so format the output From 84461ba632099f58661e6932d0e9f5a738907555 Mon Sep 17 00:00:00 2001 From: Florence Yernaux Date: Wed, 17 May 2023 14:21:50 +0200 Subject: [PATCH 3/3] Output execution time in fixture for failed and ignored tests --- extras/fixture/src/unity_fixture.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/extras/fixture/src/unity_fixture.c b/extras/fixture/src/unity_fixture.c index c3dda796..31bc08f5 100644 --- a/extras/fixture/src/unity_fixture.c +++ b/extras/fixture/src/unity_fixture.c @@ -124,6 +124,9 @@ void UnityIgnoreTest(const char* printableName, const char* group, const char* n if (UnityFixture.Verbose) { UnityPrint(printableName); + UNITY_EXEC_TIME_START(); + UNITY_EXEC_TIME_STOP(); + UNITY_PRINT_EXEC_TIME(); UNITY_PRINT_EOL(); } else if (UnityFixture.Silent) @@ -286,6 +289,8 @@ void UnityConcludeFixtureTest(void) if (Unity.CurrentTestIgnored) { Unity.TestIgnores++; + UNITY_EXEC_TIME_STOP(); + UNITY_PRINT_EXEC_TIME(); UNITY_PRINT_EOL(); } else if (!Unity.CurrentTestFailed) @@ -302,6 +307,8 @@ void UnityConcludeFixtureTest(void) else /* Unity.CurrentTestFailed */ { Unity.TestFailures++; + UNITY_EXEC_TIME_STOP(); + UNITY_PRINT_EXEC_TIME(); UNITY_PRINT_EOL(); }