diff options
author | pawel.denst <pawel.denst@external.t-mobile.pl> | 2023-05-10 10:50:58 +0000 |
---|---|---|
committer | pawel.denst <pawel.denst@external.t-mobile.pl> | 2023-05-30 22:36:16 +0000 |
commit | ea72aa01e864b6ddf3145d51d060077da00526d3 (patch) | |
tree | 249c7516e5e76e1b2e1453d2bd0e946956738c61 /src/onaptests/steps/reports_collection.py | |
parent | 4299fadeddffd2d24eb672fb26e6fa7cc141899f (diff) |
ONAP Python SDK tests should generate JSON artifact (next to HTML)
Generation of report file in JSON format
Issue-ID: INT-2235
Signed-off-by: pawel.denst <pawel.denst@external.t-mobile.pl>
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@t-mobile.pl>
Change-Id: Ib99a0cb8bf317633e19a4a2e1c41d611a3b9f343
Diffstat (limited to 'src/onaptests/steps/reports_collection.py')
-rw-r--r-- | src/onaptests/steps/reports_collection.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/onaptests/steps/reports_collection.py b/src/onaptests/steps/reports_collection.py index 4b7f79b..0e5076f 100644 --- a/src/onaptests/steps/reports_collection.py +++ b/src/onaptests/steps/reports_collection.py @@ -1,5 +1,7 @@ from dataclasses import dataclass from enum import Enum +import json +from pathlib import Path from typing import List from jinja2 import Environment, FileSystemLoader, select_autoescape from onapsdk.configuration import settings @@ -83,4 +85,20 @@ class ReportsCollection: details=details, components=components, log_path="./pythonsdk.debug.log").dump( - settings.REPORTING_FILE_PATH) + str(Path(settings.REPORTING_FILE_DIRECTORY).joinpath(settings.HTML_REPORTING_FILE_NAME))) + + report_dict = { + 'usecase': usecase, + 'details': details, + 'components': components, + 'steps': [ + { + 'description': step_report.step_description, + 'status': step_report.step_execution_status.value, + 'duration': step_report.step_execution_duration + } + for step_report in reversed(self.report) + ] + } + with (Path(settings.REPORTING_FILE_DIRECTORY).joinpath(settings.JSON_REPORTING_FILE_NAME)).open('w') as file: + json.dump(report_dict, file, indent=4)
\ No newline at end of file |