Creating And Running WebDriver Test Suit Using testng.xml File

Introduction Of testng.xml File
In TestNG framework, We bespeak to create testng.xml file to exercise in addition to grip multiple assay out classes. testng.xml is the file where nosotros tin configure our webdriver software automation test, fix software assay out dependency, include or exclude whatever software assay out method or bird or package, fix priority etc.. We volition larn each in addition to every affair near TestNG usage in my futurity posts. Right at 1 time allow me depict yous how to create testng.xml

Creating testng.xml File
  • First of all Create a projection in addition to webdriver assay out representative equally described inwards my PREVIOUS POST.
  • To create testng.xml file, Right click on projection folder in addition to Go to New -> File as shown inwards bellow given image. It volition opened upwards New File wizard.


  • In New file wizard, direct "TestNGOne" projection in addition to add together file advert = "testng.xml" equally shown inwards bellow given picture in addition to click on Finish button.


  • It volition add testng.xml file nether your projection folder. Now add together bellow given lines inwards your testng.xml file.
<suite name="Suite One" >  <test name="Test One" >   <classes>    <class name="TestNGOnePack.ClassOne" />   </classes>  </test> </suite>

Now your testng.xml file volition looks similar bellow.


In to a higher house testng.xml code,
  • <suite> : suite tag defines the TestNG suite. You tin hand whatever advert to your suite using 'name' attribute. In to a higher house given example, We convey given "Suite One" to our assay out suite.
  • <test> : assay out tag defines the TestNG test. You tin hand whatever advert to your assay out using 'name' attribute. In to a higher house given example, We convey given "Test One" to our test.
  • <classes> : classes tag defines multiple class. We tin multiple assay out bird under classes tag. In our representative nosotros convey exclusively 1 class.
  • <class> : class tag defines the bird advert which yous wants to visit inwards assay out execution. In to a higher house given example, nosotros convey defined name="TestNGOnePack.ClassOne" where 'TestNGOnePack' describes bundle advert in addition to 'ClassOne' describes bird name.
This way, to a higher house given testng.xml file volition execute exclusively ClassOne bird from TestNGOnePack package.

Executing testng.xml File
To Run
Right click on testng.xml file -> Run As -> Select TestNG Suite as shown inwards bellow given image.


It volition showtime execution of defined software assay out bird 'ClassOne' from 'TestNGOnePack' package.

When execution completed, You tin view test execution HTML study equally described inwards my PREVIOUS POST. Test execution HTML study volition looks similar bellow.


This is the 1 uncomplicated representative of creating in addition to running testng.xml file inwards eclipse for webdriver software testing tool. We volition run into unlike examples of testng.xml file to configure our assay out inwards my futurity post.

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