Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TestNG option not showing in RunAs option in Eclipse

Tags:

eclipse

testng

I am using maven project in eclipse ide and added a testng dependency as:

<dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8.8</version>
        <scope>test</scope>
    </dependency>

but i am unable to see TestNg option when right click on any testclass

like image 343
AdityaK Avatar asked Jul 13 '15 13:07

AdityaK


People also ask

How do I get TestNG in Eclipse?

Step 1: Go to Eclipse help and click on the button to “Install New Software”. Step 2: Click the Add button and type “TestNG” as name and “http://dl.bintray.com/testng-team/testng-eclipse-release/” as a path. Step 3: Once you add the Path, you will notice a TestNG entry under the name.

Which Eclipse version supports TestNG?

Eclipse plug-in Java 1.7+ is required for running the TestNG for Eclipse plugin. Eclipse 4.2 and above is required.

How do I find TestNG in Eclipse Marketplace?

Click on the “Eclipse Marketplace…” option listed under the help menu. In the “Find” input field, write “TestNG” and press enter to search.

How to create a TestNG run configuration in Eclipse?

After you have installed TestNG eclipse plugin, you need to create a TestNG run configuration. From the menu bar select: Run > Run Configurations. Select 'TestNG' from the list and select 'New Lanuch Configuration'. In there select class, method, whatever you want to run.

How to use TestNG in Eclipse Marketplace?

Step #1: Once Eclipse is launched, click on Help and then Eclipse Marketplace. Step #2: A new window would open up, wherein you need to type “TestNG” in the Find text box and click on the Go button.

Can I run TestNG selenium in Eclipse?

We will be using Eclipse throughout the TestNG series, although it is completely up to you to run TestNG in Eclipse or any other IDE to write and run your test cases. Now you can run your first TestNG Selenium script. Happy testing!

How do I know if TestNG is not loading in Eclipse?

See requirements section of testng documentation. If you have Java 1.6 or earlier, it won't load in Eclipse, you can figure this out by looking at the [workspace]/.metadata/.log file, you should see the error logged: Show activity on this post.


4 Answers

That dependency alone is hardly enough. You need to install TestNG Eclipse plugin to be able to use it as you describe.

like image 147
Michał Grzejszczak Avatar answered Oct 16 '22 16:10

Michał Grzejszczak


Select Help / Install New Software... Enter the update site URL in "Work with:" field: Update site for release: https://dl.bintray.com/testng-team/testng-eclipse-release/. Make sure the check box next to URL is checked and click Next.

like image 20
Avnish Rathore Avatar answered Oct 16 '22 16:10

Avnish Rathore


I am working on TestNG in Eclipse, I have added maven dependency using maven:

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

When I tried to run my test file present in src/java/test folder, I can't see anything in RunAs, then I followed below steps:

Goto Help->Install new Software-> Click on Add button->

  1. Name= TestNG
  2. Location=https://dl.bintray.com/testng-team/testng-eclipse-release/7.1.0/

NOTE: 7.1.0 is my TestNG version, you can change this to your version.

It will show you TestNG -> Check it and install it -> Restart Eclipse. Now you can see TestNGTest option in your Run As option.

For more information, check README file in GitHub Repo: https://github.com/cbeust/testng-eclipse

like image 3
Atishay Jain Avatar answered Oct 16 '22 16:10

Atishay Jain


Ensure you have at minimum Java JDK 7, which is required for TestNG. See requirements section of testng documentation.

If you have Java 1.6 or earlier, it won't load in Eclipse, you can figure this out by looking at the [workspace]/.metadata/.log file, you should see the error logged:

!ENTRY org.testng.eclipse 4 0 2015-08-16 06:36:21.383
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.testng.eclipse [432]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=1.7))
like image 2
Greg Avatar answered Oct 16 '22 14:10

Greg