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 – running a dependency test sequentially

Perform the following test to run a dependency test sequentially:

  1. Create a new file with the name factory-testng.xml under the existing project:
    <suite name="Factory suite" verbose="1"  >
      <test name="Factory test" group-by-instances="true">
        <classes>
          <class name="test.factory.DependencyFactory" />
        </classes>
      </test>
    </suite>

    This XML configuration contains only a test inside it. This test executes the DependencyFatory class. To run the dependent methods according to the sequence, they are supposed to run a configuration attribute group-by-instance, which is set to true.

  2. Select the preceding testng XML in Eclipse and run it as a TestNG suite. You will see the following test result in the Console ...

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