Articles |
 |
Developer News |
 |
|
|
| Want to receive new articles via e-mail? Click here! |
/Home
/PHP
 |
UnitTesting in PHP using SimpleTest  |
|
|
|
|
Synopsis:
Unit testing is writing more code which will test the main code wirtten by "throwing" sample data at it and examining what it gets back. |
|
|
The Article
ConclusionNow after all this effort, you might ask: "Why bother writing all these tests?" I tell you it's much better than debugging with nasty ways such as var_dump()'s and difficult investigations to find if there were any typos or null statments or whatever might be causing the problem. With unit testing, the test case will report were exactly is the problem. With unit testing, if you ever change your class implementation, all you have to do is run the test case and it will report if everything is functioning correctly or not and give details about any failures, if any. Another advantage is that you are separating the debugging code from the original code! No need to clean up after debugging or anything.
A final remark, SimpleTest has great potential and many other features like mock objects and web tester which could make your debugging process easier than ever! for example, the web tester can navigate your website, follow links, click buttons, submit forms and much more! In this article, we were demonstrating the most basic use of unit testing. It is just a kick off to infect you with the Test-infection :D If you want to learn more about this great framework, read the docs at LastCraft.
|
|
|
| Similar/related articles:
|
|
|
|
Sponsors |
 |
|
|
|