If you have a class with "public static void main(String[] args)" method and no @Test annotation it will not have a TestNG run option. For example,
class Foo {
public static void main(String[] args) {
// do nothing
}
}
This will give you Run->Run As->Java Application. If it has the @Test annotation it can be run as a TestNG class. For example,
import org.testng.annotations.Test;
class Foo {
@Test
public void main(String[] args) {
// do nothing
}
}
Note that the method is NOT static. This will give you Run->Run As->TestNG. If it matches both requirements, you will have both run options. For example,
import org.testng.annotations.Test;
class Foo {
@Test
public static void main(String[] args) {
// do nothing
}
}
This class has the correct method to be a Java Application but it also has the minimum requirements for a TestNG class. So the Run menu will have:
Run->Run As->Java Application
Run->Run As->TestNG
Darrell