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 – testng XML with multiple tests

Let's create a testng XML file with multiple tests and run it:

  1. Open Eclipse and create a new project with the name MultiTest and with the following structure:
    Time for action – testng XML with multiple tests
  2. Open the FirstTestClass.java file and add the following code snippet onto it:
    package test.firstpackage;
    
    import org.testng.annotations.Test;
    
    public class FirstTestClass {
      @Test
      public void firstTest(){
        System.out.println("First test method");
      }
    
    }

    The preceding class contains one test method, which is annotated by the @Test annotation. We will be discussing this annotation in more detail in our next chapter. The test method prints a message onto ...

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