TestNG's groups
If we have <include name="web" >
and <include name="weekend" >
, TestNG runs all the methods that belong to either web or weekend.
Is it possible to change this behaviour so TestNG would run all the methods that belong to web and weekend? Does anyone knows a way to accomplis开发者_StackOverflow中文版h this?
Yes, BeanShell is one approach.
If you need something more sophisticated, you can use an IMethodInterceptor, which basically lets you reorder all the test methods before TestNG starts processing them.
Here is an example:
http://beust.com/weblog/2008/03/29/test-method-priorities-in-testng/
i've found a solution.
i used beanshell to script my conditions inside the <method-selector>
tag.
something like:
<method-selectors>
<method-selector>
<script language="beanshell"><![CDATA[
(groups.containsKey(FIRST_GROUP) && groups.containsKey(SECOND_GROUP))
]]>
</script>
</method-selector>
</method-selectors>
精彩评论