Question

I want to lauch all my integration tests (group=inttest) so I write this xml config:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Service Integration Test" parallel="none">
  <test verbose="1" name="Service Integration Test">
    <groups>
      <run>
        <include name="inttest.*"/>
      </run>
    </groups>   
  </test>
</suite>

But when ran from intellij, no tests are ran. If I add a 'classes' section like this:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Service Integration Test" parallel="none">
  <test verbose="1" name="Service Integration Test">
    <groups>
      <run>
        <include name="inttest.*"/>
      </run>
    </groups> 

   <classes>
     <class name="com.service.MyTestClass" />
   </classes>  
  </test>
</suite>

Then all test of the group 'inttest.*' contained in class com.service.MyTestClass are ran...

What's the problem ?

Was it helpful?

Solution

As you correctly found out, you need to tell TestNG what classes it should be looking into in order to find the groups you specified.

You can also specify entire packages if you prefer.

As for why all test methods are run, I'll need to take a look at the class to figure out what's going on. Maybe you made all the test methods belong to a group "inttest" by specifying a @Test annotation at the class level?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top