A test suite is a collection of test cases that are intended to test a behaviour or set of behaviours of software program.

In TestNG, we cannot define a suite in testing source code, for better, it is represented by one XML file, because suite is the feature of execution, this also allows flexible configuration of the tests to be run and keep no change to code base once suite is changed. A suite can contain one or more tests and is defined by the <suite> tag.

We created the following example suite Suite1 which includes SimpleTest1 and SimpleTest2, the several test cases are bundled so will be executed together.

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >

<suite name="Suite1" verbose="1" >
  <test name="SimpleTest1" >
      <class name="tutorialSimpleTest1" />

  <test name="SimpleTest2">
      <class name="ParameterSample"/>
      <class name="ParameterTest"/>

In TestNG runing command line, we can specific a suite name to be ran by using option -suitename.

java org.testng.TestNG testng.xml -suitename Suite1

Note if you annotated methods with @BeforeSuite or @AfterSuite in this test suite, the methods will be run before or after all tests in this suite.