GuideIntermediate
Test Automation Framework Architecture
Learn to move from "loose test scripts" to a maintainable test automation framework with pytest. This guide covers fixture architecture as the backbone of the framework, the `conftest.py` hierarchy, how to organize the suite into layers (unit/integration) or by feature, custom markers and configuration (`pytest.ini`/`pyproject.toml`) as the framework's contract, a shared utilities and assertions library instead of copy-paste, how to extend pytest with custom plugins and hooks, and data and environment architecture that keeps the framework portable between local and CI. It closes with a capstone project: design and build a real test framework for Reservo, with shared fixtures, markers, a helper library, and per-environment configuration.
- 64
- lessons
- 8
- modules
- English · Spanish
- available in
- Yes
- certificate
- Free
- access
Outcomes
What you'll be able to do
- Recognize when a test suite stops being "loose scripts" and needs architecture, and the real cost of duplicated setup
- Design fixture architecture as the backbone of the framework: `conftest.py` hierarchy, scope decisions, and fixture composition
- Organize the suite into layers (unit/integration) or by feature, with its own `conftest.py` per folder
- Configure custom markers and `pytest.ini`/`pyproject.toml` as the framework's contract, and select test subsets with `-m`
- Build a shared utilities and assertions library, avoiding DRY that hides what the test actually verifies
- Extend pytest with custom plugins and hooks (`pytest_addoption`, fixture hooks, and reporting hooks)
- Design data and environment architecture (shared builders, local vs. CI configuration) while keeping the framework portable
- Build a complete test framework for Reservo end to end as a capstone project
Before you start
What you need to bring
It's for you if...
- Devs who already write individual tests with pytest but whose suite has grown hard to maintain
- Teams with test setup duplicated across hundreds of files
- Devs who want to move from a disorganized test folder to their own portable test automation framework
Requirements and materials
- Basic pytest and TDD knowledge (or the Testing Fundamentals & TDD Guide completed)
- Python installed (3.10+) and familiarity with the command line
- Experience writing at least some tests with pytest
Content
The syllabus, module by module
Open any of them to see its lessons.
- 1. Module introduction: a suite is a system
- 2. The copy-paste setup tax
- 3. What a test framework is (and is not)
- 4. The four layers of a framework
- 5. DRY versus clarity: the test's tension
- 6. The suite that doesn't scale
- 7. The return on investing in architecture
- 8. Mini-project: extract your first shared fixture
- 1. Module introduction: the fixture as a backbone
- 2. The fixture as a reusable piece
- 3. `conftest.py` and its hierarchy
- 4. Scope as an architecture decision
- 5. Composing fixtures: the dependency graph
- 6. `yield`: setup and teardown in a single fixture
- 7. Fixtures that manufacture and `autouse`
- 8. Mini-project: Reservo's fixture backbone
- 1. Module introduction: the shape of the suite
- 2. Why the shape of the suite matters
- 3. By layer versus by feature
- 4. A `conftest.py` per folder
- 5. Unit and integration as physical layers
- 6. Test discovery and `testpaths`
- 7. Structure as living documentation
- 8. Mini-project: reorganize a flat Reservo suite into layers
- 1. Module introduction: the support-code library
- 2. Helpers, fixtures and copy-paste
- 3. The custom assertion
- 4. `__tracebackhide__`: making the failure point at the test
- 5. The harness: setup and teardown as a module
- 6. DRY without hidden magic
- 7. When a helper is worth it
- 8. Mini-project: Reservo's utilities library
- 1. Module introduction: the extension layer
- 2. The `conftest.py` as a local plugin
- 3. `pytest_addoption` and reading the option
- 4. `pytest_collection_modifyitems`
- 5. Reporting hooks: header and summary
- 6. Local conftest vs packaged plugin
- 7. Plugin or fixture? The rule
- 8. Mini-project: `--env` option and framework summary
- 1. Module introduction: the data and environments layer
- 2. The test data problem at scale
- 3. The factory as a shared module
- 4. Sensible defaults
- 5. Per-environment config with `--env` and variables
- 6. The parametrized `settings` fixture
- 7. Portability: no absolute paths
- 8. Mini-project: factory and per-environment config for Reservo
- 1. Module introduction: the complete Reservo framework
- 2. The fixtures backbone and the `conftest.py` hierarchy
- 3. The folder structure and the markers
- 4. The helpers and assertions library
- 5. The local plugin and the summary hook
- 6. The data factory and the per-environment config
- 7. Assembling and running the whole suite
- 8. Project: build the test framework for Reservo
Common questions
What people usually ask
No limit. It's a free guide: come in whenever you like, as often as you like.
No. Modules run from easier to harder, but you can jump to the one you need. Progress is saved per lesson.
Whatever is needed is listed under “What you need to bring”, above. If nothing is listed there, you can start from zero.
In the Club's WhatsApp group, and every two weeks there's a live with an instructor where questions get worked through.
Yes. It's issued automatically once you finish every lesson, with a verifiable code you can share on LinkedIn.
Start whenever you like
What students say
These reviews are from enrolled students who completed at least 50% of the course. We moderate reviews only on content grounds (spam, offensive language, personal data), never for being critical or negative.
No approved reviews yet.
Be the first to share your experience!