Framework Architecture & CI/CD · Lesson 1 of 6

Designing a Framework from Scratch: The Layers

Up to now you've written tests. Now you'll design the thing tests sit on top of. It sounds like a big leap, but it comes down to one habit: keep each kind of change in its own box.

By Shahriyar · Updated

The idea, in one line

Split the framework into layers, so a change in one place never ripples through everything else. That's what "architecture" really means here.

The six layers

Why split it this way

The rule behind the split is how often each thing changes. Selectors change all the time, so they live in Pages. Environments change every run, so they live in Config. Tests should barely change at all. When you isolate the fast-moving parts, one edit stays one edit.

▸ the layout
# A layered project keeps change contained
# framework/
# +- config/       # settings, env vars, base URLs
# |    settings.py
# +- core/         # driver factory, base classes, waits
# |    base_page.py
# +- pages/        # one class per screen (UI) or resource (API)
# |    login_page.py
# +- data/         # factories + builders for test inputs
# |    user_factory.py
# +- tests/        # thin: arrange, act, assert
# |    test_login.py
# +- conftest.py   # fixtures wire the layers together
#
# A selector change touches only pages/
# A new environment touches only config/  -- never tests/

Read it top to bottom: each folder owns one job. If a change forces you to edit several folders at once, that's a sign the layers are leaking into each other.

Advanced — what interviewers listen for

When someone asks "how is your framework structured," the layered list is only half the answer. The other half is the why — tie each layer back to its rate of change. That reasoning is what marks you out as an architect rather than a test writer.

Grounded in the pytest docs (good integration practices) and the Page Object Model guidance in the Selenium docs

All lessons in Framework Architecture & CI/CD

  1. Designing a Framework from Scratch: The Layers
  2. The Four Patterns SDETs Actually Use
  3. Test Data: Fixtures vs Factories vs Seeding
  4. CI with GitHub Actions: Run UI + API on Every Push
  5. Docker & Selenium Grid: Reproducible Test Environments
  6. Parallel, Retries & Flaky-Test Quarantine