Thursday, December 1, 2022

TestNG - files structure

Structure of the TesNG.xml file consists elements as below.

<suite>
    <test name = "">
         <classes>
            <class name="" />
         <classes>
    </test>
    <test name = "">
        <classes>
            <class name="" />
        <classes>
     </test>
</suite>
  • Each testNG xml pockets its content within the parent <suite> tags.
  • test tags is the next main level and you can have many test tags. These specify the module.
  • classes comes next. This helps goup the many classes you have under a certain test module
  • class is the smallest element which carries the class name.
Example of a sample TestNG is as below;
 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite parallel="tests" name="ShoppingCart">

  <test thread-count ="5" name="Submit Order Tests">
    <classes>
      <class name="learningspace.tests.SubmitOrderTest"/>
    </classes>
  </test>
  
  <test thread-count ="5" name="Error Validation Tests">
    <classes>
      <class name="learningspace.tests.ErrorValidationTests"/>
    </classes>
  </test>
  
</suite>

No comments:

Post a Comment

Featured

Selenium - Page Object Model and Action Methods

  How we change this code to PageObjectModel and action classes. 1 2 3 driver . findElement ( By . id ( "userEmail" )). sendKeys (...

Popular Posts