Table of content

testng XML in selenium

In TestNG, we cannot define a suite in the testing source code, but it is represented by one XML file, as the suite is the feature of execution.

testng.xml is an XML file that describes the configuration of the TestNG test suite. Using the Testng.xml file, we can run tests available in one or more class files and make them as a single group, hence making the test more meaningful, we call them as scenario-based testing.

  • A suite is represented by one XML file. It can contain one or more tests and is defined by the tag.
  • A test is represented by and can contain one or more TestNG classes.
  • A TestNG class is a Java class that contains at least one TestNG annotation. It is represented by the tag and can contain one or more test methods.
  • A test method is a Java method annotated by @Test in your source.


Can we run the test without using the testng.xml file?
Well, the answer is yes, you can run. But once your test becomes larger and requires a configuration of multiple tests in one place, the best option is testng.xml.

Read & Write Barcode using Selenium Webdriver

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions