From the course: PHP: Testing Legacy Applications

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Tests as questions

Tests as questions

From the course: PHP: Testing Legacy Applications

Start my 1-month free trial

Tests as questions

- [Instructor] When you think about the role of tests in your application from a high level, it becomes an interesting exercise. I do this from time to time, because it helps me focus on what value I am supposed to be delivering when I invest a nontrivial amount of time into writing tests. Tests are working examples of your code that should be answering a bunch of questions you have about how the code is supposed to be working. Some of these questions might be, Is your code filtering user input and escaping the output? Is your code handling things nicely when the database isn't available? What happens when I pass in a string when an integer is expected? Or, how do I make sure this list I pass in is properly sorted? I could go on and on, but I think you should be getting the idea. Next, let's think about tests as a mirror. I wish I could take credit for it, but this concept was introduced to me by Gojko Adzic, who has spent a lot more time thinking about testing, specifications, and…

Contents