Is a coherent full stack (client and server) testing strategy possible?
Let’s assume we are doing TDD (and maybe BDD too) and we don’t want to write software without a failing test.
Back in the day, whether you were writing PHP, Java, or Asp.Net, testing your server side application was easy. You wrote unit tests for your models, controllers, data objects, etc. Then, you ran them every few minutes as you wrote new code and features. Everything was simple and all of your tests existed in the same language and execution environment as the business logic (i.e. the server).
KissTest, a Simple, Fast, and Beautiful Unit Test Framework for PHP
PHPUnit is a great testing framework. However, over time I began to find myself wishing it had certain features. So I created KissTest. It is a Keep-It-Simple-Straightforward (KISS), very fast, and absolutely gorgeous xUnit style unit test library.
As you can see in the screenshot, the display of the results is right in the browser. Everyone loves the command line and I am no different. However, there is something to be said for seeing the results laid out beautifully like this. Also, the PHP CLI binary is technically different from the one that is used to serve web pages. Generally, I try to keep the execution environment for the development environment and the production environment as close as possible. In fact, my development environment is identical to the production environment except it is running in VirtualBox. KissTest facilitates this. Sweet!
Quick and Dirty PHP Test Driven Development
A long time ago, a unit testing framework for PHP was needed. At the time, there were many preexisting and comprehensive unit testing frameworks. However, a framework was needed that had the ability to run the tests from a browser. Additionally, a framework was required that would easy to integrate into a project while not increasing the footprint too much.
To satisfy these constraints, a PHP unit testing framework called QnDPhpUnitTest was written (UPDATE: This has been superseded by KissTest). Interestingly, the framework and the project that the framework was originally written for were created simultaneously. When an assert was needed, the assert method was written and then the assert was performed. One of the key benefits of this framework is the ability to include a single class and then start writing tests. Also, the framework is so simple that learning how to use it should take no more than a 5-10 minutes.