How To Run TestNG Using Command Prompt | Software Testing Material

Goal: To Run TestNG using Command Prompt:

Steps to achieve our goal – Executing TestNG using Command Prompt:

  1. Open Eclipse and create a Java class
  2. Write a Java program
  3. Convert the Java Program into TestNG
  4. Open command prompt
  5. Run the TestNG using command prompt

Here is a video tutorial to learn “How To Run TestNG Using Command Prompt”:

Please be patient. The video will load in some time.

Step i: Open Eclipse and create a Java class

Step ii. Keep all the library files in a folder (here I create a folder name “lib”)

Step iii: Write a Java program

TestNG Using Command Prompt

Step iv: Convert the Java Program into TestNG

TestNG Using Command Prompt

Step v: Open command prompt

Step vi: Run the TestNG using command prompt

Also you could run TestNG using Batch file (.bat file)

Copy the below code and place it in a notepad and save the file using .bat extension

TestNG using command prompt

TestNG using command prompt

You could find the complete TestNG tutorial here.

TestNG Complete Tutorial

If you are not a regular reader of my blog then I highly recommend you to signup for the free email newsletter using the below link.

Sumasri is a Sr. Software Test Engineer. Currently working in an MNC. She is a co-founder of Software Testing Material. She has an exclusive experience in the field of Software Testing. She writes here about Manual Testing and Automation Testing.

4 thoughts on “How To Run TestNG Using Command Prompt | Software Testing Material”

  1. i tried to add the all jar files in lib folder but i am getting Webdriver Exception cannot be resolved and also it’s not importing the pre-definied class

    Reply

Leave a Comment

Share via
Copy link
Powered by Social Snap