title: How does all annotations work in TestNg without main() method
body: <p>I have a doubt in TestNG with Java. I am completly new to TestNG. My doubt is, How all the test cases are executing using TestNG in java without having main() method? Please suggest me if you have any ideas. Following code is the example of a sample test case using TestNG in java. But if you notice, you can find one thing that there is no main() method in the code. Then, how does the testcases are executing? </p>
  
  <p>I have another doubt. Is main() method needed for selenium Webdriver and TestNG combination to execute a script? Or can we execute testcases without main() method? If we can execute testcases without main(), then how does it is possible?</p>
  
  <pre><code>package com.first.example;
  import org.testng.annotations.Test;
  public class demoOne {
      @Test
      public void firstTestCase()
      {
          System.out.println("im in first test case from demoOne Class");
      }
  
      @Test
      public void secondTestCase()
      {
          System.out.println("im in second test case from demoOne Class");
      }
  }
  </code></pre>