How do I run a test script in TestNG?

How do I run a test script in TestNG?

You can execute TestNG test cases in multiple ways .

  1. Create a Simple TestNG class, add testNG plugin in your IDE, right click the Class File and you can see "Run As TestNG class.

  2. Use testng testsuite xml file , right click and run as TestSuite .

  3. Add individual Test Class or test Suite xml in build tool like Maven and you trigger the test cases from test goal of your build tool