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>