2022-08-24 15:01:07 +00:00
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
from contextlib import AbstractContextManager
|
|
|
|
from typing import Any
|
|
|
|
|
|
|
|
|
2022-10-06 10:17:19 +00:00
|
|
|
class ReporterHandler(ABC):
|
|
|
|
"""Interface of handler that stores test artifacts in some reporting tool."""
|
2022-08-24 15:01:07 +00:00
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def step(self, name: str) -> AbstractContextManager:
|
2022-10-05 09:14:51 +00:00
|
|
|
"""Register a new step in test execution.
|
|
|
|
|
|
|
|
Args:
|
|
|
|
name: Name of the step.
|
2022-08-24 15:01:07 +00:00
|
|
|
|
2022-10-05 09:14:51 +00:00
|
|
|
Returns:
|
|
|
|
Step context.
|
2022-08-24 15:01:07 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
@abstractmethod
|
|
|
|
def attach(self, content: Any, file_name: str) -> None:
|
2022-10-05 09:14:51 +00:00
|
|
|
"""Attach specified content with given file name to the test report.
|
2022-08-24 15:01:07 +00:00
|
|
|
|
2022-10-05 09:14:51 +00:00
|
|
|
Args:
|
|
|
|
content: Content to attach. If content value is not a string, it will be
|
|
|
|
converted to a string.
|
|
|
|
file_name: File name of attachment.
|
2022-08-24 15:01:07 +00:00
|
|
|
"""
|