<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Blog of Max Horvath</title>
    <link rel="alternate" type="text/html" href="http://www.maxhorvath.com/" />
    <link rel="self" type="application/atom+xml" href="http://www.maxhorvath.com/atom.xml" />
    <id>tag:www.maxhorvath.com,2008-03-19://1</id>
    <updated>2008-10-31T18:44:01Z</updated>
    <subtitle>For more quality in software products ...</subtitle>
    <generator uri="http://www.sixapart.com/movabletype/">Movable Type Open Source 4.1</generator>

<entry>
    <title>Slide for IPC session on Making Selenium Test Writing easier using a DSL online</title>
    <link rel="alternate" type="text/html" href="http://www.maxhorvath.com/2008/10/slide-for-ipc-session-on-making-selenium-test-writing-easier-using-a-dsl-online.html" />
    <id>tag:www.maxhorvath.com,2008://1.25</id>

    <published>2008-10-31T18:42:20Z</published>
    <updated>2008-10-31T18:44:01Z</updated>

    <summary>At IPC 2008 I presented a 60 minutes Session on Making Selenium Test Writing easier using a DSL. Here is the slide of this session.</summary>
    <author>
        <name>Max Horvath</name>
        <uri>http://www.maxhorvath.com</uri>
    </author>
    
        <category term="Conferences" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PHP" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PHPUnit" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Testing" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="conferences" label="Conferences" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="internationalphpconference" label="International PHP Conference" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ipc" label="IPC" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="slides" label="Slides" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.maxhorvath.com/">
        <![CDATA[<p>
At <a href="http://it-republik.de/php/phpconference/" onClick="javascript: pageTracker._trackPageview ('/outgoing/it-republik.de');">IPC 2008</a> I presented a 60 minutes Session on <em>Making Selenium Test Writing easier using a DSL</em>.
</p>

<p>
Here the short description:
</p>

<p>
<code>
Implementing automated tests by using Seleniums API methods has several drawbacks. Selenium is great for what it does, providing a generic framework for testing a generic application. Using the Testing_SeleniumDSL framework, I will show you how to create your own <a href="http://en.wikipedia.org/wiki/Domain-specific_programming_language" onClick="javascript: pageTracker._trackPageview ('/outgoing/wikipedia.org');">Domain Specific Language</a> (DSL), which would allow you to write tests in the language of your business rather than in Seleniums language.
</code>
</p>

<p>
Here is the slide of this session:
</p>

<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.maxhorvath.com/documents/ipc2008_slide_making_selenium_1/ipc2008_slide_making_selenium_test_writing_easier_using_a_dsl.pdf" onClick="javascript: pageTracker._trackPageview('/downloads/ipc2008_slide_making_selenium_test_writing_easier_using_a_dsl');"><img alt="ipc2008_slide_making_selenium_test_writing_easier_using_a_dsl.png" src="http://www.maxhorvath.com/images/ipc2008_slide_making_selenium/ipc2008_slide_making_selenium_test_writing_easier_using_a_dsl-thumb-400x282.png" width="400" height="282" class="mt-image-center" style="text-align: center; display: block; margin: 0 auto 20px;" /></a></span>]]>
        
    </content>
</entry>

<entry>
    <title>Making phpUnderControl (CruiseControl) accessible via a Proxy</title>
    <link rel="alternate" type="text/html" href="http://www.maxhorvath.com/2008/08/making-phpundercontrol-cruisecontrol-accessible-via-a-proxy.html" />
    <id>tag:www.maxhorvath.com,2008://1.10</id>

    <published>2008-08-15T10:51:30Z</published>
    <updated>2008-10-31T17:58:30Z</updated>

    <summary>phpUnderControl is a customization of CruiseControl. For those wanting to run CruiseControl behind an Apache webserver without configuring mod_jk or the like, this short how-to is just right.</summary>
    <author>
        <name>Max Horvath</name>
        <uri>http://www.maxhorvath.com</uri>
    </author>
    
        <category term="Apache" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PHPUnit" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="apache" label="Apache" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="cruisecontrol" label="CruiseControl" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="phpundercontrol" label="phpUnderControl" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.maxhorvath.com/">
        <![CDATA[<p>
<a href="http://www.phpundercontrol.org/" onClick="javascript: pageTracker._trackPageview ('/outgoing/phpundercontrol.org');">phpUnderControl</a> is a customization of <a href="http://cruisecontrol.sourceforge.net/" onClick="javascript: pageTracker._trackPageview ('/outgoing/cruisecontrol.sourceforge.net');">CruiseControl</a>.
</p>

<p>
For those wanting to run CruiseControl behind an <a href="http://httpd.apache.org/" onClick="javascript: pageTracker._trackPageview ('/outgoing/apache.org');">Apache</a> webserver without configuring <code>mod_jk</code> or the like, this short how-to is just right.
</p>

<h3><strong><big>Installing phpUnderControl / CruiseControl</big></strong></h3>

<p>
This article is not about installing phpUnderControl or CruiseControl. For refernces see <a href="http://www.phpundercontrol.org/documentation.html#id25" onClick="javascript: pageTracker._trackPageview ('/outgoing/phpundercontrol.org');">http://www.phpundercontrol.org/</a> or <a href="http://cruisecontrol.sourceforge.net/gettingstartedbindist.html#Quick_Start" onClick="javascript: pageTracker._trackPageview ('/outgoing/cruisecontrol.sourceforge.net');">http://cruisecontrol.sourceforge.net/</a>.
</p>

<h3><strong><big>Configuring Apache as a proxy</big></strong></h3>

<p>
So we are considering you have your phpUnderControl / CruiseControl instance up and running at http://localhost:8080/. We are also considering you have an instance of the Apache webserver up and running.
</p>

<p>
First we'll need to enable the <code>proxy</code> module of Apache. Consult the apache manual on how to enable the module in your instance of the Apache webserver. Now edit your Apache vHost or httpd.conf configuration.
</p>

<textarea name="code" class="css:nogutter:nocontrols" cols="60" rows="10">
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so

ProxyRequests Off

<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>

ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</textarea>

<p>
You need to make sure that <code>mod_proxy.so</code> and <code>mod_proxy_http.so</code> do point  to the right location on your harddisk.
</p>

<h3><strong><big>Fixing URLs</big></strong></h3>

<p>
Proxying already works with this configuration, but unfortunately clicking any link in your installation of phpUnderControl / CruiseControl would point to the direct installation of the instance. This is where mod_jk would come into play. But as we're just wanting a quick and easy resolution for runnning phpUnderControl / CruiseControl behind the Apache webserver, we'll be solving this issue quite easily:  
</p>

<p>
Make sure to enable the <code>ext_filter</code> module. Now edit your Apache vHost or httpd.conf configuration again:
</p>

<textarea name="code" class="css:nogutter:nocontrols" cols="60" rows="10">
LoadModule ext_filter_module /usr/lib/apache2/modules/mod_ext_filter.so

ExtFilterDefine fixurls mode=output intype=text/html
cmd="/bin/sed s/localhost:8080/phpuc/g"

SetOutputFilter fixurls
</textarea>

<h3><strong><big>Conclusion</big></strong></h3>

<p>
Just restart your Apache webserver and your instance of phpUnderControl / CruiseControl should be running perfectly well behind your Apache webserver.
</p>]]>
        
    </content>
</entry>

<entry>
    <title>I will be speaking at IPC 2008</title>
    <link rel="alternate" type="text/html" href="http://www.maxhorvath.com/2008/08/i-will-be-speaking-at-ipc-2008.html" />
    <id>tag:www.maxhorvath.com,2008://1.12</id>

    <published>2008-08-11T15:35:30Z</published>
    <updated>2008-10-31T18:02:09Z</updated>

    <summary>Aside from being a member of the advisory board of this years International PHP Conference, I will present one Full Day Workshop and one session at this year&apos;s edition of the International PHP Conference.</summary>
    <author>
        <name>Max Horvath</name>
        <uri>http://www.maxhorvath.com</uri>
    </author>
    
        <category term="Conferences" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PHP" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PHPUnit" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Testing" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="conferences" label="Conferences" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="internationalphpconference" label="International PHP Conference" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="ipc" label="IPC" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.maxhorvath.com/">
        <![CDATA[<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><img alt="ipc_2008.png" src="http://www.maxhorvath.com/images/i_will_be_speaking_at_ipc_2008/ipc_2008-thumb-400x91.png" width="400" height="91" class="mt-image-center" style="text-align: center; display: block; margin: 0 auto 20px;" /></span>

<p>
Aside from being a member of the advisory board of this years <a href="http://it-republik.de/php/phpconference/" onClick="javascript: pageTracker._trackPageview ('/outgoing/it-republik.de');">International PHP Conference</a>, I will present one Full Day Workshop and one session at this year's edition of the International PHP Conference:
</p>

<h3><strong><big>Quality Assurance in PHP Projects - In-Depth Best-Practises</big></strong></h3>

<p>
<em>Full Day Workshop</em>
</p>

<p>
So you know <a href="http://www.phpunit.de/" onClick="javascript: pageTracker._trackPageview ('/outgoing/phpunit.de');">PHPUnit</a>, <a href="http://www.openqa.org/" onClick="javascript: pageTracker._trackPageview ('/outgoing/openqa.org');">Selenium</a>, <a href="http://www.phpundercontrol.org/" onClick="javascript: pageTracker._trackPageview ('/outgoing/phpundercontrol.org');">phpUnderControl</a> or <a href="http://cruisecontrol.sourceforge.net/" onClick="javascript: pageTracker._trackPageview ('/outgoing/cruisecontrol.sourceforge.net');">CruiseControl</a> and other tools to support testing efforts during your development process. But how does the puzzle of all those tools actually fit in your development process? During this Power Workshop Max Horvath and Wojciech Duda of <a href="http://www.studivz.net/" onClick="javascript: pageTracker._trackPageview ('/outgoing/studivz.net');">studiVZ Ltd.</a> will tell you about the everyday life at the Quality Assurance Business Unit. You will learn about best practices, which actually work and fit into an extremely fast moving iteration cycle at one of the biggest and fastest growing Social Networks in Europe. Talking about PHPUnit and Selenium, including tips on how to optimize using those tools, we will also show show you how you should integrate the testing process into your main development process, to be as lightweight and efficient as possible.
</p>

<p>
I will present this session together with my colleague <a href="https://www.xing.com/profile/Wojciech_Duda2" onClick="javascript: pageTracker._trackPageview ('/outgoing/xing.com');">Wojciech Duda</a>.
</p>

<h3><strong><big>Making Selenium Test Writing easier using a DSL</big></strong></h3>

<p>
<em>60 minutes Session</em>
</p>

<p>
Implementing automated tests by using Seleniums API methods has several drawbacks. Selenium is great for what it does, providing a generic framework for testing a generic application. Using the Testing_SeleniumDSL framework, I will show you how to create your own <a href="http://en.wikipedia.org/wiki/Domain-specific_programming_language" onClick="javascript: pageTracker._trackPageview ('/outgoing/wikipedia.org');">Domain Specific Language</a> (DSL), which would allow you to write tests in the language of your business rather than in Seleniums language.
</p>

<p>
I hope to see you in Mainz, Germany in late October!
</p>]]>
        
    </content>
</entry>

<entry>
    <title>PHPUnit&apos;s terminal output IS more fancy!</title>
    <link rel="alternate" type="text/html" href="http://www.maxhorvath.com/2008/03/phpunits-terminal-output-is-more-fancy.html" />
    <id>tag:www.maxhorvath.com,2216://1.9</id>

    <published>2008-03-18T10:58:07Z</published>
    <updated>2008-10-31T18:09:34Z</updated>

    <summary>Yes! Sebastian Bergmann did it: just one day after requesting a colorful output of PHPUnit&apos;s command line interface, he committed a patch to PHPUnit&apos;s trunk, which should be released with the next release.</summary>
    <author>
        <name>Max Horvath</name>
        <uri>http://www.maxhorvath.com</uri>
    </author>
    
        <category term="PHPUnit" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="phpunit" label="PHPUnit" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="sebastianbergmann" label="Sebastian Bergmann" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.maxhorvath.com/">
        <![CDATA[<p>
Yes! Sebastian Bergmann did it: just one day after <a href="http://www.maxhorvath.com/2008/03/phpunits-terminal-output-could-be-more-fancy.html" onClick="javascript: pageTracker._trackPageview ('/outgoing/maxhorvath.com');">requesting</a> a colorful output of PHPUnit's command line interface, he <a href="http://www.phpunit.de/changeset/2612" onClick="javascript: pageTracker._trackPageview ('/outgoing/phpunit.de');">committed a patch</a> to PHPUnit's trunk, which should be released with the next release.

Thank you!
</p>

<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.maxhorvath.com/images/phpunits_terminal_output_is_mo/feature-request-completed.html" onclick="window.open('http://www.maxhorvath.com/images/phpunits_terminal_output_is_mo/feature-request-completed.html','popup','width=681,height=188,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.maxhorvath.com/images/phpunits_terminal_output_is_mo/feature-request-completed-thumb-400x110.jpg" width="400" height="110" alt="feature-request-completed.jpg" class="mt-image-center" style="text-align: center; display: block; margin: 0 auto 20px;" /></a></span>

<h3><strong><big>Update</big></strong></h3>

<p>
Sebastian seems to like "the feature", too - he just <a href="http://sebastian-bergmann.de/archives/761-ANSI-Colors-in-PHPUnit-Output.html" onClick="javascript: pageTracker._trackPageview ('/outgoing/sebastian-bergmann.de');">blogged about it</a>. Horray!
</p>

<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.maxhorvath.com/images/phpunits_terminal_output_is_mo/phpunit-output-success.html" onclick="window.open('http://www.maxhorvath.com/images/phpunits_terminal_output_is_mo/phpunit-output-success.html','popup','width=722,height=200,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.maxhorvath.com/images/phpunits_terminal_output_is_mo/phpunit-output-success-thumb-400x110.jpg" width="400" height="110" alt="phpunit-output-success.jpg" class="mt-image-center" style="text-align: center; display: block; margin: 0 auto 20px;" /></a></span>

<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><a href="http://www.maxhorvath.com/images/phpunits_terminal_output_is_mo/phpunit-output-failure.html" onclick="window.open('http://www.maxhorvath.com/images/phpunits_terminal_output_is_mo/phpunit-output-failure.html','popup','width=722,height=416,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0'); return false"><img src="http://www.maxhorvath.com/images/phpunits_terminal_output_is_mo/phpunit-output-failure-thumb-400x230.jpg" width="400" height="230" alt="phpunit-output-failure.jpg" class="mt-image-center" style="text-align: center; display: block; margin: 0 auto 20px;" /></a></span>]]>
        
    </content>
</entry>

<entry>
    <title>PHPUnit&apos;s terminal output could be more fancy!</title>
    <link rel="alternate" type="text/html" href="http://www.maxhorvath.com/2008/03/phpunits-terminal-output-could-be-more-fancy.html" />
    <id>tag:www.maxhorvath.com,2008://1.6</id>

    <published>2008-03-16T14:50:00Z</published>
    <updated>2008-10-31T18:10:40Z</updated>

    <summary>A few days ago I came across Josh Carters blog. I saw a very nice suggestion have your unit tests output the results in green or red bar - depending if the tests passed or failed.</summary>
    <author>
        <name>Max Horvath</name>
        <uri>http://www.maxhorvath.com</uri>
    </author>
    
        <category term="PHPUnit" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="phpunit" label="PHPUnit" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.maxhorvath.com/">
        <![CDATA[<p>
A few days ago I came across <a href="http://multipart-mixed.com/" onClick="javascript: pageTracker._trackPageview ('/outgoing/multipart-mixed.com');">Josh Carters blog</a>. I saw <a href="http://multipart-mixed.com/software/terminal_unit_test_bar.html" onClick="javascript: pageTracker._trackPageview ('/outgoing/multipart-mixed.com');">a very nice suggestion</a> have your unit tests output the results in green or red bar - depending if the tests passed or failed.
</p>

<span class="mt-enclosure mt-enclosure-image" style="display: inline;"><img alt="unit_test_green_red_bar.jpg" src="http://www.maxhorvath.com/images/phpunitsterminaloutputcouldbem/unit_test_green_red_bar.jpg" width="453" height="150" class="mt-image-center" style="text-align: center; display: block; margin: 0 auto 20px;" /></span>

<p>
I really like the idea and will be <a href="http://www.phpunit.de/ticket/428" onClick="javascript: pageTracker._trackPageview ('/outgoing/phpunit.de');">requesting</a> the inclusion of ansi coloring to Sebastian Bergmann - I'd really like to see this feature being added to PHPUnit.
</p>]]>
        
    </content>
</entry>

<entry>
    <title>Accessing private properties in Unit Tests</title>
    <link rel="alternate" type="text/html" href="http://www.maxhorvath.com/2008/03/accessing-private-properties-in-unit-tests.html" />
    <id>tag:www.maxhorvath.com,2008://1.5</id>

    <published>2008-03-06T16:24:18Z</published>
    <updated>2008-10-31T18:18:01Z</updated>

    <summary>While it&apos;s absolutly correct that direct access to private properties is strictly forbidden in PHP, it&apos;s quite disturbing that even reflection cannot do it when you&apos;re writing Unit Tests. Sometimes you just want to test whether a private property contains the correct data. With the normal visibility rules you cannot access those from your Unit Tests.

I&apos;ll show you how to access private properties in both PHP 5.2.5 and PHP 5.3.</summary>
    <author>
        <name>Max Horvath</name>
        <uri>http://www.maxhorvath.com</uri>
    </author>
    
        <category term="PHP" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="PHPUnit" scheme="http://www.sixapart.com/ns/types#category" />
    
        <category term="Testing" scheme="http://www.sixapart.com/ns/types#category" />
    
    <category term="php" label="PHP" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="phpunit" label="PHPUnit" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="privateproperties" label="Private Properties" scheme="http://www.sixapart.com/ns/types#tag" />
    <category term="relectionapi" label="Relection API" scheme="http://www.sixapart.com/ns/types#tag" />
    
    <content type="html" xml:lang="en" xml:base="http://www.maxhorvath.com/">
        <![CDATA[<p>
While it's absolutly correct that direct access to private properties is strictly forbidden in PHP, it's quite disturbing that even reflection cannot do it when you're writing Unit Tests. Sometimes you just want to test whether a private property contains the correct data. With the normal visibility rules you cannot access those from your Unit Tests.
</p>

<p>
Luckily, as I just read at <a href="http://schlitt.info/applications/blog/index.php?/archives/581-Reflecting-private-properties.html" onClick="javascript: pageTracker._trackPageview ('/outgoing/schlitt.info');">Tobias Schlitt's Blog</a>, <a href="http://derickrethans.nl/" onClick="javascript: pageTracker._trackPageview ('/outgoing/derickrethans.nl');">Derick Rethans</a> committed a patch to the PHP 5.3 repository, which allows you to get things done quite easily. You still need to explicitly state that you want to access the value of a protected/private property through reflection by the new method setAccessible(). It's a good thing to avoid people doing stupid things accidentally, but you finally get the access to it.
</p>

<p>
PHP 5.3 you'll be able to access private properties like this:
</p>

<textarea name="code" class="php:nogutter:nocontrols" cols="60" rows="10">
<?php

class Foo
{
    private $bar;
}

$obj = new Foo();
$refObj = new ReflectionObject($obj);
$refProp = $refObj->getProperty('bar');

$refProp->setAccessible(true);

echo $refProp->getValue($obj);

?>
</textarea>

<p>
But until we'll see a stable PHP 5.3, there we're many working "hacks", which worked for <em>some</em> versions of PHP 5.x - <strong>the most current one</strong> would be this:
</p>

<textarea name="code" class="php:nogutter:nocontrols" cols="60" rows="10">
function expose($obj, $prop)
{
    $reflection = new ReflectionClass($obj);
    $prop = $reflection->getProperty($prop);

    return $prop->getValue($obj);
}
</textarea>

<p>
This should get you up and running for <em>PHP 5.2.5</em> ("older hacks" won't work).
</p>

<p>
So how could you use it?
</p>

<textarea name="code" class="php:nogutter:nocontrols" cols="60" rows="10">
<?php

class Foo
{
    private $bar;
}

$obj = new Foo();

echo expose($obj, 'bar');

?>
</textarea>

<p>
I hope those lines of code will help you until PHP 5.3 arrives, as it helps our developers.
</p>

<h3><strong><big>Update</big></strong></h3>

<p>
As Sebastian points out in his comment to this post, PHPUnit has had support for testing private and protected attributes for quite a while. It can be used via:
</p>

<textarea name="code" class="php:nogutter:nocontrols" cols="60" rows="10">
readAttribute($classOrObject, $attributeName);
</textarea>

<p>
I should be reading the documentation much more thoroughly next time (even though I must admit, that none of our developers has known this method, too).
</p>]]>
        
    </content>
</entry>

</feed> 