TestNG can be invoked using a build tool such as Gradle or Ant from the command line, or from a suite XML file to group tests together to run. Up to this point, we have covered bits and pieces of the suite files, but let's look more closely at some of the features it provides us. There are many ways to define the suite—let's start by covering the suite, groups, listeners, and test sections.
Note
The TestNG documentation on the XML suite file is located at http://testng.org/doc/documentation-main.html#testng-xml.
The <suite>
section of the XML file can contain groups, listeners, parameters, and test sections. It also can have attributes added to it such as name
, preserve-order
, parallel
, thread-count
, verbose
, and so on. Here's the format:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> <suite name="My_Test_Suite" preserve-order="true" parallel="false" thread-count...