问题
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.
回答1:
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,
));
来源:https://stackoverflow.com/questions/6570568/group-filter-in-phpunit-doesnt-execute-specific-test-case