0
votes

I've TestNG with version 7.0.0(also tried with 6.14.3) and want to run tests with specific group say Sanity hence testng.xml is like -

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite1" verbose="1" >
    <test name="Sanity Tests">
        <groups>
            <run>
                <include name="Sanity"/>
            </run>
        </groups>
    </test>
</suite>

and test methods are like -

@Test(groups = {"Sanity"})
public void test4(){
     System.out.println("Test4 of Test2");
}

These tests methods are in class which is under maven project - src -> main -> test -> testngtest

When run testng.xml from IDE, it shows no test is run. However if I run those tests by package, class or methods in testng.xml those run.

Could you please help to understand what could be wrong here?

1

1 Answers

0
votes

You did not mentioned the class under which the group exists. The testng.xml will also have classes element after groups.

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite1" verbose="1" >
    <test name="Sanity Tests">
        <groups>
            <run>
                <include name="Sanity"/>
            </run>
        </groups>
        <classes>
            <class name = "YourTestClassName" />
        </classes>
    </test>
</suite>

That should resolve your issue.