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 – test suite to exclude a particular package

Perform the following steps to create a test suite and exclude a particular package:

  1. Let's take the sample project created earlier for our tests.
  2. Create a testng XML file with name exclude-package-testng.xml in the project. Add the following code to it:
    <suite name="Exclude Package Suite" verbose="1">
      <test name="Exclude Package Test">
        <packages>
          <package name="test.*">
            <exclude name="test.secondpackage" />
          </package>
        </packages>
      </test>
    </suite>

    The preceding test suite defines a test by including all subpackages of the test package (defined by using the regular expression test.*) and excluding only a particular package from all the packages for test execution. This is done by using the ...

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