News 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

NetTuts.com: Refactoring Legacy Code: Part 6 - Attacking Complex Methods

MongoDB Blog: MongoDB for the PHP Mind, Part 1

SitePoint PHP Blog: How to Implement User Log-in with PayPal

PHPBuilder.com: PHP and Adobe Flex

Andrew Podner: Make it Testable-No Matter how Painful it is


Community Events

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


library voicesoftheelephpant psr7 opinion introduction podcast laravel laravel5 language unittest release community video development series extension api conference framework interview

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