At this month's LAMP meetup we had an educational talk on Unit Testing
by Jakob Heuser, a web engineer from LinkedIn. In PHP, there are a
number of frameworks used by developers including SnapTest, PHPUnit,
SimpleTest, and Tesrilence. The main principle behind Unit Testing is
to validate application requirements. This includes checking
application logic that implements a give requirements, making sure the
fault flows are managed accordingly, and various conditional boundaries
are satisfied. Unit testing focuses on testing smallest component of
the program, such as function, public method, or an include file. With
SnapTest, it is pretty straight forward to get started. After
implementing PHP classes to test the application you can start multiple
tests simultaneously to expedite the testing process. While SnapTest
has a low starting barrier, testing frameworks like PHPUnit is a much
more comprehensive framework. But regardless of the framework that you
pick, here is an ideal order in which you should be building and
testing your application:
Jakob maintains and contributes towards SnapTest framework and his presentation is available at:
http://www.slideshare.net/Jakobo/unit-testing-first-steps
- design your class/API
- create a test suite
- implement the class/API
- run the test suite
- fix failures or errors and go to #4 again
Jakob maintains and contributes towards SnapTest framework and his presentation is available at:
http://www.slideshare.net/Jakobo/unit-testing-first-steps