Reputation: 2698
I have a nested structure of test cases like this:
ControllersTestCase -> ControllerTest
ControllersTestCase -> WidgetTestCase -> WidgetTest
OtherTestCase -> OtherTest
When I run tests I want to exclude all tests that extend ControllersTestCase
.
I've tried to add @group annotation to the ControllersTestCase
like this
/**
* @group controllers
*/
class ControllerTestCase extends \Zend_Test_PHPUnit_ControllerTestCase
For this case I want all Widget tests to be excluded as well.
When I run phpunit --exclude-group controllers
tests are still executed.
I have many tests under ControllerTestCase
so it is the last option to visit all of them and add @group
to each of them.
So what can I do to exclude all tests that inherit from ControllersTestCase
?
Upvotes: 2
Views: 445
Reputation: 3007
Perhaps the simplest of all elements, because a DocBlock for a class makes full use of the object-oriented principles that PHP offers and inherits the following information from the superclass (unless overridden):
Summary
Description
The following tags:
author copyright package subpackage version
Three ways to do this:
@group
PHPDoc tags (but that's a lot of work)<exclude>
tags in phpunit.xml
and specify the paths to exclude theremartTestAsSkipped
call inside setUp
method of the class you want to start skipping tests from. All the child classes will inherit it. (This is probably your bet here, though using xml
configuration file is more clean and agile. The latter may be a pain though, with specifying those paths)Upvotes: 1