How to setup TestNG in selenium webdriver? - selenium

I am using selenium webdriver for website testing. Now I want to setup TestNG in my selenium webdriver. How it possible? Is there any JAR files for testng?

Add testng maven dependency to your pom.xml file. Jars will be auto downloaded. Then you can start using testng in your project.

https://mvnrepository.com/artifact/org.testng/testng
YOu can see all versions her, download the JAR files or use the dependencies in your POM.xml if you use Maven

You can get the testng from the eclipse market place by searching Testng,simple install that you can now use testng on your project.
You can also find this jar for testng libraries and add it to your project.
http://testng.org/testng-6.8.zip

You can install testng from Market place if not found install as software. Details are provided in documentation
https://testng.org/doc/download.html
Once installation is done and eclipse restarted then add TestNG library to you project and then good to go.
For build tools you need testng jars, you can download from maven repository. If you are using maven add dependency in pom.xml as said in another answer.

First you need to install TestNG from - TestNG P2 - https://testng.org/testng-p2-update-site. Steps are mentioned below:-
Launch Eclipse and go to Help option present at the top and select -"Install New Software".
A new dialog box will appear. Mention Name as TestNG and location as "http://beust.com/eclipse/" and click on Add button.
This time we will see TestNG added in Install dialog box.
Once the installation is completed, you will get a message to Restart the Eclipse and select to Restart the Eclipse.
You are all set. In case you want to know more about TestNG, you can refer this link.

Related

TestNG options not display in Run As in eclips even I added Test NG Jar

I have added testng-7.4.0.jar in my project as external jar but I am not getting TestNG as options to run the program under run as in eclipse . I can see TestNg jar present in Referenced Libraries
I tried this in both version of eclipse oxygen and Neon
enter image description here
Install Testng plugin from eclipse market place and restart the IDE. And when you run it for the first time configure the run with run configurations.
You must have TestNG.xml file configured to run in eclipse.

how to import cucumber eclipse plugin manually?

I couldn't install cucumber eclipse plugin from "http://cucumber.github.com/cucumber-eclipse/update-site
" from Help--> Install New software because of firewall restriction.
Can anyone provide the jars for recent cucumber eclipse plugin and provide the steps to manually add them to eclipse please ?
This website might be helpful for you:
http://toolsqa.com/cucumber/download-cucumber-jvm-eclipse/
There are 3 options available:
1. Download Cucumber Jars from Online Maven Repository
2. Download Cucumber Jars from oss.sonatype.org
3. Download Cucumber Jars from Maven dependencies
All of them are detailed on the website.
Hope it helps!

Installation issues on TestNG?

I have tried to install TestNG in eclipse Help--> Install new software http://beust.com/eclipse
I am getting following error:
Unable to connect repository http://beust.com/eclipse/content.xml
So I have downloaded testng-6.8.6beta.zip and imported those jars in Build Path and added Junit 4 library.
Still when I click Run As in the class (Test case) it does not show me Run As TestNG, shows only java application.
Am I missing anything?
You can try the following:
Open Eclipse -> Help -> Eclipse Marketplace.
and trying installing testNG plugin after searching it.
Try:
Open eclipse
Help > Install new software
Enter the update site URL in "Work with:" http://beust.com/eclipse/6.9.12
Click on ok
Edit:
Just click on http://beust.com/eclipse - it'll show you all the versions available.
Then Add the URL to work with as http://beust.com/eclipse/version_number (like the example given above)

how to work in selenium with testNG in Netbeans IDE?

I am new in automation testing. I know that how to configure testNG with eclipse IDE but I did not get that how to configure testNG with netbeans IDE.
I have already included selenium webdriver library files in netbeans.
can anyone help me?
Thanks
Rohit Joshi
Download latest version of NetBeans
Download the TestNG plugin for NetBeans
If you are going to use Maven then get the TestNG Maven plugin for NetBeans
Start NetBeans IDE and go to Tools -> Plugins
NetBeans IDE
Go to Downloaded tab and select Add Plugins
Navigate to the location on your hard disk where you have saved the .nbm file and select it and click Open
The plugin is made visible in the Downloaded window
Select it and Install
There it is!! You are now privileged to use TestNG with your NetBeans.
To use TestNG, right click anywhere in the editor window and you can see TestNG. Mouse over it and create Test using TestNG.
You can also visit the following link https://netbeans.org/kb/docs/java/testng-screencast.html

Build selenium-server-standalone executable jar

I did a patch in the HtmlUnitDriver.java file, as explained here:
Is it possible to ignore JavaScript exceptions when working with WebDriver (HtmlUnit, Ruby bindings)
I've followed the explanations on the selenium build wiki and in the readme, also the tip given here:
Building the Selenium Server Project
Still, I don't have a jar file like selenium-server-standalone-2.25.0.jar which can be run and used as a headless browser for selenium tests.
... So I'm trying to recreate the selenium-server-standalone-2.xx.jar file with my patch, and use it to run my headless tests.
Can anyone explain to me how to do this? Thanks!
The best way I found is to do:
go //java/server/src/org/openqa/selenium/remote/server:server:uber //java/client/src/org/openqa/selenium:client-combined:uber
This will create a single jar for the selenium server
Then run go release.
The resulting .jar should be found in build\dist folder of the selenium source folder. (ex. ./build/java/server/src/org/openqa/grid/selenium/selenium-standalone.jar)
See also https://github.com/SeleniumHQ/selenium/wiki/Building-WebDriver#tips.
Here is a step by step building guide for selenium standalone server. The build process of selenium projects may be not so strait forward to newbies, so I recommend this detailed guide on how to create a runnable standalone jar.
http://shengwangi.blogspot.com/2014/08/how-to-build-selenium-from-source.html
Also you can refer to the official document on build selenium.
https://code.google.com/p/selenium/wiki/BuildingWebDriver#Building_Selenium_Server