News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

QaFoo.com:
Code Coverage with Behat
April 03, 2013 @ 12:37:30

On the QaFoo blog today there's a post for those using the Behat testing tool showing a way to collect code coverage metrics based on your tests using the PHP_CodeCoverage library and phpcov.

There is generally no point in having code coverage for Behat test cases because of their nature: The purpose of an acceptance test is to assert a certain behavior of an application, not to technically test a piece of code. Therefore, there is no point in checking for uncovered code pieces in order to write a Behat test for it. That said, there is still a scenario where you want to peek at code coverage of Behat tests: When creating them as wide-coverage tests before starting to refactor legacy code. Behat in combination with Mink provides you with a great tool for such tests.

They help you get the tools installed and show the code you'll need to add to the application itself to collect the coverage data as the tests execute. It keys off of a file existing/not existing to know if it should execute the coverage or not. The phpcov tool can then be used to generate the HTML output of the coverage information for easy viewing.

0 comments voice your opinion now!
code coverage testing functional behat tutorial phpcov phpcodecoverage

Link: http://qafoo.com/blog/040_code_coverage_with_behat.html

blog comments powered by Disqus

Similar Posts

Michael Girouard's Blog: Pro Tip: Installing PHP 5.2.9 on CentOS

Rob Allen: Caching your ZF2 merged configuration

Zend Developer Zone: PHP and Java: Using Java Print Service with Zend Server Community Edition

Till Klampaeckel's Blog: So you'd like to migrate from MySQL to CouchDB? - Part II

JSLabs Blog: How to write an image gallery script in PHP


Community Events











Don't see your event here?
Let us know!


language package unittest opinion introduction example composer symfony2 framework overview application release hhvm component podcast facebook security code hack install

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework