Vedro

raw JSON →
1.15.1 verified Mon Apr 27 auth: no python

Vedro is a pragmatic testing framework for Python, focusing on simplicity and readability. It supports BDD-style scenarios, parametrized tests, and rich plugins. Current version is 1.15.1, with a regular release cadence of minor versions every few months.

pip install vedro
error ModuleNotFoundError: No module named 'vedro'
cause Vedro is not installed or installed in a different environment.
fix
Run: pip install vedro --upgrade
error TypeError: __init__() takes 1 positional argument but 2 were given
cause Mismatch between @params decorator arguments and __init__ parameters.
fix
Update __init__ to accept the same number of arguments as provided by @params (excluding self).
error vedro.exceptions.ScenarioValidationError: Scenario '...' must have a non-empty 'subject'
cause Missing subject attribute in the Scenario class (required since v1.10).
fix
Add subject = 'Some description' to the Scenario class.
gotcha Scenarios must be classes inheriting from Scenario and placed in files matching **/scenarios/**/*.py. Forgetting this pattern will cause tests not to be discovered.
fix Place test files under a 'scenarios' directory in your project.
breaking In v1.10, the 'subject' attribute became mandatory for each Scenario. Omitting it now raises an error.
fix Add subject = 'description' to every Scenario class.
gotcha When using @params, the __init__ method must accept the same number of arguments as params (including self). Mismatch causes cryptic errors.
fix Ensure __init__ parameters exactly match the @params decorator arguments.

Minimal scenario example with parametrized tests.

from vedro import Scenario, given, when, then, params

class LoginScenario(Scenario):
    subject = "user login"

    @params("valid_user", "password123")
    @params("invalid_user", "wrongpass")
    def __init__(self, username, password):
        self.username = username
        self.password = password

    def given_user_exists(self):
        self.user = {"username": self.username, "password": self.password}

    def when_user_logs_in(self):
        self.result = self.authenticate(self.user)

    def then_it_should_succeed_or_fail(self):
        expected = self.username == "valid_user"
        assert self.result == expected

    def authenticate(self, user):
        return user["username"] == "valid_user"

# Run with: vedro run