Before posting this I checked a lot on this site and on google to figured out my problem. I am testing my web application which is principally coded in PHP using Symfony2 framework.
I am using Selenium to do my functional tests. All I want to do for the moment is to run my functional tests in parallel on my local machine using Selenium Grid. What I do is recording the test on Selenium IDE and export the test case in phpunit format. I tried to use selenium grid but my phpunit tests are still running sequentially.
What I did:
1) java -jar selenium-server-standalone-2.24.1.jar -role hub
2) java -jar selenium-server-standalone-2.24.1.jar -role node -hub http://localhost:4444/grid/register -browser "browserName=firefox,maxInstances=2,maxSession=2"
3) ant
There is in my build.xml a phpunit target:
<target name="phpunit" description="Run unit tests">
<exec executable="phpunit" failonerror="true"/>
</target>
In my phpunit.xml this part of code is present:
<testsuites>
<testsuite name="LoginSuite">
<file suffix="Test.php">../../src/Tests/FunctionalTests/LoginSuite_testLoginTest.php</file>
</testsuite>
</testsuites>
And my LoginSuite_testLoginTest.php looks like this:
<?php
namespace Tests\FunctionalTests;
use Tests\FunctionalTests\SetUpTest;
class LoginSuite_testLoginTest extends SetUpTest
{
public function testLogin()
{
$this->open("/home");
$this->click("link=Login");
$this->type("id=username", "[email protected]");
$this->type("id=password", "test");
$this->click("id=_submit");
$this->waitForPageToLoad("30000");
}
public function testLogin2()
{
$this->open("/home");
$this->click("link=Login");
$this->type("id=username", "[email protected]");
$this->type("id=password", "test");
$this->click("id=_submit");
$this->waitForPageToLoad("30000");
}
}
?>
At the third step when I launch ant command I am getting a jetty error 500 Problem accessing /selenium-server/driver/
If instead of doing:
java -jar selenium-server-standalone-2.24.1.jar -role node -hub http://localhost:4444 /grid/register -browser "browserName=firefox,maxInstances=2,maxSession=2"
I do the same command without -browser informations it launches my tests but not in parallel..., so strange.
I saw that to launch phpunit tests in parallel we have to create our own script to do it. So in this case do I need selenium grid or not?? I am very confused. Thanks for your help.