Running test cases in TestNG without java compiler
Let's create a new project in TestNG.
Step 1: Create a TestNG project. It is created in the same way as we create the java project. Click on the File > New > Java project.
Step 2: Now we will create the Java class file in a src folder. Click on the File > New > Java Project.
Step 3: Enter the class name. Suppose I gave the class name as test1. As we know that execution of java file starts with the main method, check the box of the main method.
In the above screen, we observe that public static void main() method has been included in the test1 class file, so it means that the program will run on Java compiler.
Step 4: If you install TestNG framework or TestNG library, then you do not need to compile on Java compiler as TestNG itself is a java compiler that compiles the test cases. In order to achieve this, we need to install the TestNG plug-in and then add the TestNG plug-in in a project.
Step 5: Now we will create a simple program.
In the above case, we have created a test() method and the class test1 does not contain the main() method. In this case, we use @Test notation which will run the program without any main() method.
Step 5: Run the program by using TestNG.