Javatpoint Logo
Javatpoint Logo

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.

Running test cases in TestNG without java compiler

Step 2: Now we will create the Java class file in a src folder. Click on the File > New > Java Project.

Running test cases in TestNG without java compiler

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.

Running test cases in TestNG without java compiler

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.

Running test cases in TestNG without java compiler

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.

Running test cases in TestNG without java compiler

Output

Running test cases in TestNG without java compiler
Next TopicTestNG XML file





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA