Testing the ezcGraph Component

Kore Nordmann » 17 April 2009 » in Open Source Case Studies » 0 Comments

This is an abstract for a chapter from a book on Quality Assurance in PHP Projects.

The Graph component from the eZ Components project provides an easy to use and extensible library for creating graphical charts. In the eZ Components project we aim to develop test-driven, which resulted in two challenges developing this library.

The output generated by a Graph component is an image, which in most cases is binary-encoded data. Expectations are really hard to create by hand, it is only feasible to create functional tests replaying once created data. The actual image is generated by external libraries such as ext/gd. These external libraries may change their exact output at any time, or even between two runs with the same version of the library. Comparisons of the generated images need to respect that and implement special assertions for the given type of binary data.

Testing the created binary data has proven to be prone to errors. Since the actual image generation has been abstracted away, we are able to use of different image creation mechanisms. Thanks to the support for mock objects in PHPUnit, all calls to the driver layer can be checked for correctness without actually generating images.

Kore Nordmann is an active member of the PHP community and works for eZ Systems on the eZ Components.

Trackback specific URI for this entry

0 Comments to "Testing the ezcGraph Component"

Display comments as (Linear | Threaded)
  1. No comments

1 Trackback to "Testing the ezcGraph Component"

  1. Quality Assurance in PHP Projects 04/11/2009 at 09:36
    It has been quiet on this website since we posted the last contributed chapter abstract in June and it is time to give you an update. But first, allow me to refresh your memory on the list of contributed chapters:Case Studies on QA Processes in CompaniesQ

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.


Submitted comments will be subject to moderation before being displayed.