TestNG Tutorials 2: Installation Of TestNG In Eclipse ==> Download And Add To Build Path Way

Hello Folks,

In last post, we have seen the requirements of TestNG in Selenium webdriver. We will learn how can we install TestNG in eclipse.

TestNG is a jar file. Any JAR file stands for Java ARchive which is a package file format typically used to aggregate many Java class files and associated metadata and resources (text, images, etc.) into one file for distribution.

We can install TestNG in different ways given below:

  1. Download and add to build path.
  2. Using market place
  3. Using Install New Software option of Eclipse
  4. Using Maven’s pom.xml
  5. Using Gradle

Above ways are scenario dependent and I will explain when and which way to follow.

Download and add to build path:

When:

  1. If you are using a normal Java project or I can say more specifically, if you are not using Maven or Gradle project.
  2. Sometimes you will find that TestNG is not getting installed using Market place and Install New software options. In that case also, you can use this way.

How:

You can download TestNG jar files from below sites:

  1. http://www.java2s.com
  2. https://jar-download.com

Some direct link I can give you below:

  1. https://jar-download.com/explore-java-source-code.php?a=testng&g=org.testng&v=6.14.3&downloadable=1
  2. http://www.java2s.com/Code/Jar/t/Downloadtestng685jar.htm

Major disadvantage of using this approach is that you may or may not get the latest version of TestNG and also any upgrade need manual effort to download and add again to build path. Remember you must remove old version from build path.

Steps to follow:

  1. Download TestNG jar file from any of the above sites. You will get a zip file which will have jar file inside.
  2. Unzip the Zip file and copy jar file.
  3. Create a folder (Say jarFIles) within project and paste jar file in that folder. You can just use normal copy paste command to do this.

4. Now you need to ad dthis jar file in to build path, so that Java Compiler will be aware of this. To add into build path, right click on testng jar file and Mouse hover on Build Path and select “Add to build path”.

Right Click —> Build Path —>Add To Build Path

 

5. Once you add jar file into build path, you can verify it by checking in “Referenced Libraries” folder. Expand it and you should see tesng.jar file in that.

6. You can also verify correct installation by using any one of the tag ( @Test etc) in any script. When you type @Test and mouse hover on it, you can see options to import it from TestNG package.

We will see other ways in upcoming posts.

More about TestNG in upcoming posts. Stay tuned.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappySelenium

 

 

 

2 thoughts on “TestNG Tutorials 2: Installation Of TestNG In Eclipse ==> Download And Add To Build Path Way

Leave a Reply

Your email address will not be published. Required fields are marked *