Friday, 15 August 2014

Include/Exclude Selenium WebDriver Test Package From Test Suite Using testng.xml




We can include or exclude selenium webdriver from test suite using below steps


1) Create new package and classes as below

TestNGOnePack(package) -> BaseClassOne.java, ClassOne.java, ClassTwo.java
TestNGTwoPack(package) -> ClassOne.java, ClassTwo.java
TestNGThreePack(package) -> ClassOne.java, ClassTwo.java


2) Include perticular package from test suite


<suite name="Suite One">
  <test name="Test One" >
     <packages>
        <package name=".*">
           <include name="TestNGOnePack" > </include>
        </package>
     </packages>
  </test>
</suite>


We can execute only "TestNGOnePack", "TestNGThreePack" package from this execution. We exclude "TestNGTwoPack" package from execution.


3) Exclude Perticular package from test suite execution



<suite name="Suite One">
  <test name="Test One" >
     <packages>
        <package name=".*">
           <exclude name="TestNGOnePack" > </exclude>
        </package>
     </packages>
  </test>
</suite>

We can execute only  "TestNGTwoPack","TestNGThreePack" package from this execution. We exclude "TestNGOnePack" package from execution.So its not get execute.

No comments:

Post a Comment