<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Professional PHP &#187; unit-testing</title>
	<atom:link href="http://www.procata.com/blog/archives/tag/unit-testing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.procata.com/blog</link>
	<description>PHP Programming, Web Development, PHP Advocacy and PHP Best Practices.</description>
	<lastBuildDate>Tue, 20 Oct 2009 00:57:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>un-PEAR-ing</title>
		<link>http://www.procata.com/blog/archives/2006/07/05/un-pear-ing/</link>
		<comments>http://www.procata.com/blog/archives/2006/07/05/un-pear-ing/#comments</comments>
		<pubDate>Wed, 05 Jul 2006 21:21:17 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[pear]]></category>
		<category><![CDATA[phpunit]]></category>
		<category><![CDATA[unit-testing]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2006/07/05/un-pear-ing/</guid>
		<description><![CDATA[Astonishing.  I&#8217;m quite surprised.  I thought PHPUnit was fairly well integrated into PEAR  (pear run-tests).  I&#8217;m not sure if this is a fork, or if PEAR will continue to use PHPUnit as an external dependency?
I&#8217;ve never been a PEAR fan.  My experiences being peripherally involved with the XML_HTMLSax package weren&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sebastian-bergmann.de/blog/archives/610-So-Long,-and-Thanks-for-All-the-PEARs.html">Astonishing</a>.  I&#8217;m quite surprised.  I thought PHPUnit was fairly well integrated into PEAR  (pear run-tests).  I&#8217;m not sure if this is a fork, or if PEAR will continue to use PHPUnit as an external dependency?</p>
<p>I&#8217;ve never been a PEAR fan.  My experiences being peripherally involved with the <a href="http://pear.php.net/package/XML_HTMLSax/">XML_HTMLSax</a> package weren&#8217;t encouraging.  However, my opinion of PEAR has turned around in recent years thanks to work such as channels in the pear installer and MDB2.</p>
<p>I hope this doesn&#8217;t end up a fork.  I see little sense in that.  I&#8217;ll be interested in seeing the PEAR response.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2006/07/05/un-pear-ing/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Code Coverage, Feedback and Open Source</title>
		<link>http://www.procata.com/blog/archives/2005/10/04/code-coverage-and-feedback/</link>
		<comments>http://www.procata.com/blog/archives/2005/10/04/code-coverage-and-feedback/#comments</comments>
		<pubDate>Tue, 04 Oct 2005 15:46:28 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Agile Methods]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software Design]]></category>
		<category><![CDATA[agile-php]]></category>
		<category><![CDATA[code-coverage]]></category>
		<category><![CDATA[extreme-programming]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[project-management]]></category>
		<category><![CDATA[test-driven-development]]></category>
		<category><![CDATA[unit-testing]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2005/08/04/code-coverage-and-feedback/</guid>
		<description><![CDATA[I&#8217;ve long wondered about the quality and extent of the PHP test suite.  During my posting hiatus, John Coggeshall addressed my question by posting a coverage report generated by running the test suite.  Unless I am mistaken, he also implies that the report will at some point become automated and available at http://cov.php.net/. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve long wondered about the quality and extent of the PHP test suite.  During my posting hiatus, <a href="http://blog.coggeshall.org/archives/204_Code_Coverage_Support_for_PHP_5.html">John Coggeshall addressed my question</a> by posting a <a href="http://www.coggeshall.org/cov/">coverage report</a> generated by running the test suite.  Unless I am mistaken, he also implies that the report will at some point become automated and available at <a href="http://cov.php.net/">http://cov.php.net/</a>.  I see the availability of this report as a big step forward for PHPs future stability and maturity.</p>
<p>Agile software development methods including <a href="http://en.wikipedia.org/wiki/Extreme_Programming">extreme programming</a> (XP) have been growing in popularity and maturity alongside an increase in the popularity of open source projects.  One of the fundamental principles of XP is early and often feedback.  The value of feedback is obvious to anyone who has used a strange shower.  The shorter the time between turning the knob and feeling the temperature change, the faster you can arrive at the perfect temperature.  Nobody likes flailing between too hot and too cold in a lazy shower.  In the same way, immediate feedback on a development project can avoid wasted effort and produce a better result faster.</p>
<p>In XP and other Agile programming methods, an automated test suite provides important early and often feedback.  It is far better to catch a bug in the test suite than for the customer to find it.  But, how do you know if your tests are testing all of the features of your program?</p>
<p>The XP practice of <a href="http://en.wikipedia.org/wiki/Test_driven_development">test driven development</a> (TDD) demands that you only add features for which you have a failing test case.  Therefore, you write the test first, and then write the code to satisfy it.  For a theoretical perspective, this should give your code 100% code coverage.  Every line of code should be covered by a test.  Unfortunately, developers are human and any technique that relies of the perfection of people is doomed to fail. Unfortunately, the converse of the TDD coverage assertion is simply not helpful:  If you don&#8217;t have 100% test coverage, you aren&#8217;t correctly doing TDD.  If you are not doing TDD, how do you gauge the quality of your test suite?</p>
<p>Open source projects present a special challenge for the concept of TDD.  No project wants to reject useful contributions, yet many contributors may not write tests for their contributions.  Even if tests are required, there is no way to tell if they were written first, as in TDD, or after the fact.  XP would have the code author writing the unit tests.  In an open source project, this might not be possible or likely, although still desirable.</p>
<p>While certainly not perfect, code coverage tools do provide an indicator of how well tested a section of code is.  Code coverage reports are a feedback loop to help test writers find weak areas and to better target tests to specific lines of code. Just picking a file at random from PHP reveals low-hanging testing fruit: <a href="http://www.coggeshall.org/cov/Zend/zend_operators.c.gcov.html">zend_operators.c</a>.</p>
<p>I feel that a coverage report can be an important tool in an open source project.  More so than in other kinds of projects.  Test writing based on a coverage report inherently lends itself to the distributed nature of open source development.  Many people have a stake in the stability, robustness and reputation of PHP.  Tests are <a href="http://qa.php.net/write-test.php">easy enough to write</a>, easier perhaps than many other ways to contribute.  Hopefully easily available coverage reporting would help coordinate testing activities and draw people in that might not otherwise participate.</p>
<p>Ideally, contributions would be accompanied by test code contributed by the same author.  I also don&#8217;t think it is out of line to look at untested contributions with increased skepticism.  Coverage reports can help identify contributions that might cause future problems.  One can hope the existence of coverage reports might inspire contributors to include better tests by exposing their code as untested.  My (unverified) theory and hope is that the feedback of coverage reports can help inspire a culture of testing on an open source project.</p>
<p>While there are areas (such as GUI apps) where unit testing is difficult at best (thread safety may be another), PHP overall is very testable.  The stability and reputation of PHP can only be improved by increasing the coverage of its unit tests.</p>
<p>I am looking forward to seeing the availability of an automated <a href="http://cov.php.net/">http://cov.php.net/</a>, if indeed that is planned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2005/10/04/code-coverage-and-feedback/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>php testing and coverage</title>
		<link>http://www.procata.com/blog/archives/2005/04/08/php-testing-and-coverage/</link>
		<comments>http://www.procata.com/blog/archives/2005/04/08/php-testing-and-coverage/#comments</comments>
		<pubDate>Fri, 08 Apr 2005 15:18:30 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
				<category><![CDATA[Agile Methods]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[code-coverage]]></category>
		<category><![CDATA[simple-test]]></category>
		<category><![CDATA[unit-testing]]></category>

		<guid isPermaLink="false">http://www.procata.com/blog/archives/2005/04/08/php-testing-and-coverage/</guid>
		<description><![CDATA[I ran across this O&#8217;Reily article about SpikeSource today.  Very interesting.
They have released a coverage reporting tool, Spike PHP Coverage, for PHP that works with XDebug coverage data.  It works with Simple Test and it seems to be able aggregate the results of remote test runs, such as for web based tests.  [...]]]></description>
			<content:encoded><![CDATA[<p>I ran across <a href="http://www.oreillynet.com/pub/a/network/2005/04/07/spikesource.html">this O&#8217;Reily article</a> about <a href="http://www.spikesource.com/">SpikeSource</a> today.  Very interesting.</p>
<p>They have released a coverage reporting tool, <a href="http://www.spikesource.com/projects/phpcoverage/">Spike PHP Coverage</a>, for PHP that works with XDebug coverage data.  It works with Simple Test and it seems to be able aggregate the results of remote test runs, such as for web based tests.  I have wanted something exactly like this.  I can&#8217;t wait to get the chance to generate a consolidated coverage report for WACT.</p>
<p>It seems that they have the capability for generating and aggregating code <a href="http://www.spikesource.com/testresults.log/fedora-1-i386/1440/oss/comp/web/php5/test/coverage/coveragereport.txt">coverage reports</a> for <a href="http://www.spikesource.com/testresults/index.jsp?show=component-results&#038;category=all&#038;comp-id=65726#pkgtest">PHP</a> itself.  I haven&#8217;t had a chance to check this out, but its something that I have always wondered about.</p>
<p>Additionally, it looks like they accept <a href="http://www.spikesource.com/testupload/help_upload.php">contributions of Test Suites</a>.  If I understand this correctly, it means that I can upload the WACT test suite and that it can be used to test and generate coverage reports for PHP 4 and for PHP 5 as well as the framework.  If this is true, this is a big deal.  As there are more and more applications with automated test suites, it only makes sense to aggregate them to test PHP itself.</p>
<p>It also seems that they have embraced <a href="http://www.lastcraft.com/simple_test.php">Simple Test</a> for php testing.  Congratulations, <a href="http://www.lastcraft.com/blog/">Marcus</a>.  Simple Test is a fine piece of software.</p>
<p>I think code coverage measurements are important for gauging the quality of a test suite on open source projects, where there can be less formal development practices and a large number of contributers of varying skill levels and motivation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2005/04/08/php-testing-and-coverage/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
