phpunit没有执行测试

nsv*_*vir 2 php phpunit

我用phpunit进行了'没有测试'

这条线有效

$ phpunit install/InstallDbTest.php
...
<result expected>
...

$ cat suites/installtests.xml   
<phpunit>
    <testsuites>
        <testsuite name="database">
            <file>install/InstallDbTest.php</file>
        </testsuite>
    </testsuites>
</phpunit>

$ phpunit -c suites/installtests.xml 
PHPUnit 4.7.4 by Sebastian Bergmann and contributors.



Time: 130 ms, Memory: 11.25Mb

No tests executed!
Run Code Online (Sandbox Code Playgroud)

有谁能告诉我我做错了什么?

提前致谢!

Sch*_*eis 6

您需要更正phpunit.xml中的路径.

它试图找到该文件suites/install/InstallDbTest.php.由于该文件不存在,因此不会运行任何测试并获得该消息.

将配置更改为以下内容:

<phpunit>
    <testsuites>
        <testsuite name="database">
            <file>../install/InstallDbTest.php</file>
        </testsuite>
    </testsuites>
</phpunit>
Run Code Online (Sandbox Code Playgroud)

phpunit.xml中的文件路径都是相对于xml文件的位置.