Question

I'm using Selenium WebDriver with Java and TestNG as Test framework. I'm using Eclipse (eclipse-jee-indigo-SR2-win32) as IDE. I want to execute my test (java file) in eclipse as TestNG test.

For example, I have Registration.java and I want to run within eclipse as TestNG test. For running this file I did the following steps:

  1. Right click on Registration.java
  2. Mouse over "Run As" at pop up

But I didn't find any option of TestNG to run my test. What should be done in eclipse for this?

Was it helpful?

Solution

It needs to install TestNG plug-in for Eclipse. To do this follow the steps below:

  1. Open eclipse
  2. Go to Help --> Eclipse Marketplace
  3. Search as TestNG
  4. Click Install for "TestNG for Eclipse" section
  5. Follow the step by step instruction
  6. After successful installation observe TestNG on Window --> Preferences (TestNG is enlisted at left panel)

[Note: Right click on Registration.java -> Mouse over Run As -> Click TestNG Test. Your test Registration would be executed]

OTHER TIPS

Is it just this file that you can't run as a TestNG test or anything, i.e. have you configured Eclipse for TestNG at all yet? If not the first place to look is here http://testng.org/doc/eclipse.html

Please follow Koly answers. That is correct one!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top