In Vedro framework there are 3 types of steps:
- “given” - arrange steps, preparing data,
- “when” - the main act,
- “then”, “and” and “but” - asserts
A scenario without the main act does not exist.
class Scenario(vedro.Scenario):
subject = "login as registered user"
def given_registered_user_logined(self):
self.user = fake(NewUserSchema)
registered_user(self.user)
self.response = httpx.post(f"{API_URL}/auth/login", json=self.user)
def then_it_should_return_success_response(self):
assert self.response.status_code == 200
class Scenario(vedro.Scenario):
subject = "login as registered user"
def given_user_data(self):
self.user = fake(NewUserSchema)
def given_registered_user(self):
registered_user(self.user)
def when_user_logins(self):
self.response = httpx.post(f"{API_URL}/auth/login", json=self.user)
def then_it_should_return_success_status_code(self):
assert self.response.status_code == 200