Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selenium 1.2.5 does not run browser if test has dataProvider #115

Closed
emaks opened this issue Mar 26, 2012 · 3 comments
Closed

Selenium 1.2.5 does not run browser if test has dataProvider #115

emaks opened this issue Mar 26, 2012 · 3 comments

Comments

@emaks
Copy link
Contributor

emaks commented Mar 26, 2012

Example
class test extends PHPUnit_Extensions_SeleniumTestCase
{
public static $browsers = array(
array(
'name' => 'Firefox',
'browser' => '_firefox',
'host' => 'localhost',
'port' => 4444
),
array(
'name' => 'Google Chrome',
'browser' => '_googlechrome',
'host' => 'localhost',
'port' => 4444
)
);

protected function setUp()
{
    $this->setBrowserUrl("http://google.com");
}

/**
 * @test
 * @dataProvider dataProvider
 */
public function test1($url)
{
    $this->open($url);
    $this->assertSame('Google', $this->getTitle());
}

public function dataProvider()
{
    return array(
        array('/')
    );
}

}

result:

PHPUnit 3.6.10 by Sebastian Bergmann.

Configuration read from D:\Project\TAF\phpunit.xml

RuntimeException : Invalid response while accessing the Selenium Server at 'http://localhost:4444/selenium-server/driver/': ERROR Server Exception: sessionId should not be null; has this session been started yet?
#0 ...\PHPUnit\Extensions\SeleniumTestCase\Driver.php(1049): PHPUnit_Extensions_SeleniumTestCase_Driver->doCommand('getExpression', Array)
#1 ...\PHPUnit\Extensions\SeleniumTestCase\Driver.php(980): PHPUnit_Extensions_SeleniumTestCase_Driver->getString('getExpression', Array)
#2 ...\PHPUnit\Extensions\SeleniumTestCase\Driver.php(633): PHPUnit_Extensions_SeleniumTestCase_Driver->preprocessParameters(Array)
#3 [internal function]: PHPUnit_Extensions_SeleniumTestCase_Driver->__call('selectWindow', Array)
#4 [internal function]: PHPUnit_Extensions_SeleniumTestCase_Driver->selectWindow('null')
#5 ...\PHPUnit\Extensions\SeleniumTestCase.php(729): call_user_func_array(Array, Array)
#6 ...\PHPUnit\Extensions\SeleniumTestCase.php(1093): PHPUnit_Extensions_SeleniumTestCase->__call('selectWindow', Array)
#7 ...\PHPUnit\Extensions\SeleniumTestCase.php(1093): test->selectWindow('null')
#8 ...\PHPUnit\Extensions\SeleniumTestCase.php(1052): PHPUnit_Extensions_SeleniumTestCase->restoreSessionStateAfterFailedTest()
#9 ...\PHPUnit\Framework\TestCase.php(912): PHPUnit_Extensions_SeleniumTestCase->onNotSuccessfulTest(Object(RuntimeException))
#10 ...\PHPUnit\Framework\TestResult.php(649): PHPUnit_Framework_TestCase->runBare()
#11 ...\PHPUnit\Framework\TestCase.php(751): PHPUnit_Framework_TestResult->run(Object(test))
#12 ...\PHPUnit\Extensions\SeleniumTestCase.php(512): PHPUnit_Framework_TestCase->run(Object(PHPUnit_Framework_TestResult))
#13 ...\PHPUnit\Framework\TestSuite.php(772): PHPUnit_Extensions_SeleniumTestCase->run(Object(PHPUnit_Framework_TestResult))
#14 ...\PHPUnit\Framework\TestSuite.php(745): PHPUnit_Framework_TestSuite->runTest(Object(test), Object(PHPUnit_Framework_TestResult))
#15 ...\PHPUnit\Framework\TestSuite.php(705): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false)
#16 ...\PHPUnit\Framework\TestSuite.php(705): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false)
#17 ...\PHPUnit\TextUI\TestRunner.php(325): PHPUnit_Framework_TestSuite->run(Object(PHPUnit_Framework_TestResult), false, Array, Array, false)
#18 ...\PHPUnit\TextUI\Command.php(192): PHPUnit_TextUI_TestRunner->doRun(Object(PHPUnit_Extensions_SeleniumTestSuite), Array)
#19 ...\ide-phpunit.php(194): PHPUnit_TextUI_Command->run(Array, true)
#20 ...\ide-phpunit.php(386): IDE_PHPUnit_TextUI_Command::main()
#21 {main}

@emaks
Copy link
Contributor Author

emaks commented Mar 26, 2012

I guess error in PHPUnit\Extensions\SeleniumTestCase, function suite($className), line 452 ($browserSuite->addTest($test);)

@giorgiosironi
Copy link
Owner

This is related to #114 and will be fixed accordingly.

@giorgiosironi
Copy link
Owner

Fixed in master:
https://github.com/giorgiosironi/phpunit-selenium/blob/master/Tests/SeleniumTestCaseMultipleBrowsersTest.php
Selenese test cases still have to be built manually instead of relying on PHPUnit...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants