【问题标题】:How to use phpunit --testsuite option?如何使用 phpunit --testsuite 选项?
【发布时间】:2016-08-12 18:00:10
【问题描述】:

如何使用 phpunit --testsuite 命令?

例如,我有一个测试文件:

test/xxx/RegistrationConfirmedListenerTest.php

如果我运行 phpunit,那么它将运行 RegistrationConfirmedListenerTest.php 中的测试,但它也会运行我的测试文件夹中的所有其他测试。

我尝试过使用这个 --testsuite 选项,如下所示:

phpunit --testsuite RegistrationConfirmedListenerTest

但是,没有运行。

PHPUnit 4.8.26 by Sebastian Bergmann and contributors.



Time: 46 ms, Memory: 4.00Mb

No tests executed!

我已阅读此处的文档,但没有任何示例可以提供帮助:

https://phpunit.de/manual/current/en/textui.html

【问题讨论】:

    标签: php phpunit


    【解决方案1】:

    您必须创建一个phpunit.xml 并在那里定义您的测试套件。

    <testsuites>
        <testsuite name="youttestsuitename1">
            <file>./path/to/folder/</file>
        </testsuite>
        <testsuite name="youttestsuitename1">
            <file>./path/to/folder2/</file>
        </testsuite>
    </testsuites> 
    

    更多信息official documentations

    【讨论】:

      猜你喜欢
      • 2023-04-01
      • 2012-07-15
      • 2011-11-18
      • 2018-10-31
      • 1970-01-01
      • 2013-06-14
      • 2015-10-11
      • 2017-08-17
      • 2014-07-24
      相关资源
      最近更新 更多