042: Introduction to Test Driven Development (TDD) with Pest (PHP)

Опубликовано: 21 Октябрь 2024
на канале: Testing All The Things
1,008
36

In this episode of Testing All The Things we are going to look at an alternative testing framework to PHP Unit call Pest.

Pest is a Spec style testing framework where as PHPUnit is a XUnit style testing framework.

During this episode we will use Test Driven Development (TDD) to drive out the implementation a Queue Abstract Data Type in PHP using Pest as the test framework.

We follow strict rules of Test Driven Development (TDD) always writing a test before we write any code.

10 Red (Write a failing test)
20 Green (Make the test pass)
30 Refactor (Clean up the code)
40 GOTO 10

While writing code we only write just enough code to make the test pass, even if this includes hard coded return values or variables that will not exist in our final implementation.

Once we have written a few test we and refactoring steps to clean up the code as we go. We only do any refactoring when all tests are passing. We refactor test and production code.

The code produced during this episode can be found on GitHub:
https://github.com/testingallthething...

You can follow me on twitter:   / braddle  

** Please Rate, Review, Subscribe and Share these videos **