2011-01-26 27 views
12

在PHPUnit的帮助,它会显示以下内容:使用PHPUnit,你如何测试两个或更多的组?

--group ...    Only runs tests from the specified group(s). 
    --exclude-group ...  Exclude tests from the specified group(s). 

很容易为一组。这工作:

phpunit --group fast 

现在,我不能完全弄清楚如何做到这一点与多个组。以下不适用于我:

phpunit --group fast unit # It believes you want to test unit.php 
phpunit --group fast, unit # It believes you want to test unit.php 
phpunit --group "fast unit" # It looks for a single group "fast unit" 
phpunit --groups fast, unit # There is no option, groups 
phpunit --group fast --group unit # Only one is honored 

任何关于正确语法的想法都会受到欢迎。谢谢。

回答

25

使用没有任何空格的逗号分隔。例如。

phpunit --group fast,unit 
+0

工作就像一个魅力。谢谢! – bitsoflogic 2011-01-26 20:47:27

6

尝试phpunit --group "fast, unit"phpunit --group fast,unit

命令行参数在空间上分开,所以您必须将值包含在双引号中或省略空格。

+0

它看起来像 - 组“快,单位”只使用快速组。尽管如此,谢谢你的回应。你的第二种方法效果很好。 – bitsoflogic 2011-01-26 20:46:56

+1

引用对于组中有空格的情况非常有用,例如,当PHPuni的`@ author`标签被PHPunit转换为一个组时,您可以指定一个引号,另外一些不包含例如。 `phpunit --group“你的名字<[email protected]”,快,单位等 – 2015-09-15 01:38:37

0

在情况下,你可以使用PHPUnit的使用目录,排除组选项必须是第一位的目录值,例如: PHPUnit的--exclude组A组,B族,C组YOUR_DIRECTORY

相关问题