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 ...

Get TestNg Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.