mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2026-09-26 03:57:27 +00:00
Merge pull request #659 from fy666/master
Parse test execution time in unity fixture output
This commit is contained in:
@@ -138,10 +138,11 @@ class ParseOutput
|
|||||||
def test_passed_unity_fixture(array)
|
def test_passed_unity_fixture(array)
|
||||||
class_name = array[0]
|
class_name = array[0]
|
||||||
test_name = array[1]
|
test_name = array[1]
|
||||||
|
test_time = get_test_time(array[array.length - 1])
|
||||||
test_suite_verify(class_name)
|
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
|
end
|
||||||
|
|
||||||
# Test was flagged as having failed so format the output.
|
# Test was flagged as having failed so format the output.
|
||||||
@@ -149,13 +150,14 @@ class ParseOutput
|
|||||||
def test_failed_unity_fixture(array)
|
def test_failed_unity_fixture(array)
|
||||||
class_name = array[0]
|
class_name = array[0]
|
||||||
test_name = array[1]
|
test_name = array[1]
|
||||||
|
test_time = get_test_time(array[array.length - 1])
|
||||||
test_suite_verify(class_name)
|
test_suite_verify(class_name)
|
||||||
reason_array = array[2].split(':')
|
reason_array = array[2].split(':')
|
||||||
reason = "#{reason_array[-1].lstrip.chomp} at line: #{reason_array[-4]}"
|
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
|
end
|
||||||
|
|
||||||
# Test was flagged as being ignored so format the output.
|
# Test was flagged as being ignored so format the output.
|
||||||
@@ -163,6 +165,7 @@ class ParseOutput
|
|||||||
def test_ignored_unity_fixture(array)
|
def test_ignored_unity_fixture(array)
|
||||||
class_name = array[0]
|
class_name = array[0]
|
||||||
test_name = array[1]
|
test_name = array[1]
|
||||||
|
test_time = get_test_time(array[array.length - 1])
|
||||||
reason = 'No reason given'
|
reason = 'No reason given'
|
||||||
if array.size > 2
|
if array.size > 2
|
||||||
reason_array = array[2].split(':')
|
reason_array = array[2].split(':')
|
||||||
@@ -170,9 +173,9 @@ class ParseOutput
|
|||||||
reason = tmp_reason == 'IGNORE' ? 'No reason given' : tmp_reason
|
reason = tmp_reason == 'IGNORE' ? 'No reason given' : tmp_reason
|
||||||
end
|
end
|
||||||
test_suite_verify(class_name)
|
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
|
end
|
||||||
|
|
||||||
# Test was flagged as having passed so format the output
|
# Test was flagged as having passed so format the output
|
||||||
|
|||||||
@@ -131,6 +131,9 @@ void UnityIgnoreTest(const char* printableName, const char* group, const char* n
|
|||||||
if (UnityFixture.Verbose)
|
if (UnityFixture.Verbose)
|
||||||
{
|
{
|
||||||
UnityPrint(printableName);
|
UnityPrint(printableName);
|
||||||
|
UNITY_EXEC_TIME_START();
|
||||||
|
UNITY_EXEC_TIME_STOP();
|
||||||
|
UNITY_PRINT_EXEC_TIME();
|
||||||
UNITY_PRINT_EOL();
|
UNITY_PRINT_EOL();
|
||||||
}
|
}
|
||||||
else if (UnityFixture.Silent)
|
else if (UnityFixture.Silent)
|
||||||
@@ -323,6 +326,8 @@ void UnityConcludeFixtureTest(void)
|
|||||||
if (Unity.CurrentTestIgnored)
|
if (Unity.CurrentTestIgnored)
|
||||||
{
|
{
|
||||||
Unity.TestIgnores++;
|
Unity.TestIgnores++;
|
||||||
|
UNITY_EXEC_TIME_STOP();
|
||||||
|
UNITY_PRINT_EXEC_TIME();
|
||||||
UNITY_PRINT_EOL();
|
UNITY_PRINT_EOL();
|
||||||
}
|
}
|
||||||
else if (!Unity.CurrentTestFailed)
|
else if (!Unity.CurrentTestFailed)
|
||||||
@@ -339,6 +344,8 @@ void UnityConcludeFixtureTest(void)
|
|||||||
else /* Unity.CurrentTestFailed */
|
else /* Unity.CurrentTestFailed */
|
||||||
{
|
{
|
||||||
Unity.TestFailures++;
|
Unity.TestFailures++;
|
||||||
|
UNITY_EXEC_TIME_STOP();
|
||||||
|
UNITY_PRINT_EXEC_TIME();
|
||||||
UNITY_PRINT_EOL();
|
UNITY_PRINT_EOL();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user