PHPUnit配置和运行组测试[Laravel 5.6]

时间:2018-03-13 01:11:18

标签: laravel phpunit

我有@somegroup的这个phpunit.xml:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
    backupStaticAttributes="false"
    bootstrap="bootstrap/autoload.php"
    colors="true"
    convertErrorsToExceptions="true"
    convertNoticesToExceptions="true"
    convertWarningsToExceptions="true"
    processIsolation="false"
    stopOnFailure="false">
    <testsuites>
        <testsuite name="Feature Tests">
            <directory suffix="Test.php">/tests/Feature</directory>
        </testsuite>

        <testsuite name="Unit Tests">
            <directory suffix="Test.php">./tests/Unit</directory>
        </testsuite>
    </testsuites>

    <groups>
        <include>
            <group>somegroup</group>
        </include>
    </groups>

    <filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./app</directory>
        </whitelist>
    </filter>

    <php>
        <env name="APP_ENV" value="testing"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="QUEUE_DRIVER" value="sync"/>
    </php>
</phpunit>

然后我用@group标签这个方法:

/**
 * @group somegroup
 */
public function testStatus()
{
    $response = $this->get('/');
    $response->assertStatus(200);
}

然后我在命令行中运行测试组标记,如下所示:

vendor\bin\phpunit --group somegroup

我明白了:

No tests executed!

没有@group标签的测试命令有效:

vendor\bin\phpunit

我做错了什么?

Laravel不支持@group吗?

0 个答案:

没有答案