Friday, December 12, 2025

thumbnail

Folder Structure for a Scalable Selenium Framework

 Folder Structure for a Scalable Selenium Framework

A scalable Selenium framework should be:

Modular (easy to extend)

Maintainable (clear separation of concerns)

Reusable (components shared across tests)

CI/CD friendly (consistent structure)

Configurable (environment, browser, test data)

Based on Page Object Model (POM)

Below is a standard folder structure used in modern automation teams.

Recommended Folder Structure

selenium-framework/

├── config/

├── base_config.yaml

├── qa_config.yaml

├── prod_config.yaml

└── browser_config.json

├── tests/

├── smoke/

├── regression/

├── integration/

└── api/ # optional if API tests included

├── pages/

├── login_page.py

├── dashboard_page.py

├── product_page.py

└── base_page.py

├── utils/

├── logger.py

├── helpers.py

├── wait_utils.py

├── driver_factory.py

└── screenshot.py

├── data/

├── testdata.csv

├── users.json

└── sample_payloads/

├── drivers/

├── chromedriver.exe

├── geckodriver.exe

└── edgedriver.exe

├── resources/

├── locators/

├── test_files/

└── sample_downloads/

├── reports/

├── html/

├── junit/

└── screenshots/

├── logs/

└── automation.log

├── ci/

├── github-actions.yaml

├── jenkinsfile

└── gitlab-ci.yaml

├── requirements.txt or pom.xml or package.json

├── .env

└── README.md

๐Ÿ” Folder-by-Folder Explanation

1. config/

Stores environment-specific and browser configurations.

Examples:

URLs (QA, Stage, Prod)

User credentials (loaded from secrets)

Browser type (chrome/firefox/headless)

Timeout settings

2. tests/

Organize test suites by type:

smoke quick checks

regression full coverage

integration cross-component tests

api (optional) API + UI combined testing

Each test module should follow a consistent naming pattern:

test_login.py

test_checkout.py

3. pages/ (Page Object Model)

Each page class represents a web page.

Example login_page.py:

Locators

Actions (login(), enter_username(), click_submit())

Validations

Include a base_page.py for shared Selenium functions:

click()

send_keys()

wait_for_element()

4. utils/

Contains helper modules used across the framework.

Examples:

logger.py central logging setup

wait_utils.py WebDriverWait wrappers

helpers.py random data, date functions

driver_factory.py Start browser based on config

screenshot.py capture screenshots on failures

5. data/

Includes all test data:

CSV datasets

JSON user accounts

XML files

Payloads for API integration

6. drivers/

WebDriver binaries for:

Chrome

Firefox

Edge

(Optional if using WebDriverManager)

7. resources/

Supporting files like:

Element locator repositories

Documents for file upload tests

Sample downloads

Static reference files

8. reports/

For storing test results:

HTML reports

Allure reports

Screenshots on failure

JUnit XML outputs (for CI tools like Jenkins/GitHub Actions)

9. logs/

Centralized logging for debugging failed tests.

10. ci/

CI/CD automation scripts for:

Jenkins

GitHub Actions

GitLab CI

Keeps CI configs clean and versioned.

11. Root-Level Files

requirements.txt (Python) or pom.xml (Java) or package.json (JS)

.env environment variables

README.md documentation and setup instructions

Best Practices for a Scalable Selenium Framework

Follow Page Object Model (POM)

Keeps tests clean and pages reusable.

Add a BasePage for common Selenium actions

Prevents duplicate code across pages.

Avoid hardcoded values

Use:

Config files

Environment variables

Test data files

Use a Driver Factory

Supports:

Multiple browsers

Headless mode

Remote WebDriver (Selenium Grid / Docker)

Integrate reporting

Use:

Allure

ExtentReports

PyTest HTML report

Enable parallel test execution

Use:

PyTest-xdist

TestNG (Java)

JUnit 5

CI-ready from day one

Framework should run smoothly in:

Jenkins

GitHub Actions

GitLab CI

Azure DevOps

๐ŸŽ‰ Summary

A scalable Selenium framework must be modular, clean, and CI-friendly.

The structure above supports:

Separation of concerns

Reusability of pages and utilities

Environment-based testing

Easy onboarding for new team members

Growth as your application expands

Learn Selenium with JAVA Training in Hyderabad

Read More

Building a Modular Selenium Framework in Java

๐Ÿงฑ Framework Building & Design

Using Config Files for Environment Management

Reading Environment Variables in Selenium Tests

Visit Our Quality Thought Institute in Hyderabad

Get Directions

Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments

About

Search This Blog

Powered by Blogger.

Blog Archive