This is how my testng file looks like:
<!DOCTYPE suite SYSTEM “http://testng.org/testng-1.0.dtd” >
<suites>
<suite name=”ecrTestSuite” verbose=”1″ parallel=”false” group-by-instances=”true”> <test name=”ecrTests” preserve-order=”true” group-by-instances=”true”>
<groups>
<run>
<include name=”ecr” />
</run>
</groups>
<packages>
<package name=”com.mypackage.ht.testcases.*” />
</packages>
</test>
</suite>
<suite name=”KnowledgeBase” verbose=”1″>
<test name=”KnowledgeBase”>
<packages>
<package name=”com.mypackage.ht.testcases.KnowledgeBase” /> </packages>
</test>
</suite>
</suites>
When I run this testng.xml, I see that the tests that are in the packagename: com.mypackage.ht.testcases.KnowledgeBase also do get executed which are not part of the group: ecr.
These are the VM arguments I am passing:
-Dspring.profiles.active=localDriver
-Denvironment=qa
-Dlanguage=en_US
-Dtestng.suitename=ecrTestSuite
-Dtestng.groups=ecr