为了忽略使用PHPUnit的测试,应该在PHP测试方法旁边放置什么属性?
我知道对于NUnit,属性是:
[Test]
[Ignore]
public void IgnoredTest()
Run Code Online (Sandbox Code Playgroud) 所以我想从我的Testsuite中排除一个directoy就像这样:
<testsuite name="PHPUnitWillKillMe">
<directory>src/*/Bundle/*/*Bundle/Tests</directory>
<exclude>src/*/Bundle/*/*Bundle/Tests/Controller/</exclude>
</testsuite>
Run Code Online (Sandbox Code Playgroud)
应该测试除控制器之外的所有东西.
问题是,它不起作用.当我运行时,PHPUnit仍然在src// Bundle //*Bundle/Tests/Controller /中运行所有测试
phpunit --testsuite PHPUnitWillKillMe
Run Code Online (Sandbox Code Playgroud)
任何的想法?
最好的祝福!
我测试的PHPUnit版本是3.7.21和3.7.28.
我想从测试套件中排除或包括某些测试。我想通过注释/组对此进行一些控制,而不是在其中命名特定文件或文件夹phpunit.xml
我已经尝试过类似的操作,但是它似乎忽略了<groups>和/或<include>
<testsuites>
<testsuite name="Unit">
<directory>Unit</directory>
</testsuite>
<testsuite name="IntegrationFirstRound">
<directory>Integration/</directory>
<include><!-- I want to ONLY include this group -->
<group>first-round</group>
</include>
</testsuite>
<testsuite name="IntegrationOther">
<directory>Integration/</directory>
<exclude><!-- I want to EXCLUDE this group, run all others -->
<group>first-round</group>
</exclude>
</testsuite>
</testsuites>
Run Code Online (Sandbox Code Playgroud)
我不想将测试移到其他文件夹以适应此情况,并且我不想从CLI多次调用phpunit,我希望可以通过xml配置获得所需的结果。