Which of the following best describes the correct structure of a Behavior-driven development (BDD) scenario?
Think about the natural flow of setting up context, performing an action, and checking results.
BDD scenarios follow the pattern: Given (setup), When (action), Then (outcome). This helps describe behavior clearly.
Given the following BDD test result summary, what is the overall test status?
Feature: Login functionality
Scenario: Successful login
Given user is on login page
When user enters valid credentials
Then user is redirected to dashboard
Test result: Given passed, When passed, Then failedAll steps must pass for the scenario to pass.
If any step in a BDD scenario fails, the whole scenario is considered failed.
Which assertion correctly verifies that a user is redirected to the dashboard page in a BDD step definition?
def then_user_redirected_to_dashboard():
current_url = get_current_url()The URL should exactly match the dashboard path.
The assertion must confirm the current URL equals the expected dashboard URL to pass.
What is the bug in this BDD step implementation?
from behave import given @given('the user is logged in') def step_impl(context): context.logged_in = True return True
Check what step functions should return in behave framework.
BDD step functions in behave should not return any value; returning True can cause unexpected behavior.
Which Python BDD framework supports natural language feature files, integrates with pytest, and uses the Given-When-Then syntax?
Look for a framework that combines pytest features with BDD style.
pytest-bdd supports natural language feature files, integrates with pytest, and uses Given-When-Then syntax, making it a modern choice.