Skip to content

Selenium Tests mit NetBeans und PHP

Selenium-Tests können elegant direkt in NetBeans für PHP erstellt und aus NetBeans heraus ausgeführt werden. Leider funktioniert das unter bestimmten Umständen nicht out-of-the-box, sondern macht einige Kniffe notwendig.

NetBeans-Plugin installieren

Ich gehe davon aus, dass ihr alles notwendige für die PHP-Entwicklung installiert habt. Das schließt PHPUnit ein, auf das die Selenium-Tests zurückgreifen. Wie man Selenium in PHPUnit integriert, wird hier ausführlich beschrieben.

Auf meinem Ubuntu-Rechner mit NetBeans 6.9.1 und Firefox 3.6.12 lässt sich das Selenium Module for PHP aus dem NetBeans Beta-Repository einfach installieren: Unter "Extras > Plugins > Einstellungen" das Häkchen bei "NetBeans Beta" setzen, dann steht das Selenium-Modul zur Auswahl und kann installiert werden. Anschließend lässt sich nach Rechtsklick auf das Projekt im Projektmanager der Punkt "Run Selenium Tests" aus dem Kontextmenü auswählen. Zunächst muss ein Verzeichnis ausgewählt werden, in dem die Testdateien abgelegt werden. Ich habe den Ordner selenium direkt neben nbprojects in meinem Projektverzeichnis angelegt und als Testverzeichnis ausgewählt.

Da wir noch keine Testdateien erstellt haben, wird auch noch nichts ausgeführt, aber das Verzeichnis wird als Selenium Test Files aufgeführt. Wiederum über das "Kontextmenü > Neu" kann jetzt ein "Selenium Test Case for PHP" erstellt werden. Dabei legt NetBeans freundlicherweise schon das Code-Gerüst für den neuen Test-Case an. Natürlich kann, wer möchte, auch manuell Test-Cases im Test-Verzeichnis anlegen oder den PHP-Code aus der Selenium IDE (= Firefox-Extension) herausgenerieren lassen. Die NetBeans-Vorlage sieht etwa wie folgt aus.

require_once 'PHPUnit/Extensions/SeleniumTestCase.php';

class newSeleneseTest extends PHPUnit_Extensions_SeleniumTestCase
{
    protected function setUp()
    {
        $this->setBrowser("*chrome");
        $this->setBrowserUrl("http://change-this-to-the-site-you-are-testing/");
    }

    public function testMyTestCase()
    {
        
    }
}

Unabhängig davon, welchen Test man in testMyTestCase() implementieren möchte, gilt es jetzt noch einige Stolpersteine aus dem Weg zu räumen.

"Selenium Tests mit NetBeans und PHP" vollständig lesen

Google releases OpenID demo store and mod_pagespeed

Google just released two interesting projects into the wild. One is an OpenID demo store with accompanying documentation, the other an open-source module for the Apache web server.

Google's OpenID demo store

Although OpenID has seemingly been adopted by all major players on the web (aside from Facebook, maybe), I wonder how often their users log in with their OpenID. Most smaller sites are afraid of the overhead of an OpenID implentation, or simply don't know how to do it. Now, Google set up a sample store that makes heavy use of OpenID. Equally important, it's supplemented by an extraordinary documentation. As Carsten correctly states, such a documentation was needed for quite some time. It will be interesting to see if any larger online shops jump on the bandwagon an implement OpenID for their businesses.

mod_pagespeed

According to Google, page loading times become increasingly important, not only for the customer experience, but also for the ranking in Google's search index. Performance hints and tools are abundant on the web, but Google goes even beyond those recommendations and released an extension for the popular Apache web server: mod_pagespeed. I installed it on my local box, but there are lots of options, and I haven't found the time yet to fiddle with them all. It seems that you can achieve most of the optimizations by optimizing your default Apache installation. However, mod_pagespeed might make configuration a lot easier. I guess, we'll have to wait and see.

Twitter-Plugin lernt OAuth

OAuth LogoNachdem Ende August die "OAuthcalypse" eintrat und Twitter externe Anwendungen seitdem nur noch per OAuth authentifiziert, musste auch das entsprechende Plugin für Serendipity angepasst werden. Am vergangenen Wochenende hat Garvin Hicking diese Funktionalität mit Hilfe der Community umgesetzt. Ich freue mich, dass ich dabei behilflich sein konnte. Momentan ist eine Testversion des Plugins hier zum Download verfügbar. Sollten keine Fehler mehr auftreten, dürfte die neue Version bald auch über den Serendipity-eigenen Installer SPARTACUS augeliefert werden.

Zu OAuth hatte ich ja im Rahmen der PHP Usergroup Rheinhessen im März einen kurzen Vortrag gehalten. Aufgrund der Umstellung bei Twitter ist OAuth mittlerweile wohl im Mainstream angekommen. Finde ich gut. Jetzt wird bereits über OAuth 2.0 diskutiert.

Session: OpenID mit Zend Framework

Mit Dennis Winter von den Rheinschafen diskutieren wir nun über OpenID und ZF. Gleich mal ein paar Probleme: OpenID 2.0 wird nur in Draft 11 unterstützt, noch nicht die Final; kein Attribute Exchange z.B. Manche entscheiden sich dafür lieber für die PHP4-Library von JanRain. Vorteile: Storage-Möglichkeiten für Daten in der DB zwischen einzelnen Requests, SREG-Unterstützung. Lebhafte Diskussion im Anschluss ;-) Aber eigentlich sind wir uns einig, dass Zend_OpenId die Lösung für PHP5 und OpenId ist, sobald es endlich die Version 2.0 voll unterstützt.

Knowee, a social address book and more

Knowee logoTwo days ago, Benjamin Nowack announced the re-release of Knowee, a distributed social web address book. Knowee started out as a project supported by the W3C Semantic Web Interest Group and will also available for download soon. This means you can install it on your own server, if you like.

Knowee is somewhat similar to NoseRub as it aggregates many of your profiles from popular social networks and applications like Twitter, Identi.ca, or Delicious. But Knowee adds a lot of semantic wizardry to all the data its bots collect over time. Among the technologies employed are FOAF, RDF, Microformats, OpenID, Google's Social Graph API, and SPARQL. The latter makes it easy to re-use the aggregated information in other applications. Without digging too deep into all these formats and APIs, let me say this seems to evolve into a very powerful tool, far more than a simple address book. For more info, read the introductory blog post, or simply take a shot at it.

Knowee conceptThat being said, I'm a little irritated about how little buzz Knowee has created so far (only 4[!] hits on Technorati?). Is everyone simply fed up with yet another social network aggregator? Or am I just a little bit too impatient? I don't know, but I know that Knowee deserves more attention even if it's still in an early stage. Especially since I'm sure that Benjamin will add more useful features soon, e.g. the integration of MyBlogLog.

My public Knowee profile can be found here.