aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests
diff options
context:
space:
mode:
Diffstat (limited to 'src/onaptests')
-rw-r--r--src/onaptests/steps/base.py6
-rw-r--r--src/onaptests/steps/reports_collection.py7
2 files changed, 8 insertions, 5 deletions
diff --git a/src/onaptests/steps/base.py b/src/onaptests/steps/base.py
index 0715545..8ebe247 100644
--- a/src/onaptests/steps/base.py
+++ b/src/onaptests/steps/base.py
@@ -193,7 +193,8 @@ class BaseStep(ABC):
self._cleanup_report = Report(
step_description=f"[{self.component}] {self.name} cleanup: {self.description}",
step_execution_status=execution_status,
- step_execution_duration=time.time() - self._start_cleanup_time
+ step_execution_duration=time.time() - self._start_cleanup_time,
+ step_component=self.component
)
else:
self._logger.info("*****************************************************")
@@ -207,7 +208,8 @@ class BaseStep(ABC):
self._execution_report = Report(
step_description=f"[{self.component}] {self.name}: {self.description}",
step_execution_status=execution_status if execution_status else ReportStepStatus.FAIL,
- step_execution_duration=time.time() - self._start_execution_time
+ step_execution_duration=time.time() - self._start_execution_time,
+ step_component=self.component
)
return wrapper
diff --git a/src/onaptests/steps/reports_collection.py b/src/onaptests/steps/reports_collection.py
index 0e5076f..be06151 100644
--- a/src/onaptests/steps/reports_collection.py
+++ b/src/onaptests/steps/reports_collection.py
@@ -15,13 +15,13 @@ class ReportStepStatus(Enum):
FAIL = "FAIL"
NOT_EXECUTED = "NOT EXECUTED"
-
@dataclass
class Report:
"""Step execution report."""
step_description: str
step_execution_status: ReportStepStatus
step_execution_duration: float
+ step_component: str
class ReportsCollection:
@@ -95,10 +95,11 @@ class ReportsCollection:
{
'description': step_report.step_description,
'status': step_report.step_execution_status.value,
- 'duration': step_report.step_execution_duration
+ 'duration': step_report.step_execution_duration,
+ 'component': step_report.step_component
}
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
+ json.dump(report_dict, file, indent=4)