1
0
mirror of https://github.com/ThrowTheSwitch/Unity.git synced 2026-01-23 00:15:58 +01:00

Test passing time will be in seconds now

(for xml output)

(cherry picked from commit 39d54e2913b0c3a18106a13705fed2fb8ab7f4b0)
This commit is contained in:
Alex Overchenko
2020-12-03 16:49:49 +03:00
committed by Alex Overchenko
parent edf6a52bfd
commit 32608af4f5

View File

@@ -82,19 +82,19 @@ class ParseOutput
# Pushes xml output data to the array list, which will be written later # Pushes xml output data to the array list, which will be written later
def push_xml_output_passed(test_name, execution_time = 0) def push_xml_output_passed(test_name, execution_time = 0)
@array_list.push ' <testcase classname=' + xml_encode_s(@test_suite) + ' name=' + xml_encode_s(test_name) + ' time=' + xml_encode_s(execution_time.to_s) + ' />' @array_list.push ' <testcase classname=' + xml_encode_s(@test_suite) + ' name=' + xml_encode_s(test_name) + ' time=' + xml_encode_s((execution_time / 1000.0).to_s) + ' />'
end end
# Pushes xml output data to the array list, which will be written later # Pushes xml output data to the array list, which will be written later
def push_xml_output_failed(test_name, reason, execution_time = 0) def push_xml_output_failed(test_name, reason, execution_time = 0)
@array_list.push ' <testcase classname=' + xml_encode_s(@test_suite) + ' name=' + xml_encode_s(test_name) + ' time=' + xml_encode_s(execution_time.to_s) + '>' @array_list.push ' <testcase classname=' + xml_encode_s(@test_suite) + ' name=' + xml_encode_s(test_name) + ' time=' + xml_encode_s((execution_time / 1000.0).to_s) + '>'
@array_list.push ' <failure type="ASSERT FAILED">' + reason + '</failure>' @array_list.push ' <failure type="ASSERT FAILED">' + reason + '</failure>'
@array_list.push ' </testcase>' @array_list.push ' </testcase>'
end end
# Pushes xml output data to the array list, which will be written later # Pushes xml output data to the array list, which will be written later
def push_xml_output_ignored(test_name, reason, execution_time = 0) def push_xml_output_ignored(test_name, reason, execution_time = 0)
@array_list.push ' <testcase classname=' + xml_encode_s(@test_suite) + ' name=' + xml_encode_s(test_name) + ' time=' + xml_encode_s(execution_time.to_s) + '>' @array_list.push ' <testcase classname=' + xml_encode_s(@test_suite) + ' name=' + xml_encode_s(test_name) + ' time=' + xml_encode_s((execution_time / 1000.0).to_s) + '>'
@array_list.push ' <skipped type="TEST IGNORED">' + reason + '</skipped>' @array_list.push ' <skipped type="TEST IGNORED">' + reason + '</skipped>'
@array_list.push ' </testcase>' @array_list.push ' </testcase>'
end end
@@ -240,6 +240,7 @@ class ParseOutput
push_xml_output_ignored(test_name, reason, test_time) if @xml_out push_xml_output_ignored(test_name, reason, test_time) if @xml_out
end end
# Test time will be in ms
def get_test_time(value_with_time) def get_test_time(value_with_time)
test_time_array = value_with_time.scan(/\((-?\d+.?\d*) ms\)\s*$/).flatten.map do |arg_value_str| test_time_array = value_with_time.scan(/\((-?\d+.?\d*) ms\)\s*$/).flatten.map do |arg_value_str|
arg_value_str.include?('.') ? arg_value_str.to_f : arg_value_str.to_i arg_value_str.include?('.') ? arg_value_str.to_f : arg_value_str.to_i