가장 많이 묻는 면접 질문과 답변 & 온라인 테스트
면접 준비, 온라인 테스트, 튜토리얼, 라이브 연습을 위한 학습 플랫폼

집중 학습 경로, 모의고사, 면접 준비 콘텐츠로 실력을 키우세요.

WithoutBook은 주제별 면접 질문, 온라인 연습 테스트, 튜토리얼, 비교 가이드를 하나의 반응형 학습 공간으로 제공합니다.

Chapter 7

Cucumber with Selenium, Page Object Model, UI Automation Architecture, and Maintainable Test Design

Build stable UI automation by combining Cucumber with page objects and layered framework design instead of mixing raw Selenium into every step.

Inside this chapter

  1. Why Page Objects Matter
  2. Simple Page Object Example
  3. Step Definitions Should Stay Thin
  4. Advanced Framework Thinking

Series navigation

Study the chapters in order for the clearest path from beginner BDD concepts to advanced automation architecture. Use the navigation at the bottom of each page to move through the full tutorial series.

Tutorial Home

Chapter 7

Why Page Objects Matter

If every step definition contains raw Selenium locator and interaction code, the framework becomes fragile and hard to update. The page object model separates UI structure and interaction behavior from scenario wording, which makes tests easier to maintain when the UI changes.

Chapter 7

Simple Page Object Example

public class LoginPage {
    private WebDriver driver;

    public LoginPage(WebDriver driver) {
        this.driver = driver;
    }

    public void login(String email, String password) {
        driver.findElement(By.id("email")).sendKeys(email);
        driver.findElement(By.id("password")).sendKeys(password);
        driver.findElement(By.cssSelector("button[type='submit']")).click();
    }
}
Chapter 7

Step Definitions Should Stay Thin

@When("the user logs in with {string} and {string}")
public void the_user_logs_in(String email, String password) {
    loginPage.login(email, password);
}

This keeps business wording in the feature file, coordination in the step definition, and UI mechanics in the page object. That separation improves readability and maintainability.

Chapter 7

Advanced Framework Thinking

Mature frameworks go beyond page objects. They add wait helpers, driver management, reporting, configuration layers, reusable assertions, test data builders, and environment abstraction. Cucumber works best when it sits on top of a thoughtful automation architecture rather than trying to do everything alone.

Copyright © 2026, WithoutBook.