如果我们有<include name="web" >和<include name="weekend" >,TestNG运行所有属于web或周末的方法。
是否有可能改变这种行为,以便TestNG能够运行属于web 和周末的所有方法?有谁知道怎么做到这一点吗?
发布于 2010-04-13 21:26:35
是的,BeanShell是一种方法。
如果您需要更复杂的东西,可以使用IMethodInterceptor,它基本上允许您在TestNG开始处理它们之前重新排序所有的测试方法。
下面是一个示例:
http://beust.com/weblog/2008/03/29/test-method-priorities-in-testng/
发布于 2010-04-13 16:31:18
我找到了解决办法。
我使用beanshell在<method-selector>标记中编写条件脚本。
类似于:
<method-selectors>
<method-selector>
<script language="beanshell"><![CDATA[
(groups.containsKey(FIRST_GROUP) && groups.containsKey(SECOND_GROUP))
]]>
</script>
</method-selector>
</method-selectors>https://stackoverflow.com/questions/2629812
复制相似问题