如何运行特定的phpunit xml testsuite? [英] How to run a specific phpunit xml testsuite?
本文介绍了如何运行特定的phpunit xml testsuite?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何选择要执行的特定测试套件?
how can i choose a specific testsuite to be executed?
$ phpunit --configuration config.xml
$ phpunit --configuration config.xml
config.xml:
config.xml:
<testsuites>
<testsuite name="Library">
<directory>library</directory>
</testsuite>
<testsuite name="XXX_Form">
<file>library/XXX/FormTest.php</file>
<directory>library/XXX/Form</directory>
</testsuite>
</testsuites>
推荐答案
以下代码就像PHPUnit 3.7.13
Here's the code as if PHPUnit 3.7.13
$ phpunit --configuration config.xml --testsuite Library
$ phpunit --configuration config.xml --testsuite XXX_Form
如果您要运行一组测试套件,则可以执行此操作
If you want to run a group of the test suites then you can do this
<testsuites>
<testsuite name="Library">
<directory>library</directory>
</testsuite>
<testsuite name="XXX_Form">
<file>library/XXX/FormTest.php</file>
<directory>library/XXX/Form</directory>
</testsuite>
<testsuite name="Both">
<directory>library</directory>
<file>library/XXX/FormTest.php</file>
<directory>library/XXX/Form</directory>
</testsuite>
</testsuites>
然后
$ phpunit --configuration config.xml --testsuite Both
不幸的是,PHPUnit当前不支持这样的嵌套测试套件.
Unfortunately PHPUnit currently does not support nested testsuites like this
<testsuites>
<testsuite name="Both">
<testsuite name="Library">
<directory>library</directory>
</testsuite>
<testsuite name="XXX_Form">
<file>library/XXX/FormTest.php</file>
<directory>library/XXX/Form</directory>
</testsuite>
</testsuite>
</testsuites>
因此,如果您想以这种方式运行测试套件组,则必须具有xml配置重复项!
So if you wanted to run groups of test suites this way you have to have xml configuration duplication!
这篇关于如何运行特定的phpunit xml testsuite?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文