GuideIntermediate
Testing in CI/CD
Learn to run your test suite automatically on every change with continuous integration. This guide covers what a pipeline is, how to write your first GitHub Actions workflow that runs pytest on every push, how to reproduce a failure that only shows up in CI locally (the environment gap, pinned dependencies), the matrix of Python versions and operating systems, how to speed up the suite with dependency caching and parallelism (`pytest-xdist`), quality gates (coverage thresholds that break the build), and what to do with flaky tests that only fail in CI. It closes with a capstone project: build a complete CI pipeline for Reservo with a version matrix, a coverage gate, caching, and parallelism, delivering the YAML workflow along with the local-parity setup.
- 64
- lessons
- 8
- modules
- English · Spanish
- available in
- Yes
- certificate
- Free
- access
Outcomes
What you'll be able to do
- Understand what a CI pipeline is and why "it works on my machine" isn't enough
- Write your first GitHub Actions workflow that runs pytest on every push, and read its log
- Reproduce a failure that only occurs in CI locally: pinned dependencies and deterministic installs
- Configure the Python version and operating system matrix, and decide when it's worth it
- Speed up the pipeline with dependency caching (`actions/cache`) and parallelism with `pytest-xdist`
- Configure quality gates: a coverage threshold that breaks the build (`--cov-fail-under`)
- Handle flaky tests in CI: the retry debate, quarantining, and why they erode trust in the pipeline
- Build a complete CI pipeline for Reservo with a matrix, caching, parallelism, and a coverage gate as a capstone project
Before you start
What you need to bring
It's for you if...
- Devs who already have a pytest test suite and want to run it automatically on every push
- Teams struggling with slow or unstable (flaky) CI pipelines who want a reliable CI
- Devs who want to learn GitHub Actions applied specifically to automated testing
Requirements and materials
- An existing pytest test suite (or the Testing Fundamentals & TDD Guide completed)
- A GitHub account and basic familiarity with git
- Python 3.10+ and pip installed locally
Content
The syllabus, module by module
Open any of them to see its lessons.
- 1. Module introduction: the suite that only ran on your machine
- 2. "It works on my machine"
- 3. What Continuous Integration is
- 4. The feedback loop and the cost of late failure
- 5. The stages of a pipeline
- 6. What CI protects: the always-green main branch
- 7. CI vs CD: a first look
- 8. Mini-project: map your manual test steps to a pipeline
- 1. Module introduction: from your machine to the pipeline that runs pytest on its own
- 2. Anatomy of a GitHub Actions workflow
- 3. `on:` the triggers: push and pull request
- 4. The steps that prepare the ground: checkout and setup-python
- 5. Installing the dependencies on the runner
- 6. Running pytest and the exit code that paints the job
- 7. Reading the CI log and the status badge
- 8. Mini-project: the `tests.yml` that runs the Reservo suite
- 1. Module introduction: CI red, your machine green
- 2. The symptom: red here, green there (and its causes)
- 3. The environment gap, up close
- 4. Pinned dependencies vs ranges (`==` vs `>=`)
- 5. A clean venv that replicates CI's
- 6. Environment variables and other hidden differences
- 7. The method for reproducing
- 8. Mini-project: reproduce and fix a failure from an unpinned dependency
- 1. Module introduction: the matrix
- 2. Why test in several environments
- 3. `strategy.matrix` of Python versions
- 4. The operating-system matrix
- 5. `include`, `exclude`, and `fail-fast`
- 6. Reading the matrix's N jobs
- 7. When the matrix pays off and when it's noise
- 8. Mini-project: a 3-version matrix for Reservo
- 1. Module introduction: fast and in parallel
- 2. Why a slow CI gets ignored
- 3. Caching dependencies with `actions/cache`
- 4. Parallelizing with `pytest-xdist` and `-n auto`
- 5. Splitting the suite: fast and slow
- 6. Isolation: the requirement for parallelizing
- 7. The speed/cost trade-off
- 8. Mini-project: a fast CI for Reservo
- 1. Module introduction: quality gates
- 2. What a quality gate is
- 3. `--cov-fail-under` and the exit code
- 4. Failing on a coverage drop
- 5. Marker gates and smoke tests
- 6. When the gate helps (and when it gets in the way)
- 7. 100% as a fetish that pushes tautologies
- 8. Mini-project: a coverage gate for Reservo's CI
- 1. Module introduction: the flaky test in CI
- 2. Why the flaky is toxic in CI
- 3. The retry debate: `--reruns`
- 4. Quarantine: mark and isolate
- 5. The failure that only happens in CI
- 6. Reproducing a CI-only failure on your machine
- 7. Fix determinism, do not retry
- 8. Mini-project: a flaky test blocks Reservo's CI
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!