PHPUnit 支持的 group 测试

Posted on 4th September 2007 by Nio in Testing, 程序人生

via TestNG-style Grouping of Tests

PHPUnit 3.2 开始,支持像 TestNG 那样的 group 测试了,使用非常简单,只需要加上 @group 即可。


<?php
class TestTest extends PHPUnit_Framework_TestCase
{
    /**
     * @group a
     */
    public function testOne()
    {
    }
 
    /**
     * @group a
     * @group b
     */
    public function testTwo()
    {
    }
}
?>

使用 –group 选项运行 group 测试:


# phpunit --group a TestTest
PHPUnit 3.2.0-dev by Sebastian Bergmann.
..
Time: 0 seconds

OK (2 tests)

# phpunit --group b TestTest
PHPUnit 3.2.0-dev by Sebastian Bergmann.
.
Time: 0 seconds

OK (1 test)

No Comments »

No comments yet.

Leave a comment