Enroll in Selenium Training

In the last tutorial, we introduced you to the TestNG framework, along with its benefits. Additionally, we also made you familiar with a few annotations used in the TestNG framework. Continuing on the same path and before moving to the hands-on experience, we need to install the software on our system. It is effortless to install TestNG in Eclipse as it comes as a plugin.

Moreover, the user just needs to have eclipse installed in their system beforehand. Please visit Download and Install Eclipse to setup Eclipse on your system. This tutorial will cover the following:

  • How To Install TestNG In Eclipse?
  • How To Install TestNG In IntelliJ?
  • Procedure To Download TestNG Jar in IntelliJ?
  • How To Set Up TestNG Jar In IntelliJ?

How To Install TestNG In Eclipse?

The following installation process uses Eclipse Version 4.14.0 as on Mar'20 to install TestNG.

  1. Launch the Eclipse IDE and click “Install New Software” in the Help menu. install testng eclipse

  2. You will see a new installation dialog window, click the "Add" button. add_testng_eclipse

  3. Fill out the information as follows:

Name: TestNG (depends on the user)

Location: https://dl.bintray.com/testng-team/testng-eclipse-release/6.14.3/

Click Add. link to install testng

Note: For Eclipse06-18, you can install TestNG from the Eclipse Marketplace, and for 09-19, you need to follow the new link as given in this tutorial.

  1. Clicking on add redirects us back to the previous window. However, this time you must see the TestNG option in the available software list. After that, check "TestNG" and click Next. install testng in eclipse

  2. Click Next to install the TestNG dependencies that eclipse calculates by itself. install testng dependencies

  3. After that, accept the terms of the license agreement then click Finish. accept terms to install eclipse

  4. You may or may not encounter a Security warning. Click Install Anyway if you do. testng installed successfully

  5. After that, click "Restart Now" to restart the eclipse and finish the installation setup. click Restart Now to finish testng installation setup

  6. Finally, after the restart, verify if TestNG installed successfully. Right-click on your project and see if TestNG displays in the opened menu. testng installed successfully

If everything has happened as stated in this post, congratulations! You have TestNG now installed on your system. Subsequently, in the next section, we will look at how to install TestNG on another popular IDE for Java called IntelliJ.

How To Install TestNG In IntelliJ?

IntelliJ is yet another IDE for running the TestNG test cases other than Eclipse. Intellij requires dependencies to be downloaded externally or through a direct link (if it is a Maven Project). Since we will be running tests on Java, we need to download external TestNG Jar File onto our system.

How To Download TestNG Jar?

TestNG Jar is very easy to install. Visit Maven Repositories and search for TestNG in the search bar. testng_jar_search

Open the TestNG Jar link in the search results. testng_jar_mvn

Select the latest release version that you see. I will use 7.1.0 as its the latest version I have. select_testng_jar_latest

Select the "jar" link to download the TestNG jar onto your local system. download_testng_jar

It will download the TestNG jar file in your system. Now we need to add this jar to IntelliJ so that we can use it in our TestNG tests later in the tutorial.

How To Setup TestNG Jar In IntelliJ?

Once the TestNG Jar file is downloaded to your system, follow these steps:

Navigate to File -> Project Structure in IntelliJ (Ctrl + Alt + Shift +S). Project_Structure_Intellij

Open Modules panel. modules_tab_intellij

Go to the dependencies tab. dependencies_intellij

Click the "+" sign to add a new dependency and then select "JARs or directories". install_testng_in_intellij

Write the path where you downloaded the jar file or navigate directly through the GUI and click Okay. select_testng_jar_dependency

Select Okay in the returning panel, and you will have your TestNG installed in IntelliJ.

It was all in the installing section, and honestly, it was quite easy. In this course about TestNG, we will be going ahead with Eclipse and will run TestNG test cases in Eclipse. It is totally up to you what IDE you want to go ahead with as there is not so much difference between the two.

Conclusively, from the next tutorial onwards, we will try some hands-on exercises with TestNG test cases in Eclipse.

What is TestNG?
What is TestNG?
Previous Article
TestNG Test
TestNG Test
Next Article
Harish Rajora
I am a computer science engineer. I love to keep growing as the technological world grows. I feel there is no powerful tool than a computer to change the world in any way. Apart from my field of study, I like reading books a lot and developing new stuff.
Lakshay Sharma's Photo
Lakshay Sharma

Similar Articles