<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Solar: Modified Testing Strategy</title>
	<atom:link href="http://paul-m-jones.com/archives/193/feed" rel="self" type="application/rss+xml" />
	<link>http://paul-m-jones.com/archives/193?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=solar-modified-testing-strategy</link>
	<description>It&#039;s not enough to be smart; you have to actually know things.</description>
	<lastBuildDate>Wed, 08 Feb 2012 21:50:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>By: Paul M. Jones &#187; Blog Archive &#187; Solar 0.18.0 released, and more about testing</title>
		<link>http://paul-m-jones.com/archives/193/comment-page-1#comment-25296</link>
		<dc:creator>Paul M. Jones &#187; Blog Archive &#187; Solar 0.18.0 released, and more about testing</dc:creator>
		<pubDate>Mon, 08 May 2006 22:09:18 +0000</pubDate>
		<guid isPermaLink="false">http://paul-m-jones.com/blog/?p=193#comment-25296</guid>
		<description>[...] A couple of weeks ago I had an IM-chat with Matthew about testing, and he related the merits of a PHPUnit-style approach, versus the PHPT approach I have blogged about previously. [...]</description>
		<content:encoded><![CDATA[<p>[...] A couple of weeks ago I had an IM-chat with Matthew about testing, and he related the merits of a PHPUnit-style approach, versus the PHPT approach I have blogged about previously. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pmjones</title>
		<link>http://paul-m-jones.com/archives/193/comment-page-1#comment-21757</link>
		<dc:creator>pmjones</dc:creator>
		<pubDate>Thu, 02 Feb 2006 01:19:55 +0000</pubDate>
		<guid isPermaLink="false">http://paul-m-jones.com/blog/?p=193#comment-21757</guid>
		<description>Hi again Greg --

You said:  &quot;What Paul neglects to mention is that the output of a .phpt with the â€œno output unless there is an errorâ€ should in fact be a dump of expected and actual output, just as PHPUnit and company do in the test reports.&quot;

Ah yes, I was not explicit enough about this.  The Solar_Test_Assert methods use the expected value and the actual value as the fail() exception message (courtesy of var_export() to make them printable).  So the unexpected output that causes the .phpt to fail does contain both values for logging purposes.  Thanks for pointing it out.</description>
		<content:encoded><![CDATA[<p>Hi again Greg &#8211;</p>
<p>You said:  &#8220;What Paul neglects to mention is that the output of a .phpt with the â€œno output unless there is an errorâ€ should in fact be a dump of expected and actual output, just as PHPUnit and company do in the test reports.&#8221;</p>
<p>Ah yes, I was not explicit enough about this.  The Solar_Test_Assert methods use the expected value and the actual value as the fail() exception message (courtesy of var_export() to make them printable).  So the unexpected output that causes the .phpt to fail does contain both values for logging purposes.  Thanks for pointing it out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pmjones</title>
		<link>http://paul-m-jones.com/archives/193/comment-page-1#comment-21756</link>
		<dc:creator>pmjones</dc:creator>
		<pubDate>Thu, 02 Feb 2006 01:11:47 +0000</pubDate>
		<guid isPermaLink="false">http://paul-m-jones.com/blog/?p=193#comment-21756</guid>
		<description>Greg said:

&quot;Tomas V.V. Cox did the initial port of php-src/run-tests.php into PEAR a long time ago, I have simply tweaked it (and only in minor ways) since its introduction. Credits where credits are due.&quot;

Absolutely I want to give credit where it&#039;s due; I&#039;ve updated the first paragraph to reflect Tomas&#039; authorship.  Thanks for the correction.</description>
		<content:encoded><![CDATA[<p>Greg said:</p>
<p>&#8220;Tomas V.V. Cox did the initial port of php-src/run-tests.php into PEAR a long time ago, I have simply tweaked it (and only in minor ways) since its introduction. Credits where credits are due.&#8221;</p>
<p>Absolutely I want to give credit where it&#8217;s due; I&#8217;ve updated the first paragraph to reflect Tomas&#8217; authorship.  Thanks for the correction.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Lively</title>
		<link>http://paul-m-jones.com/archives/193/comment-page-1#comment-21753</link>
		<dc:creator>Mike Lively</dc:creator>
		<pubDate>Wed, 01 Feb 2006 16:10:30 +0000</pubDate>
		<guid isPermaLink="false">http://paul-m-jones.com/blog/?p=193#comment-21753</guid>
		<description>heh, you don&#039;t have to tell me twice about the enormous number of test files you end up writing in phpt. The actual php test suite is up to 2000+ I believe :D. Running those tests with memleak checking takes me roughly an hour and a half.

Also notice I didn&#039;t mention test-more when it came to libraries &#039;without&#039; extreme simplicity ;). Then again I guess I didn&#039;t mention it at all.... :(</description>
		<content:encoded><![CDATA[<p>heh, you don&#8217;t have to tell me twice about the enormous number of test files you end up writing in phpt. The actual php test suite is up to 2000+ I believe :D. Running those tests with memleak checking takes me roughly an hour and a half.</p>
<p>Also notice I didn&#8217;t mention test-more when it came to libraries &#8216;without&#8217; extreme simplicity ;). Then again I guess I didn&#8217;t mention it at all&#8230;. :(</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Shiflett</title>
		<link>http://paul-m-jones.com/archives/193/comment-page-1#comment-21752</link>
		<dc:creator>Chris Shiflett</dc:creator>
		<pubDate>Wed, 01 Feb 2006 14:39:48 +0000</pubDate>
		<guid isPermaLink="false">http://paul-m-jones.com/blog/?p=193#comment-21752</guid>
		<description>Mike, you could always use the test-more.php library by itself:

http://shiflett.org/archive/187

This gives you TAP plus extreme simplicity (even simpler than phpt). I&#039;ve used all four major testing libraries for PHP pretty extensively, and although I like a lot about phpt, it&#039;s a very difficult approach to scale. In fact, using a separate file for each test is about the only way to provide precise feedback (which test failed?), and having a test suite that consists of several hundred tests is difficult to maintain across files like that.

TAP is actually pretty descriptive by itself, so even without a testing framework like Apache-Test, you can still just test from the command line and get a decent report.</description>
		<content:encoded><![CDATA[<p>Mike, you could always use the test-more.php library by itself:</p>
<p><a href="http://shiflett.org/archive/187" rel="nofollow">http://shiflett.org/archive/187</a></p>
<p>This gives you TAP plus extreme simplicity (even simpler than phpt). I&#8217;ve used all four major testing libraries for PHP pretty extensively, and although I like a lot about phpt, it&#8217;s a very difficult approach to scale. In fact, using a separate file for each test is about the only way to provide precise feedback (which test failed?), and having a test suite that consists of several hundred tests is difficult to maintain across files like that.</p>
<p>TAP is actually pretty descriptive by itself, so even without a testing framework like Apache-Test, you can still just test from the command line and get a decent report.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Lively</title>
		<link>http://paul-m-jones.com/archives/193/comment-page-1#comment-21742</link>
		<dc:creator>Mike Lively</dc:creator>
		<pubDate>Wed, 01 Feb 2006 06:09:00 +0000</pubDate>
		<guid isPermaLink="false">http://paul-m-jones.com/blog/?p=193#comment-21742</guid>
		<description>All the work trying to get TAP into general acceptance and you go and start using phpt :D. You are right though, one advantage it does have over PHPUnit and SimpleTest is it&#039;s extreme simplicity. Then again one disadvantage it has is it&#039;s extreme simplicity. I actually just recently used it myself to test a patch I am working on for PHP and you are right the innate run-tests support is pretty handy to have and is more simplistic and probably quicker to set up than the test harnesses for SimpleTest and PHPUnit.

Travis you can use variable output. Check out http://qa.php.net/write-test.php for a good description of phpt.</description>
		<content:encoded><![CDATA[<p>All the work trying to get TAP into general acceptance and you go and start using phpt :D. You are right though, one advantage it does have over PHPUnit and SimpleTest is it&#8217;s extreme simplicity. Then again one disadvantage it has is it&#8217;s extreme simplicity. I actually just recently used it myself to test a patch I am working on for PHP and you are right the innate run-tests support is pretty handy to have and is more simplistic and probably quicker to set up than the test harnesses for SimpleTest and PHPUnit.</p>
<p>Travis you can use variable output. Check out <a href="http://qa.php.net/write-test.php" rel="nofollow">http://qa.php.net/write-test.php</a> for a good description of phpt.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Beaver</title>
		<link>http://paul-m-jones.com/archives/193/comment-page-1#comment-21741</link>
		<dc:creator>Greg Beaver</dc:creator>
		<pubDate>Wed, 01 Feb 2006 06:05:10 +0000</pubDate>
		<guid isPermaLink="false">http://paul-m-jones.com/blog/?p=193#comment-21741</guid>
		<description>Travis:

The point of &quot;no output unless there is an error&quot; means that you can do things such as compare error codes by the PHP version being run (for instance required for any XML saxon parsing error, as they are different in 4.x, 5.0.x, and 5.1.x).  In addition, instead of putting absolutely everything into a single file (i.e. using methods inside a PHPUnit/SImpleTest), you can put each test into its own file, and use good old:

require_once dirname(__FILE__) . &#039;/setup.php.inc&#039;;

to implement our familiar setup()

and a --CLEAN-- section with

require_once dirname(__FILE__) . &#039;/teardown.php.inc&#039;;

if necessary (--CLEAN-- will be implemented in PEAR 1.4.7, btw).

in terms of randomized testing, if you can choose random files (and you can, although it would have to be external to the &quot;pear&quot; command), you can do random testing.

I&#039;ve found the separation of each test condition into its own .phpt to be invaluable for another reason: a fatal error only kills 1 test rather than the whole suite... :)

What Paul neglects to mention is that the output of a .phpt with the &quot;no output unless there is an error&quot; should in fact be a dump of expected and actual output, just as PHPUnit and company do in the test reports.  This is all readily available in the .out file (testname.out if you have testname.phpt) after running the test.  In addition, these files can be bundled together and posted online or mailed to the developer, simplifying remote testing by non-techie users.

The only thing lacking is pretty-printed reports, so if you find that kind of thing essential, this isn&#039;t for you.  It does, however, spit out a log file containing a count of all tests run, and the paths to failed tests called &quot;run-tests.log&quot;.

Oh, and one last VERY important thing.  Tomas V.V. Cox did the initial port of php-src/run-tests.php into PEAR a long time ago, I have simply tweaked it (and only in minor ways) since its introduction.  Credits where credits are due.</description>
		<content:encoded><![CDATA[<p>Travis:</p>
<p>The point of &#8220;no output unless there is an error&#8221; means that you can do things such as compare error codes by the PHP version being run (for instance required for any XML saxon parsing error, as they are different in 4.x, 5.0.x, and 5.1.x).  In addition, instead of putting absolutely everything into a single file (i.e. using methods inside a PHPUnit/SImpleTest), you can put each test into its own file, and use good old:</p>
<p>require_once dirname(__FILE__) . &#8216;/setup.php.inc&#8217;;</p>
<p>to implement our familiar setup()</p>
<p>and a &#8211;CLEAN&#8211; section with</p>
<p>require_once dirname(__FILE__) . &#8216;/teardown.php.inc&#8217;;</p>
<p>if necessary (&#8211;CLEAN&#8211; will be implemented in PEAR 1.4.7, btw).</p>
<p>in terms of randomized testing, if you can choose random files (and you can, although it would have to be external to the &#8220;pear&#8221; command), you can do random testing.</p>
<p>I&#8217;ve found the separation of each test condition into its own .phpt to be invaluable for another reason: a fatal error only kills 1 test rather than the whole suite&#8230; :)</p>
<p>What Paul neglects to mention is that the output of a .phpt with the &#8220;no output unless there is an error&#8221; should in fact be a dump of expected and actual output, just as PHPUnit and company do in the test reports.  This is all readily available in the .out file (testname.out if you have testname.phpt) after running the test.  In addition, these files can be bundled together and posted online or mailed to the developer, simplifying remote testing by non-techie users.</p>
<p>The only thing lacking is pretty-printed reports, so if you find that kind of thing essential, this isn&#8217;t for you.  It does, however, spit out a log file containing a count of all tests run, and the paths to failed tests called &#8220;run-tests.log&#8221;.</p>
<p>Oh, and one last VERY important thing.  Tomas V.V. Cox did the initial port of php-src/run-tests.php into PEAR a long time ago, I have simply tweaked it (and only in minor ways) since its introduction.  Credits where credits are due.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Travis Swicegood</title>
		<link>http://paul-m-jones.com/archives/193/comment-page-1#comment-21740</link>
		<dc:creator>Travis Swicegood</dc:creator>
		<pubDate>Wed, 01 Feb 2006 05:26:25 +0000</pubDate>
		<guid isPermaLink="false">http://paul-m-jones.com/blog/?p=193#comment-21740</guid>
		<description>Some testing is better than no testing... :-)  And to top it off, you&#039;re following the KISS principle which should be a foundation of any good testing strategy.

Actually, in some cases introducing a more robust testing framework can be a hindrence as you have to be familiar with at least the xUnit methodology in order to understand what&#039;s happening.  The one limitation that I see (and I might be wrong here) with the current testing is the lack of an ability to do any randomized testing if you&#039;re checking output.  Can you expect variable output from a phpt file?

That is definitely an interesting idea, though.</description>
		<content:encoded><![CDATA[<p>Some testing is better than no testing&#8230; :-)  And to top it off, you&#8217;re following the KISS principle which should be a foundation of any good testing strategy.</p>
<p>Actually, in some cases introducing a more robust testing framework can be a hindrence as you have to be familiar with at least the xUnit methodology in order to understand what&#8217;s happening.  The one limitation that I see (and I might be wrong here) with the current testing is the lack of an ability to do any randomized testing if you&#8217;re checking output.  Can you expect variable output from a phpt file?</p>
<p>That is definitely an interesting idea, though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason Sweat</title>
		<link>http://paul-m-jones.com/archives/193/comment-page-1#comment-21737</link>
		<dc:creator>Jason Sweat</dc:creator>
		<pubDate>Wed, 01 Feb 2006 03:44:38 +0000</pubDate>
		<guid isPermaLink="false">http://paul-m-jones.com/blog/?p=193#comment-21737</guid>
		<description>Something I have used in the past is:


/**
 * modify php include path to include parent directory
 *
 * this is required becuase the tests are run from the test subdirectory
 * and the application is run from (and coded for) the parrent directory
 * @ignore
 */
if (!defined(&#039;TEST_PATH_MODIFIED&#039;)) {
	ini_set(&#039;include_path&#039;, &#039;..:&#039;.ini_get(&#039;include_path&#039;));
	define(&#039;TEST_PATH_MODIFIED&#039;, true);
}
</description>
		<content:encoded><![CDATA[<p>Something I have used in the past is:</p>
<p>/**<br />
 * modify php include path to include parent directory<br />
 *<br />
 * this is required becuase the tests are run from the test subdirectory<br />
 * and the application is run from (and coded for) the parrent directory<br />
 * @ignore<br />
 */<br />
if (!defined(&#8216;TEST_PATH_MODIFIED&#8217;)) {<br />
	ini_set(&#8216;include_path&#8217;, &#8216;..:&#8217;.ini_get(&#8216;include_path&#8217;));<br />
	define(&#8216;TEST_PATH_MODIFIED&#8217;, true);<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

