The Flaw In Test Driven Design
In software engineering, the concept of test driven design works as follows:
Step 1. Write a test, for example, “when we load a a particular URL, we expect there to be a page there”.
That’s a pretty simple test. In PHPUnit, it would look like this.
$this->get('/')->assertStatus(200);
Step 2. Write the code to make the test pass.
In order to pass the test in step 1, that essentially means creating a page that loads at domain.com/ in your app.
And that’s it!
This way of writing code by always writing a test first and then writing the code to pass the test, lands you with a very robust code base when you’re done.
There is, however, one very big flaw – this only works if you are very proficient with the testing framework.
What do you do if you don’t know how to write the test?
Google, perhaps unsurprisingly, has far better tutorials and resources on how to write code than it does on how to write tests.
It’s a problem.
In software engineering, the concept of test driven design works as follows: Step 1. Write a test, for example, “when we load a a particular URL, we expect there to be a page there”. That’s a pretty simple test. In PHPUnit, it would look like this. Step 2. Write the code to make the test…