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 – using Ant to run TestNG tests

  1. Open Eclipse and create a new Java project named BuildToolProject with following structure:
    Time for action – using Ant to run TestNG tests
  2. Create a new class file named SampleBuildTest under the test package and replace the existing code with the following code:
    package test;
    
    import org.testng.annotations.Test;
    
    public class SampleBuildTest {
    
      @Test
      public void testMethodOne(){
        System.out.println("Test method one executed");
      }
    
      @Test
      public void testMethodTwo(){
        System.out.println("Test method two executed");
      }  
    }

    The above class contains two test methods which print a message onto the console when executed.

  3. Download the TestNG JAR as mentioned in 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