TestNG Introduction | TestNG Tutorial

TestNG Introduction:

Definition of TestNG as per its documentation is as follows:

TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing to integration testing.

Writing a test is typically a three-step process:

  • Write the business logic of your test and insert TestNG annotations in your code.
  • Add the information about your test (e.g. the class name, the groups you wish to run, etc…) in a testng.xml file or in build.xml.
  • Run TestNG.xml.

Later in this tutorial, we will discuss about TestNG Annotations, testng.xml.

TestNG is a framework for Java, so the very first requirement is to have JDK installed in your machine.

Verify Java Installation in your system

Output:

Set Java Environment:

Set the JAVA_HOME environment variable to point to the base directory location, where Java is installed on your machine. For example,

Set the environment variable JAVA_HOME to C:\Program Files\Java\jdk1.8.0_101

Append the string C:\Program Files\Java\jdk1.8.0_101\bin at the end of the system variable, ‘Path‘.

Setup TestNG:

Click on this link to read How to setup TestNG

Click the below Video on How to Install TestNG

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

Click on this link to read How to run TestNG test using CMD

TestNG can be invoked in three different ways:

  • Using command prompt
  • Using testng.xml file
  • Using ANT

Click here to read How to create testng.xml file manually

Click the below Video on How to create testng.xml file

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

You could find the complete TestNG tutorial here.

TestNG Complete Tutorial

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

Rajkumar SM is a founder of SoftwareTestingMaterial. He is a certified Software Test Engineer by profession and blogger & youtuber by choice. He has an extensive experience in the field of Software Testing. He writes here about Software Testing which includes both Manual and Automation Testing. He loves to be with his wife and cute little kid 'Freedom'.

Leave a Comment

Share via
Copy link
Powered by Social Snap