This repository contains all the code for The Engineering Coach YouTube series on the Test Pyramid. This comprehensive guide will walk you through building a complete REST API with a solid testing strategy.
- How to build a complete REST API using Test-Driven Development (TDD).
- The essential layers of the Test Pyramid in practice.
- How to write End-to-End, Integration, and Unit Tests.
- Techniques for handling errors and refactoring for resilience.
- The principles of Hexagonal Architecture for professional software design.
We start our journey at the top of the pyramid, using end-to-end tests to design a /health endpoint and a 404 Not Found handler.
Watch the video here!
We continue to build our API by adding a GET /books/{isbn} endpoint, exploring how to use end-to-end, integration, and unit tests together.
Watch the video here!
A crucial episode where we learn to handle an unavailable database. We'll refactor our code and use a combination of unit and integration tests to ensure our application is resilient to failure.
Watch the video here!
This video is an essential guide for anyone who wants to learn how to write robust, fault-tolerant code.
Watch the video here!
In the final video, we step away from the code and look at the "big picture." We'll introduce Hexagonal Architecture and show you how it provides a clean, testable structure for your application.
Watch the video here!
To run the code and follow along with the series, you will need PHP, Docker, and Composer.
Clone the repository:
git clone https://github.com/testingallthethings/020-end-to-end cd 020-end-to-end
Start the Docker containers (for Postgres):
docker-compose up -d
Install the dependencies:
composer install
Run the database migrations:
php migrations.php
Run the tests:
./vendor/bin/phpunit
The Engineering Coach is a YouTube channel dedicated to helping software engineers and engineering managers improve their skills and craft. We provide practical advice and tutorials on topics that matter in the real world of software development.
For more software engineering tutorials and coaching, subscribe to The Engineering Coach on YouTube. You can also connect with me on Bluesky or Mastodon.




