O'Reilly logo

TestNg Beginner's Guide by Varun Menon

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – creating a test suite with package, class, and test method

Perform the following steps to create a test suite with package, class, and test method:

  1. We will use the same sample project created earlier for defining a test suite.
  2. Add a new file TestNG configuration XML by name combine-testng.xml to the project with following content:
    <suite name="Combine Suite" verbose="1">
      <test name="Combine Test">
        <packages>
          <package name="test.firstpackage" />
        </packages>
        <classes>
            <class name="test.secondpackage.FirstTestClass" />
            <class name="test.thirdpackage.FirstTestClass">
              <methods>
                <include name="firstTest" />
              </methods>
            </class>
        </classes>
      </test>
    </suite>

    The preceding testng XML suite defines a test with a package (test.firstpackage), ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required