Configure testng.xml In Eclipse For Selenium WebDriver To Run All Or Specific Package

TestNG is real useful as well as powerful framework for selenium webdriver. We postulate to configure our tests based on our requirements or essay out scenarios. We are going real slow amongst TestNG framework to sympathise each as well as everything clearly amongst examples as well as therefore that it tin flame help you lot to configure your test inwards any king of situations. In my previous posts, nosotros accept learnt virtually HOW TO RUN SPECIFIC CLASS FROM DIFFERENT PACKAGE USING testng.xml as well as HOW TO RUN SINGLE OR MULTIPLE CLASSES FROM ONE PACKAGE USING testng.xml. So right away you lot tin flame configure your testng.xml file to run whatever specific shape from whatever package if you lot accept read both previous posts.

Configure TestNGOne Project In Eclipse
In testng.xml file, You tin flame likewise configure to run specific bundle or all packages of project. Let nosotros run across both examples. First of all, Create bellow given 3 packages amongst required classes, methods as well as code same every bit described inwards my PREVIOUS POST.

  1. TestNGOnePack(package) -> BaseClassOne.java, ClassOne.java, ClassTwo.java
  2. TestNGTwoPack(package) -> ClassOne.java, ClassTwo.java
  3. TestNGThreePack(package) -> ClassOne.java, ClassTwo.java
So right away your projection construction should hold upward every bit shown inwards bellow given image.



Configure testng.xml to run selected packages from all packages of webdriver projection inwards unmarried essay out suite
From 3 packages, I wants to run solely 2 packages -> "TestNGTwoPack" as well as "TestNGThreePack". For that nosotros postulate to configure testng.xml every bit bellow.

<suite name="Suite One">  <test name="Test One" >   <packages>    <package name="TestNGTwoPack" />    <package name="TestNGThreePack" />   </packages>  </test>  </suite>

In higher upward given testng.xml code, <packages> tag packages is used to depict grouping of packages and <package> tag package is used to add together specific bundle inwards our essay out suite. So when you lot run higher upward testng.xml file, It volition run solely targeted 2 packages(TestNGTwoPack, TestNGThreePack). Other (TestNGOnePack)package(s) volition hold upward excluded from execution. Execution written report volition looks similar bellow.

As you lot see, "TestNGOnePack" bundle is non executed every bit shown inwards higher upward written report image.

Configure testng.xml to run all packages of projection inwards unmarried essay out suite
If you lot wants to run all packages of your project, you lot tin flame configure your testng.xml using wildcard(.*) amongst bundle tag every bit bellow.

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

Above given testng.xml file volition execute all packages of your selenium webdriver projection as well as essay out number written report volition looks similar bellow.


As you lot run across inwards report, Now all the packages are executed. This way, nosotros tin flame role wild bill of fare to include all webdriver essay out packages inwards our test.

More interesting articles here :Generation Enggelmundus Internet Marketing Tool here :Zeageat IM http://www.software-testing-tutorials-automation.com/
Post a Comment (0)
Previous Post Next Post