phpunit中的组/过滤器不执行特定的测试用例 [英] Group/Filter in phpunit doesnt execute specific test case

查看:80
本文介绍了phpunit中的组/过滤器不执行特定的测试用例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我尝试使用相同的组或过滤器"模式,则它有一个套件可以调用多个套件和许多用于LOG,REPORT和Execution的功能,它可以执行所有测试用例,而不执行所选的单个测试用例.

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.

编辑:我正在使用数组套件,如下所示

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
        ));

我正在通过ant调用此文件.

I am calling this file through ant.

推荐答案

根据您添加的代码,它可以完全满足您的要求.在使用编码配置运行测试时,您还需要注意自己过滤或选择组.使用run方法作为参数(在参数数组中)设置基于正则表达式的测试名称过滤器.您可能感兴趣的参数为:filtergroupsexcludeGroups.示例:

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,
        ));

这篇关于phpunit中的组/过滤器不执行特定的测试用例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆