1

我设置了一个带有两个目标的 phing 项目:第一个运行phpunit包含 selenium 服务器的测试用例,第二个使用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

4

1 回答 1

0

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

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

于 2013-10-01T05:38:59.240 回答