mirror of https://github.com/ARMmbed/mbed-os.git
Refactoring of report exporter to support HTML and JUNIT. Added unicode encoding for strings coming from serial console
parent
091cccaf6e
commit
2274651892
|
@ -1274,16 +1274,6 @@ def singletest_in_cli_mode(single_test):
|
||||||
test_summary, shuffle_seed, test_summary_ext, test_suite_properties_ext = single_test.execute()
|
test_summary, shuffle_seed, test_summary_ext, test_suite_properties_ext = single_test.execute()
|
||||||
elapsed_time = time() - start
|
elapsed_time = time() - start
|
||||||
|
|
||||||
if single_test.opts_report_html_file_name:
|
|
||||||
# Export results in form of HTML report to separate file
|
|
||||||
report_exporter = ReportExporter(ResultExporterType.HTML)
|
|
||||||
report_exporter.report_to_file(test_summary_ext, single_test.opts_report_html_file_name, test_suite_properties=test_suite_properties_ext)
|
|
||||||
|
|
||||||
if single_test.opts_report_junit_file_name:
|
|
||||||
# Export results in form of HTML report to separate file
|
|
||||||
report_exporter = ReportExporter(ResultExporterType.JUNIT)
|
|
||||||
report_exporter.report_to_file(test_summary_ext, single_test.opts_report_junit_file_name, test_suite_properties=test_suite_properties_ext)
|
|
||||||
|
|
||||||
# Human readable summary
|
# Human readable summary
|
||||||
if not single_test.opts_suppress_summary:
|
if not single_test.opts_suppress_summary:
|
||||||
# prints well-formed summary with results (SQL table like)
|
# prints well-formed summary with results (SQL table like)
|
||||||
|
@ -1294,6 +1284,16 @@ def singletest_in_cli_mode(single_test):
|
||||||
print single_test.generate_test_summary_by_target(test_summary, shuffle_seed)
|
print single_test.generate_test_summary_by_target(test_summary, shuffle_seed)
|
||||||
print "Completed in %.2f sec"% (elapsed_time)
|
print "Completed in %.2f sec"% (elapsed_time)
|
||||||
|
|
||||||
|
# Store extra reports in files
|
||||||
|
if single_test.opts_report_html_file_name:
|
||||||
|
# Export results in form of HTML report to separate file
|
||||||
|
report_exporter = ReportExporter(ResultExporterType.HTML)
|
||||||
|
report_exporter.report_to_file(test_summary_ext, single_test.opts_report_html_file_name, test_suite_properties=test_suite_properties_ext)
|
||||||
|
if single_test.opts_report_junit_file_name:
|
||||||
|
# Export results in form of HTML report to separate file
|
||||||
|
report_exporter = ReportExporter(ResultExporterType.JUNIT)
|
||||||
|
report_exporter.report_to_file(test_summary_ext, single_test.opts_report_junit_file_name, test_suite_properties=test_suite_properties_ext)
|
||||||
|
|
||||||
|
|
||||||
def mps2_set_board_image_file(disk, images_cfg_path, image0file_path, image_name='images.txt'):
|
def mps2_set_board_image_file(disk, images_cfg_path, image0file_path, image_name='images.txt'):
|
||||||
""" This function will alter image cfg file.
|
""" This function will alter image cfg file.
|
||||||
|
|
|
@ -121,7 +121,7 @@ class ReportExporter():
|
||||||
tooltip_name,
|
tooltip_name,
|
||||||
test['test_description'],
|
test['test_description'],
|
||||||
test['elapsed_time'],
|
test['elapsed_time'],
|
||||||
test['single_test_output'].encode('ascii', 'ignore').replace('\n', '<br />'))
|
unicode(test['single_test_output'], errors='ignore').replace('\n', '<br />'))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_result_tree(self, test_results):
|
def get_result_tree(self, test_results):
|
||||||
|
@ -216,7 +216,7 @@ class ReportExporter():
|
||||||
name = test_result['test_description']
|
name = test_result['test_description']
|
||||||
classname = 'test.%s.%s.%s'% (target, toolchain, test_result['test_id'])
|
classname = 'test.%s.%s.%s'% (target, toolchain, test_result['test_id'])
|
||||||
elapsed_sec = test_result['elapsed_time']
|
elapsed_sec = test_result['elapsed_time']
|
||||||
_stdout = test_result['single_test_output'].encode('ascii', 'ignore')
|
_stdout = unicode(test_result['single_test_output'], errors='ignore')
|
||||||
_stderr = ''
|
_stderr = ''
|
||||||
|
|
||||||
tc = TestCase(name, classname, elapsed_sec, _stdout, _stderr)
|
tc = TestCase(name, classname, elapsed_sec, _stdout, _stderr)
|
||||||
|
|
Loading…
Reference in New Issue