【问题标题】:Phing avoids Selenium browser settings in PHPUnit configurationPhing 在 PHPUnit 配置中避免 Selenium 浏览器设置
【发布时间】:2013-02-25 15:49:43
【问题描述】:

我设置了一个具有两个目标的 phing 项目:第一个运行包含 selenium 服务器的 phpunit 测试用例,第二个使用 phpunitreport 任务生成 phpunit 测试报告。

phpunit 任务被配置为使用名为“phpunit-config.xml”的外部配置文件。此配置 XML 文件有一个 <selenium /> 标记,其中定义了两个浏览器。未处理此浏览器设置,因此我从 Selenium RC 服务器收到异常:“Browser not supported:” - 请注意此处的空浏览器名称。

如果我直接从命令行使用相同的配置 XML 文件运行 phpunit,一切都会按预期工作。

phing-build.xml:

<project name="test-and-report" default="gen-report" basedir=".">

<target name="gen-report" depends="run-tests" >
    <phpunitreport infile="report-junit.xml" format="frames" todir="report-phing" styledir="xsl/">
    </phpunitreport>
</target>

<target name="run-tests">
    <phpunit configuration="phpunit-config.xml">
        <formatter type="xml" outfile="report-junit.xml"></formatter>
        <batchtest>
            <fileset dir="functional">
                <include name="functional/**/*Test.php" />
            </fileset>
        </batchtest>
    </phpunit>
</target>

phpunit-config.xml:

<phpunit bootstrap="bootstrap.php"
    colors="false"
    convertErrorsToExceptions="true"
    convertNoticesToExceptions="true"
    convertWarningsToExceptions="true"
    stopOnFailure="false">

<selenium>
    <browser name="Internet Explorer" browser="*iexplore" />
    <browser name="Firefox" browser="*firefox" />
</selenium>

</phpunit>

不工作场景:

phing -buildfile phing-build.xml

工作场景:

phpunit --configuration phpunit-config.xml functional\

在不工作的情况下,我从 Selenium RC 服务器收到以下错误消息:

16:31:43.746 INFO - Command request: getNewBrowserSession[, http://localhost:8001 /index-test.php/] on session null
16:31:43.746 INFO - creating new remote session
16:31:43.746 INFO - Got result: Failed to start new browser session: java.lang.RuntimeException: Browser not supported:
(Did you forget to add a *?)

Supported browsers include:
 *firefox
 *mock
 *firefoxproxy
 <cutted here>

有什么建议吗?

我也为此提出了一张票:http://www.phing.info/trac/ticket/983

【问题讨论】:

    标签: selenium phpunit phing


    【解决方案1】:

    对于好奇的人,票中的讨论解决了这个问题:

    感谢您的报告!我们的 phpunit 任务还不支持 标签,所以我将其标记为增强,而不是 缺陷:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-10
      相关资源
      最近更新 更多