8

My main competence lies in Java (Android). I've been in the industry long enough to realize the benefits of proper testing and I would like to think that I have a somewhat mature idea of how to test production code and how to build up test architecture.

Recently I however tend to get more and more involved in PHP coding. The few PHP projects I've had as of now were more or less straight forward homepages for different charity events and alike where "manual test cases" were sufficient.

But I'm now planing a bigger PHP project for a paying customer (a complete, REST based web application with a heavy database backend, i.e. not a "Welcome to my homepage" project). I realize there is no way a set of manual test instructions listed in a text document will be enough. I need a proper automated test framework, much like the JUnit framework for Java, but for PHP.

Are there any living "industry standard" test frameworks for PHP code out there (preferably open source)? I've read briefly about the PHPUnit and SimpleTest frameworks. Are they recommendable according to you guys?

The project parameters are set: PHP is one of the requirements, hence you don't need to put energy in convincing me of better web platforms etc. (but I will gladly read any side notes and tips you may have, though, - for future projects :-)

dbm
  • 9,888
  • 6
  • 41
  • 55

2 Answers2

3

PHPUnit seems to be the standard for unit testing.

http://www.phpunit.de/manual/current/en/

https://github.com/sebastianbergmann/phpunit/

I have use it for TDD and find it excellent and it ticks all the boxes for you if I understand your question correctly.

vascowhite
  • 17,334
  • 9
  • 56
  • 73
3

Your two main options are PHPUnit and SimpleTest. You can see a comparison of them here: SimpleTest vs PHPunit

However, please note that that discussion is from 2008 and things have changed since then.

If you want to test the actual webpages, and save yourself some trouble clicking on links and submitting forms, check out Selenium: http://seleniumhq.org/

Also, if you're using an IDE like NetBeans or Eclipse, or are using a PHP framework like CakePHP or Zend, it would be well worth your while to see what testing frameworks your tools of choice support.

Community
  • 1
  • 1
mtnorthrop
  • 2,583
  • 1
  • 18
  • 21