RE: Does my testng.xml format look okay? If yes, why running the testng.xml runs the tests that are not part of the group.

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

mmalkani12 Default Asked on January 30, 2017 in Software Testing.
Add Comment
2 Answers

Hi ,

packagename: com.mypackage.ht.testcases.KnowledgeBase also do get executed which are not part of the group: ecr. Because  you have defined “<package name=”com.mypackage.ht.testcases.*” />”. Here (.*) used is running all test classes.  You can specify class/group name  like  <package name=”com.mypackage.ht.testcases.ecr” />   . It will run only your specified groups.

Default Answered on February 14, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.