chibimagic/WebDriver-PHP — Issue #16: Respect browser, host, port set in XML configuration file?
Author: briantully
Created: 2012-01-26 15:57:22+00:00
State: open

I'm trying to figure out how to migrate my existing phpunit/selenium tests from RC to WebDriver. It's a shame there doesn't appear to be better documentation on how to do this. Thankfully I discovered the WebDriver-PHP bindings and have been trying to migrate tests to use it. However I'm unclear on how to get the tests to respect the browser, host and port setting from the XML configuration file I use that works great with the RC bindings. The advantages of using the XML configuration file is that I can call the same suite of tests but use a different browser/host/port setting in a separate XML config file, e.g.,

phpunit --bootstrap bootstrap-trunk.php --configuration local.xml

where local.xml contains the following data (for example):

Tests/WebDriverSampleTest.php

However in my WebDriverSampleTest.php, the host, port and browser are not defined automatically as they were with PHPUnit_Selenium, so I need to manually set them in setUp() like so:

$this->driver = WebDriver_Driver::InitAtHost("qa.myserver.com", "4444", "firefox");

Is there a way to get the test to respect the XML config file settings?

Otherwise it seems I need to duplicate EVERY test with its own browser/host/port setting which would be a nightmare to manage.

Any idea if this is possible or tips on how to work around this?