user1678586
user1678586

Reputation: 5

Selenium browsers not recognized if using phpunit.xml

I've created a test case by extending \PHPUnit_Extensions_Selenium2TestCase and specifiying the browsers using $browsers, in phpunit 3.7.21:

class SeleniumTest extends \PHPUnit_Extensions_Selenium2TestCase
{
    public static $browsers = array(
        array(
            'name' => 'Explorer on Windows',
            'browserName' => 'explorer',
            'host' => 'localhost',
        )
    );
}

But if I remove $browsers and try to configure the browsers in phpunit.xml by putting the following in the tags, as per the docs, the settings do not get read:

<phpunit
    bootstrap="../../TestModule/test/ModuleBootstrap.php"
    backupGlobals="false">
    <testsuites>
        <testsuite name="manager">
            <directory>./Test</directory>
        </testsuite>
    </testsuites>
    <selenium>
        <browser name="Firefox on Windows"
           browser="firefox"
           host="localhost"/>
        <browser name="Explorer on Windows"
           browser="explorer"
           host="localhost"/>
    </selenium>
</phpunit>

I've tried changing browser="explorer" to browserName="explorer" but in either case the settings are not getting picked up.

I believe it is not a connection issue as PHPUnit does not try to run the test for each browser. Is this feature supported in PHPunit / Selenium2?

Upvotes: 0

Views: 618

Answers (1)

zerkms
zerkms

Reputation: 255025

The phpunit.xml solution only works for Selenium RC (and it's stated explicitly in the documentation).

For phpunit selenium 2 you have to follow your original idea with a static property.

Upvotes: 3

Related Questions