ScenarioRetryΒΆ

.. py:class:: ScenarioRetry(scenario: str, attempts: int, final_status: str, exceptions: list[str] = , key: str | None = None) :module: behave_retry :canonical: behave_retry.stats.ScenarioRetry

Bases: :py:class:object

Record of retry attempts for a single scenario.

.. attribute:: scenario

  The name of the scenario.

  :type: str

.. attribute:: attempts

  Total number of execution attempts (1 = no retry).

  :type: int

.. attribute:: final_status

  The final status: ``"passed"`` or ``"failed"``.

  :type: str

.. attribute:: exceptions

  List of exception class names encountered.

  :type: list[str]

.. attribute:: key

  Optional unique key (``filename:line``) to prevent collisions.

  :type: str | None

.. py:attribute:: ScenarioRetry.attempts :module: behave_retry :type: int

.. py:attribute:: ScenarioRetry.exceptions :module: behave_retry :type: list[str]

.. py:attribute:: ScenarioRetry.final_status :module: behave_retry :type: str

.. py:attribute:: ScenarioRetry.key :module: behave_retry :type: str | None :value: None

.. py:property:: ScenarioRetry.passed_on_retry :module: behave_retry :type: bool

  True if the scenario passed after at least one retry.

.. py:attribute:: ScenarioRetry.scenario :module: behave_retry :type: str

.. py:method:: ScenarioRetry.to_dict() -> dict[str, object] :module: behave_retry

  Serialize to a dictionary for CI/CD reporting.

  :returns: A dictionary with scenario, attempts, final_status,
            exceptions, was_retried, and passed_on_retry keys.

.. py:property:: ScenarioRetry.was_retried :module: behave_retry :type: bool

  True if the scenario was retried at least once.