gpt4 book ai didi

phpunit - 如何从命令行运行多个PHPUnit测试套件?

转载 作者:行者123 更新时间:2023-12-04 11:02:43 25 4
gpt4 key购买 nike

如果您在phpunit.xml中配置了多个测试套件,如何运行多个测试套件,但不是从命令行中运行所有测试套件?

phpunit.xml

<?xml version="1.0" encoding="utf-8"?>
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="true"
syntaxCheck="true"
bootstrap="tests/bootstrap.php">
<testsuites>
<testsuite name="Unit">
<directory suffix="Test.php">tests/unit</directory>
</testsuite>
<testsuite name="Integration">
<directory suffix="Test.php">tests/integration</directory>
</testsuite>
<testsuite name="Acceptance">
<directory suffix="Test.php">tests/acceptance</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-html" target="build/coverage"/>
<log type="testdox-html" target="build/requirements.html"/>
</logging>
<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>

例子
phpunit --testsuite Unit|Integration,但不是 Acceptance

最佳答案

从PHPUnit 6.0开始,您可以指定逗号分隔的套件列表:

--testsuite suite1,suite2

版本

它不起作用,即您所期望的(即 <pattern>不是实际的模式):
--testsuite <pattern> Filter which testsuite to run.

您可以选择要运行的测试套件,但不能使用模式来过滤要运行的套件。

更好的描述是 --testsuite <name> Which testsuite to run.
发行报告 https://github.com/sebastianbergmann/phpunit/issues/2273,在版本6.0中为 fixed

关于phpunit - 如何从命令行运行多个PHPUnit测试套件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38276453/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com