Why dont we use the main() method in TestNG class?



  • public class Tests{
    
      @Test
      public void run(){
        sop("this is test method 1");
      }
    
    }
    

    How will Jvm know about entry point of the program?



  • Entry point is always a main method. If you're using command-line to run your tests, you use org.testng.TestNG where there is a main method.

    If you're running tests from IDE or from Maven, there are their own main methods and at some point their code calls TestNG API to execute the tests (or call main method of TestNG if they run tests in different JVM)



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2