Chromium Code Reviews| Index: scripts/slave/recipe_modules/chromium_android/resources/test_results_presentation.py |
| diff --git a/scripts/slave/recipe_modules/chromium_android/resources/test_results_presentation.py b/scripts/slave/recipe_modules/chromium_android/resources/test_results_presentation.py |
| index 7ba1aa7e1743155387552525009b760e7308cef1..bf514502d725d8e11418ddad79d5612224c5014a 100644 |
| --- a/scripts/slave/recipe_modules/chromium_android/resources/test_results_presentation.py |
| +++ b/scripts/slave/recipe_modules/chromium_android/resources/test_results_presentation.py |
| @@ -37,13 +37,19 @@ def result_details(json_path): |
| # Convert list of test results into html format. |
| def results_to_html(results): |
| + def code_search(test): |
|
the real yoland
2016/08/08 22:34:51
nice, this is much cleaner than my idea of using j
BigBossZhiling
2016/08/10 20:17:00
Acknowledged.
|
| + search = test.replace('#', '.') |
| + return 'https://cs.corp.google.com/search/?q=%s&type=cs' % search |
|
the real yoland
2016/08/08 22:34:51
this is a bit tricky, because internal links can't
BigBossZhiling
2016/08/10 20:16:59
Done.
|
| suite_row_dict = {} |
| test_row_list = [] |
| for result in results: |
| - data = [{'data': result['name'], 'class': 'align-left'}, |
| - {'data': result['status'], 'class': 'align-center'}, |
| - {'data': result['duration'], 'class': 'align-center'}, |
| - {'data': result['output_snippet'], 'class': 'align-left is-pre'}] |
| + data = [{'data': result['name'], 'class': 'left', |
|
the real yoland
2016/08/08 22:34:51
nit: extra space
BigBossZhiling
2016/08/10 20:17:00
Done.
|
| + 'link': code_search(result['name'])}, |
| + {'data': result['status'], |
| + 'class': 'center ' + result['status'].lower()}, |
| + {'data': result['duration'], 'class': 'center'}, |
| + {'data': result['output_snippet'], |
| + 'class': 'left', 'is_pre': True}] |
| test_row_list.append(data) |
| suite_name = result['name'][:result['name'].index('#')] |
|
the real yoland
2016/08/08 22:34:50
nit: add the comment here to separate construction
BigBossZhiling
2016/08/10 20:16:59
Done.
|
| @@ -57,11 +63,11 @@ def results_to_html(results): |
| if suite_name in suite_row_dict: |
| suite_row = suite_row_dict[suite_name] |
| else: |
| - suite_row = [{'data': suite_name, 'class' : 'align-left'}, |
| - {'data': 0, 'class': 'align-center'}, |
| - {'data': 0, 'class': 'align-center'}, |
| - {'data': 0, 'class': 'align-center'}, |
| - {'data': 0, 'class': 'align-center'}] |
| + suite_row = [{'data': suite_name, 'class' : 'left'}, |
| + {'data': 0, 'class': 'center'}, |
| + {'data': 0, 'class': 'center'}, |
| + {'data': 0, 'class': 'center'}, |
| + {'data': 0, 'class': 'center'}] |
| suite_row_dict[suite_name] = suite_row |
| suite_row[ALL_COUNT]['data'] += 1 |
| @@ -71,6 +77,12 @@ def results_to_html(results): |
| suite_row[FAIL_COUNT]['data'] += 1 |
| suite_row[TIME]['data'] += result['duration'] |
| + for suite in suite_row_dict.values(): |
| + if suite[FAIL_COUNT]['data'] > 0: |
| + suite[FAIL_COUNT]['class'] += ' failure' |
| + else: |
| + suite[FAIL_COUNT]['class'] += ' success' |
| + |
| test_table_values = { |
| 'table_id' : 'test_table', |
| 'table_headers' : [('text', 'test_name'), |
| @@ -78,6 +90,7 @@ def results_to_html(results): |
| ('number', 'duration'), |
| ('text', 'output_snippet'), |
| ], |
| + 'table_class' : 'info', |
| 'table_rows' : test_row_list, |
| } |
| @@ -89,6 +102,7 @@ def results_to_html(results): |
| ('number', 'all_tests'), |
| ('number', 'elapsed_time_ms'), |
| ], |
| + 'table_class' : 'info', |
| 'table_rows' : suite_row_dict.values(), |
| } |
| @@ -110,7 +124,7 @@ def main(): |
| with open(args.html_file, 'w') as html: |
| html.write(result_html_string) |
| else: |
| - raise exception('Json file of result details is not found.') |
| + raise Exception('Json file of result details is not found.') |
| if __name__ == '__main__': |
| sys.exit(main()) |