Showing posts with label junit. Show all posts
Showing posts with label junit. Show all posts

How to setup Selenium WebDriver with TestNG, JUnit, Maven & ReportNG in Eclipse

I have seen this question posted in many forums "How to setup Selenium WebDriver with TestNG" or just "How to setup Selenium WebDriver in Eclipse", and I have also seen many good articles suggesting step by step information on how to setup Selenium 2.0 (WebDriver) with Eclipse but never seen some directly providing Java project with all the details.

I have tried creating one simple setup which includes Eclipse and with Selenium 2.0 WebDriver Java project. Java project has following plug-ins installed, you can use them as per your requirements in your test automation project.

Zip includes following:
  1. Eclipse IDE for Java and DSL Developers - Downloaded it from eclipse.org, and it has following plugins already added.
    1. Maven 
    2. TestNG 6.1.
  2. Java project with following libs added in Maven pom.xml
    1. Selenium 2.0 (Java WebDriver) 2.44.0
    2. JUnit 3.8.1
    3. ReportNG 1.1.4 
    4. Guice 3.0
If you want to use some other eclipse version and if you want similar setup for that eclipse version then please let me know, I will be very happy to provide / build setup for you.

To Download SeleniumWebDriver_With_Eclipse.zip with all above mentioned plug-ins & Java Project, please click on below image.

How to use ReportNG with TestNG for HTML Reporting

ReportNG is Open Source software, free to download and use subject to the terms of the Apache Software Licence, Version 2.0. 

ReportNG is a simple HTML reporting plug-in for the TestNGunit-testing framework. It is intended as a replacement for the default TestNG HTML report. The default report is comprehensive but is not so easy to understand at-a-glance. ReportNG provides a simple, colour-coded view of the test results. 

ReportNG generates 100% valid XHTML 1.0 files. The output can be customised by over-riding the default stylesheet with your own CSS file.

In this article we will learn how to integrate ReportNG with TestNG.

A. Before we start integrating ReportNG you will need three libraries as follows.

  1. reportng-1.1.4.jar
  2. velocity-dep-1.4.jar
  3. guice-3.0.jar
You have two options -
  1. Either download above three libraries and add manually to your class-path (in your eclipse or whatever IDE you will be using for your testing).
  2. Or add dependencies in Maven "pom.xml" file as shown below and build the project. I am not going to explain how maven works... I am assuming that whoever will be using 2nd option would know maven (this is the recommend option).
    <dependency>
        <groupId>org.uncommons</groupId>
        <artifactId>reportng</artifactId>
        <version>1.1.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.google.inject</groupId>
        <artifactId>guice</artifactId>
        <version>3.0</version>
    </dependency>

Related Posts Plugin for WordPress, Blogger...
Powered by Blogger