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.
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
I am Pavankumar, Having 8.5 years of experience currently working in Video/Live Analytics project.