在发布这篇文章之前,我在这个网站和谷歌上检查了很多,以找出我的问题。我正在测试我的web应用程序,它主要是使用Symfony2框架在PHP中编码的。
我正在使用Selenium进行功能测试。目前我想做的就是使用Selenium Grid在本地机器上并行运行我的功能测试。我所做的是在Selenium IDE上记录测试,并以phpunit格式导出测试用例。我尝试使用selenium grid,但我的phpunit测试仍在按顺序运行。
我做了什么:
1) java服务器selenium- -jar -standalone-2.24.1.jar -role集线器
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)蚂蚁
在我的build.xml中有一个phpunit目标:
<target name="phpunit" description="Run unit tests">
<exec executable="phpunit" failonerror="true"/>
</target>在我的phpunit.xml中有这部分代码:
<testsuites>
<testsuite name="LoginSuite">
<file suffix="Test.php">../../src/Tests/FunctionalTests/LoginSuite_testLoginTest.php</file>
</testsuite>
</testsuites>我的LoginSuite_testLoginTest.php是这样的:
<?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", "test.user@gmail.com");
$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", "test.user2@gmail.com");
$this->type("id=password", "test");
$this->click("id=_submit");
$this->waitForPageToLoad("30000");
}
}
?>在第三步,当我启动ant命令时,我在访问/selenium-server/driver/时遇到了一个jetty error 500问题
如果不是这样做:
java -jar selenium-server-standalone-2.24.1.jar -role node -hub http://localhost:4444 /grid/register -browser "browserName=firefox,maxInstances=2,maxSession=2"我在没有-browser信息的情况下执行相同的命令,它启动了我的测试,但不是并行的……,太奇怪了。
我发现要并行启动phpunit测试,我们必须创建自己的脚本。那么,在这种情况下,我是否需要selenium网格?我很困惑。谢谢你的帮助。
发布于 2012-11-06 21:39:31
phpunit命令行https://github.com/siivonen/parallel-phpunit有一个并行包装器,所以你不需要编写它。您需要在某个地方运行Selenium Hub (以及连接到它的一些节点)。然后,您运行指向该位置的测试,Hub将代理调用到空闲节点。
我们使用并行phpunit和Selenium Grid,将4个节点连接到一个集线器。我们的CI在3分钟内运行30分钟的硒测试。
发布于 2015-04-04 15:26:59
可能会有不同的问题。一个是,在运行预先录制的步骤时,您应该在"browser“参数中添加seleniumProtocol=Selenium,因为在默认情况下,它将是webdriver。
https://stackoverflow.com/questions/11634844
复制相似问题