CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-vedro

Pragmatic Testing Framework for Python with BDD-style syntax and pluggable architecture

49%

Overall

Evaluation49%

1.09x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-3/

Checkout Journeys Suite

Acceptance-style scenarios that exercise a miniature checkout flow by composing setup, action, and assertion steps. Provide one class-oriented scenario for the successful path and two function-oriented scenarios for alternative outcomes. Each scenario should carry a human-readable subject string and keep per-scenario state that later steps can read.

Capabilities

Happy path checkout

  • When enough inventory is reserved and the payment provider succeeds on the first try, the scenario finishes in the success state, records the charged total (24), and captures the event order for given/when/then. Inventory starts as {"latte": 3, "mug": 2} and the order requests ("latte", 2, 7) and ("mug", 1, 10). @test

Payment retry on first failure

  • When the first payment attempt fails with a recoverable error but the second attempt succeeds, the scenario retries once, logs both attempts, and finishes in the success state with the final charged total (18). Inventory starts as {"beans": 4} and the order requests ("beans", 2, 9). @test

Out-of-stock path

  • When the requested quantity exceeds available inventory, the scenario stops during the evaluation phase with a clear failure reason and never triggers any payment attempt. Inventory starts as {"filters": 1} and the order requests ("filters", 3, 2). @test

Implementation

@generates

API

"""
Scenarios describing checkout outcomes for a tiny in-memory store.
At runtime, the scenario runner should discover:
- A class-based scenario with subject and step methods.
- Two function-style scenarios built with decorators, each exposing given/when/then steps.
"""

class CheckoutSuccessFlow:
    subject: str  # e.g., "Charge succeeds when items are in stock"
    inventory: dict
    order: list
    events: list
    charge_total: int

    def given_stocked_items(self) -> None: ...
    def when_reserving_and_charging(self) -> None: ...
    def then_charge_is_recorded(self) -> None: ...

    # Steps should:
    # - Reserve items by decrementing inventory for the requested order.
    # - Attempt a single payment equal to the sum of price * quantity.
    # - Append descriptive strings to events for each step in sequence.


def payment_retry_flow():
    """
    Function-style scenario:
    - Given an order priced at 18 with sufficient stock.
    - First payment attempt should fail with a recoverable error and be logged.
    - A retry should succeed, setting the final charge total to 18.
    - The then-step confirms both attempts were executed in order.
    - Events track attempt outcomes, e.g., ["given beans", "when charge failed", "when charge succeeded", "then confirmed"].
    """


def out_of_stock_flow():
    """
    Function-style scenario:
    - Given an order that asks for more units than inventory allows.
    - When step should detect depletion before any payment attempt.
    - Then-step should surface a failure reason indicating which item is short.
    - Events should only include the setup and the failure acknowledgement.
    """

Dependencies { .dependencies }

vedro { .dependency }

Scenario-based test DSL for structuring given/when/then workflows.

@satisfied-by

tessl i tessl/pypi-vedro@1.14.0

tile.json