Group/Filter in phpunit doesnt execute specific test case

不打扰是莪最后的温柔 提交于 2019-12-24 04:42:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!