Friday, 15 August 2014

Configure testng.xml In Eclipse For Creating Web Driver test using classes from different packages.



For example we create new packages and classes using below steps,

Step 1. Create package = "TestNGOnePack" with classes = BaseClassOne.java, ClassOne.java and ClassTwo.java

Step 2. Create package = "TestNGTwoPack" under same project and add ClassOne.java and ClassTwo.java files

Step 3. Create package = "TestNGThreePack" under same project and add ClassOne.java and ClassTwo.java file



Here i dont want to execut all classes from all packages. I need some selected classes from selected packages. like like TestNGOnePack.ClassOne, TestNGTwoPack.ClassTwo, TestNGThreePack.ClassOne and TestNGThreePack.ClassTwo


Here we need to configure testng.xml file as below

<suite name="Suite One">
 <test name="Test One" >
  <classes>
   <class name="TestNGOnePack.ClassOne" />
   <class name="TestNGTwoPack.ClassTwo" />
   <class name="TestNGThreePack.ClassOne" />
   <class name="TestNGThreePack.ClassTwo" /> 
  </classes>
 </test>
</suite>


This way we can configure our test suite using only specific class from different packages

No comments:

Post a Comment