[英]Selenium browsers not recognized if using phpunit.xml
我通过在phpunit 3.7.21中扩展\\ PHPUnit_Extensions_Selenium2TestCase并使用$浏览器指定浏览器来创建测试用例:
class SeleniumTest extends \PHPUnit_Extensions_Selenium2TestCase
{
public static $browsers = array(
array(
'name' => 'Explorer on Windows',
'browserName' => 'explorer',
'host' => 'localhost',
)
);
}
但是,如果我删除$浏览器并尝试通过在标记中添加以下内容来配置phpunit.xml中的浏览器,则根据文档 ,设置不会被读取:
<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>
我已经尝试将browser="explorer"
更改为browserName="explorer"
但在任何一种情况下设置都没有被提取。
我相信它不是连接问题,因为PHPUnit不会尝试为每个浏览器运行测试。 PHPunit / Selenium2是否支持此功能?
phpunit.xml
解决方案仅适用于Selenium RC
(并在文档中明确说明)。
对于phpunit selenium 2,您必须使用静态属性来遵循原始想法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.