PHPUnit - 通过命令行测试运行程序运行特定的测试套件

发布于 2024-10-05 18:36:04 字数 481 浏览 0 评论 0原文

是否可以通过命令行测试运行程序从配置文件指定要运行哪个测试套件?例如,如果我有以下 xml 配置:

<phpunit ...>
    <testsuites>
        <testsuite name="My Test Suite 1">
            <directory>./MyTestSuite1/</directory>
        </testsuite>
        <testsuite name="My Test Suite 2">
            <directory>./MyTestSuite2/</directory>
        </testsuite>
    </testsuites>
    ...
</phpunit>

我可以让它仅运行“我的测试套件 1”吗?

Is it possible to specify which test suite to run from a configuration file via the command line test runner? For example, if I have the following xml configuration:

<phpunit ...>
    <testsuites>
        <testsuite name="My Test Suite 1">
            <directory>./MyTestSuite1/</directory>
        </testsuite>
        <testsuite name="My Test Suite 2">
            <directory>./MyTestSuite2/</directory>
        </testsuite>
    </testsuites>
    ...
</phpunit>

Can I have it run only "My Test Suite 1"?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

感情废物 2024-10-12 18:36:04

这是phpunit --testsuite“我的测试套件1”

It's phpunit --testsuite "My Test Suite 1"

筱武穆 2024-10-12 18:36:04
  • 您可以在类文档中使用@group标签来指示组,然后使用--group仅在该组上运行测试
  • 您可以使用--filter仅运行与给定正则表达式

更新2013

匹配的测试正如下面@havg的回答提到的,现在可以使用 phpunit --testsuite 运行单独的测试套件

  • you can use the @group tag in the class documentation to indicate the group and then run tests only on that group using --group
  • you can use --filter to only run tests that match a given regex

Update 2013

As @havg's answer below mentions, it's now possible to run individual test suites using phpunit --testsuite

眼眸里的那抹悲凉 2024-10-12 18:36:04

您是否尝试过从命令行运行 phpunit 时添加路径作为参数?

那么像

 phpUnit ./MyTestSuite1/

Have you tried when you run phpunit from the command line to add a path as a parameter?

So something like

 phpUnit ./MyTestSuite1/

?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文