So before we move into the uses of the testng.xml file. Let us discuss what testng.xml is.
What is TestNG.xml?
- This is a configuration file that helps in organizing your tests.
- Multiple classes of tests, suites, and tests are handled and created by this XML file.
- Various tests are run under this single XML file, which the testers can easily control. It makes a tester's job easier by controlling the execution of tests by putting all the test cases together and run it under one XML file.
Use Of TestNG.xml
- Parallel execution and group test execution can be done with ease with this XML file.
- Multiple test cases from various classes can be triggered using this.
- Can prioritize and organize test suites and tests.
- Annotations are used for parameterized testing @Parameter.
- @DataProvider for data-driven tests etc.
- Can assert different scenarios that help validate expected results with the actual one.
- Has listeners which can log our every move while testing.