Quality assurance

Running the unit tests

WideImage is tested with PHPUnit. To run the tests, download the full package, go into the test directory and run run.sh (or run.bat). PHPUnit 3.5+ is recommended. The expected output looks somewhat like this:

PHPUnit 3.5.10 by Sebastian Bergmann.

……………………………………………………… 63 / 128 ( 49%)
…gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
….gd warning: one parameter to a memory allocation multiplication is negative or zero, failing operation gracefully
..gd-jpeg: JPEG library reports unrecoverable error: Not a JPEG file: starts with 0×42 0x4d
……………………………………………… 126 / 128 ( 98%)
..

Time: 10 seconds, Memory: 17.00Mb

OK (128 tests, 656 assertions)

There will be some error-like output, but this is due to testing on invalid image files and such, the important thing is the last line; it should be OK. If any of the test fails, please let me know which, along with your OS, PHP and PHPUnit versions.

Continuous integration

WideImage is continuously integrated with Jenkins CI and with help of Template for Jenkins for PHP Projects, PHP Project Wizard, and some other related tools.

The project is checked out of the source code repository upon every change, all the tests are run, and various PHP code tools are used to measure code coverage, detect too long or too complex methods, code style violations, duplicate code, etc. You can follow the builds and see their statuses and various metrics at the Jenkins project view. I didn’t set up really strict standards yet, but I’m keeping (and increasing) a decent coverage, and every now and then try to reduce the complexity of some methods, as reported by these tools.

To learn how to set up your own continuous integration server, see this list of helpful links. It’s really not as complicated as it first looks!

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Reddit
  • Tumblr
  • Twitter