HomeSelenium

How to verify if TestNG is installed successfully

How to verify if TestNG is installed successfully
Like Tweet Pin it Share Share Email

In this article you will learn how to verify TestNG is installed successfully or not, there are multiple ways to do so, we have produced couple of most popular and easy ways of verification

In case you have not yet installed TestNG plugin, we recommend you to follow “How to install TestNG plugin in eclipse latest version

Easy ways to verify if TestNG is installed successfully

  • Show view window
  • Creating new class types

1. Verify TestNG is installed at show view window

  • Navigate to menu Window > Show View > Other
  • Expand Java folder in the Show View window
  • You should see “TestNG” in the list

2. Verify if TestNG is installed successfully by creating a new class

  • Right click on package explorer view in Eclipse IDE
  • Create a new maven project ( assumption: maven plugin is already installed, i created with group id: com.tt.learning , artifact id: com.tt.learning )
  • Once project is created, add testng maven dependency at pom.xml file.
  • Now expand the com.tt.learning project in project explorer till src/test/java > com.tt.learning package folder appears.
  • Right click on com.tt.learning pacckage folder and navigate to New > Other
  • You should see a new Folder “TestNG” , you can expand to see if it contains “TestNG Class”
  • Select TestNG class and click on next to create a new class
  • Provide details as above and click finish
  • You might see an error icon, that is because we need to provide maven dependency for TestNG
  • Firstly, we need to get the maven dependency for TestNG and provide in pom.xml file of maven project

//here is a sample code

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
</dependency>

  • Once you add above dependency in pom.xml and save the project, the error gets disappeared.
  • Now right click on FirstClass.java file and select menu option “Run As > TestNG Test” from the context menu
  • On completion on test execution, you can see the test results in console window.

Above are the 2 best ways to verify if TestNG plugin is installed successfully or not.

Comments (6)

  • Hello Srinivas , thanks for guidence ,
    After getting intalled successfully i am getting error

    Reply
  • Hi Srinivas,
    I have a question but not sure if you can help me.
    I just downloaded the latest IntelliJ with Maven installed. My IntelliJ is not recognizing TestNG annotations.

    Do I have to download some extra plugin(s) or files and perform additional setups?
    I’m asking because TestNG is supposed to come “bundled” with IntelliJ according to IntelliJ itself and according to the testng.org website…
    So I was assuming (perhaps wrongly) that it would work straight out-of-the-box. Thank you for any help. Happy Makar Sankranti day!

    Reply
  • Hi Srinivas,

    After following the process issue doesnot resolve. Is their any alternative? Number of errors increased.

    Reply
    • Author

      Need to see what kind of errors you are getting also, there might be a new string to get TestNG also nowadays with the latest eclipse we are able to install from marketplace itself

      Reply

Leave a Reply

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