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 method

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

  1. We will use the same project created earlier.
  2. Add a new file TestNG configuration XML named exclude-method-testng.xml to the project with the following content:
    <suite name="Exclude Method Suite" verbose="1">
      <test name="Exclude Method Test">
        <classes>
          <class name="test.firstpackage.FirstTestClass">
            <methods>
              <exclude name="firstTest" />
            </methods>
          </class>
        </classes>
      </test>
    </suite>

    The preceding testng XML suite defines a class that needs to be considered for test execution and the test method that needs to be excluded from execution. To exclude a method from your test suite we have to use the tags methods ...

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