top of page

TestNG Test Suite

What Is A Test Suite ?

Test suite is just a collection of testNG tests.In test suite multiple tests can be run in one execution.

We can run our classes through test suite.

Create and Run TestNG Test Suite

TestNG requires a testNG XML file to run a test suite or we can say test suite is repersented by a testng.xml file.

Here is a requirement of a xml file to achieve test suite.

1. Creating TestNG XML :

Right-click on the project go through 'New' select 'File'.

Name the file as 'testng.xml' .

Now XML file will be in your project.

2. Running a testNG class through test suite/testng.xml :

<suite> This tag can be given any name.

<test> This tag can be given any name.

<classes> It contains a set of classes.

<class> This is the combination of package name and class name.

Right-click on the file,go with 'Run as' then click on 'TestNG Suite' .

Assume that a tesNG class 'SimpleTest' has been created within 'testNGexamples' package.

Now we have to execute this class through test suite.

Example of a Test Suite =>

<!DOCTYPE suite SYSTEM "" >
<suite name="Test-Suite">
<test name="TestNG Demo">
<class name="testNGexamples.SimpleTest"></class>

Output :

Refer next page TestNG Annotations

bottom of page