the qwerty
the qwerty

Reputation: 239

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 accomplish this?

Upvotes: 1

Views: 1470

Answers (2)

Cedric Beust
Cedric Beust

Reputation: 15608

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/

Upvotes: 2

the qwerty
the qwerty

Reputation: 239

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>

Upvotes: 2

Related Questions