user808548
user808548

Reputation:

Group/Filter in phpunit doesnt execute specific test case

i have a suite that calls multiple suites and many functions for LOG,REPORT and Execution if i m trying the same 'Group or Filter' pattern its executes all the test cases without executing the selected single test cases.

Edit: I am using an array suite as follows,

$suite->addTestSuite('adminSuite');
$suite->addTestSuite('staffSuite');
$suite->addTestSuite('merchantSuite');

// Run the test
PHPUnit_TextUI_TestRunner::run($suite, array(
            'junitLogfile' => $path_log
        ));

I am calling this file through ant.

Upvotes: 2

Views: 382

Answers (1)

hakre
hakre

Reputation: 197564

From the code you've added, it does exactly what you ask for. As you're running the tests with coded configuration, you would need to take care for filtering or selecting groups on your own as well. The regex based filter for test names is set with the run method as a parameter (in the parameter array). Interesting parameters for you might be: filter, groups and excludeGroups. Example:

// Run the test
PHPUnit_TextUI_TestRunner::run($suite, array(
            'junitLogfile' => $path_log,
            'filter' => $yourFilter,
        ));

Upvotes: 1

Related Questions