- Explain the communication problem BDD solves — customer says "security", developer builds "auth", tester writes "login" — all the same feature, three different understandings
- Describe how Given / When / Then creates one shared language for all stakeholders
- Compare BDD with TDD and explain which approach suits which project context
- Distinguish between Cucumber (Java) and pytest-bdd (Python) as equivalent BDD tools
- Create .feature files with correct Gherkin syntax — Feature, Scenario, Given, When, Then
- Use Background to define shared precondition steps that run before every scenario automatically
- Write a Scenario Outline with an Examples table to run one test with multiple data rows
- Use {username} style placeholders to pass Examples table values into scenario step text
- Set up the Cucumber plugin in PyCharm for Gherkin syntax highlighting and navigation
- Install all required packages: pytest, pytest-bdd, selenium, and webdriver-manager
- Create the standard BDD project structure: features/ for Gherkin, steps/ for Python code
- Understand why the steps folder needs an __init__.py to become a Python package
- Configure pytest.ini with bdd_features_base_dir to remove repeated path strings
- Run the first skeleton scenario end-to-end and confirm the whole setup is working
- Bind Gherkin step text to Python functions using @given, @when, and @then decorators
- Link a complete scenario from a feature file to a test function using @scenario
- Extract parameter values from step text using parsers.parse() with curly bracket notation
- Pass multiple parameters (username and password) from Scenario Outline Examples into step functions
- Use functools.partial() to avoid repeating the feature file path on every @scenario decorator
- Organise step definitions into separate files — one per feature area — for clean maintainability
- Initialise ChromeDriver using webdriver_manager — no manual driver downloads ever again
- Open a URL, maximise the window, and navigate using step definitions
- Locate elements using By.ID, By.XPATH, and By.CSS_SELECTOR and interact with them
- Implement explicit waits with WebDriverWait so tests never fail due to page load timing
- Verify page state using assertions on driver.title and element text or visibility
- Close the browser cleanly at the end of every test run
- Create a @given step that opens the browser and returns it as a named fixture using target_fixture="driver"
- Inject the driver into any @when or @then step simply by adding "driver" as a function parameter
- Understand dependency injection: pytest automatically resolves and provides fixture values
- Place shared fixtures in conftest.py so all step files in the project can use them without importing
- Use yield inside a fixture to open the browser before the test and close it after — automatically
- Use Background so common preconditions (like navigating to a page) run before every scenario automatically
- Write one Scenario Outline that runs with 10 different data rows — not 10 separate scenarios
- Organise a growing test suite into multiple feature files and corresponding step files by area
- Configure pytest.ini to eliminate repeated feature folder path strings across all step files
- Apply functools.partial() to create clean @scenario wrappers without path repetition
- Tag specific scenarios with @pytest.mark and run only tagged tests with a single command option
- Implement before and after scenario hooks using autouse fixtures that run without being called explicitly
- Use the pytest_bdd_step_error hook to automatically capture a screenshot the instant any step fails
- Name screenshots dynamically using the scenario name + current timestamp so they are always unique
- Access the driver inside a hook using request.getfixturevalue('driver') without adding it as a parameter
- Extract the failing step name, feature name, and exception details from hook arguments for detailed logs
- Guarantee the browser closes after every test — pass or fail — so no orphaned browser processes remain
- Create a pages/ folder with a dedicated Python class for each page of the application
- Store all locators as private class attributes — never scattered across step files
- Write readable action methods (enter_username, click_login) and verification methods (verify_home_displayed)
- Pass the driver into a Page class through its constructor so it always controls the right browser
- Import and instantiate Page classes cleanly in step definition files
- Return a page object as a target_fixture from a @given step so all following steps can use it automatically
- Install allure-pytest and add the Allure CLI to the system PATH so it works from any terminal
- Run your test suite and save raw results with pytest --alluredir flag
- Generate and open a full interactive Allure report in the browser with one command
- Attach failure screenshots directly to Allure report entries using allure.attach()
- Generate an HTML report alternative using pytest-html for quick sharing
- Walk through your entire framework architecture — feature files, steps, fixtures, POM, hooks, reporting — in an interview
Interview Preparation Tips
What is BDD and why use it?
BDD fixes the gap between what business wants and what tech builds. Tests in Gherkin (Given/When/Then) are readable by non-technical stakeholders, ensuring everyone is testing the same understanding of a requirement — not three different interpretations.
How does target_fixture work?
Adding target_fixture="driver" to a @given decorator makes the step's return value become a named pytest fixture. Any later step that lists "driver" as a function argument receives that browser instance automatically — no global variables needed.
Scenario vs Scenario Outline
Scenario runs once with fixed hardcoded values. Scenario Outline runs multiple times — once per row in the Examples table. One Scenario Outline can cover valid login, invalid credentials, and empty fields without writing three separate scenarios.
What does Background do?
Background defines steps that run automatically before every Scenario in a feature file. Use it for common setup like "Given I navigate to the login page" so you do not repeat the same Given step at the top of every scenario.
Why POM with BDD?
Step definitions call page methods (login_page.click_submit()) rather than repeating locator strings. When a locator changes — which happens constantly in real projects — you fix it in one class and all scenarios keep working without touching any step file.
How are screenshots captured on failure?
pytest_bdd_step_error fires automatically when any step fails. Inside it, request.getfixturevalue('driver') retrieves the browser, save_screenshot() captures it with a timestamped name, and allure.attach() embeds it in the report.
- pytest basics recap
- Selenium locators quick reference
- Gherkin keyword summary
- @given / @when / @then usage
- parsers.parse() syntax
- conftest.py fixture scope
- POM structure review
- Allure CLI commands