Home > Jenkins, Selenium, WebDriver > WebDriver integration with Jenkins

WebDriver integration with Jenkins

WebDriver integration with Jenkins using Maven build tool.

Preconditions :

1. Jenkins should be up and running – http://jenkins-ci.org/

2. Java and Maven should be installed

Through this post, I am trying to say how you can easily integrate WebDriver tests[Java] on Jenkins using Maven build tool.

  1. First Things First – Run Tests on Local First
  • Folder Structure

Create folder structure like below







  • pom.xml

pom.xml file is the basic building block of Maven. Here is a sample pom.xml file for a webdriver test that uses Webdriver latest version and Junit 4.11 version.

<?xml version=”1.0″ encoding=”UTF-8″?>

  • Selenium Scripts

Put your selenium scripts in Java folder [/ProjectName/src/test/java]

  • Run Tests from Terminal

Open Terminal and navigate to Project path [cd /Users/anoop/ProjectName]

type ‘mvn test’ and enter

Now you can see your tests are running and you can see results after tests finishes.

Running wpTrialTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 13.261 sec

Results :

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] ————————————————————————
[INFO] ————————————————————————
[INFO] Total time: 17.855s
[INFO] Finished at: Tue Aug 27 13:11:00 EDT 2013
[INFO] Final Memory: 7M/134M
[INFO] ————————————————————————

  1. Integrate with Jenkins

Tests are running fine on local machine using maven build now so its time to move those tests to a continuous integration server.

  • Create a “Build a free-style software project Jenkin Job.
  • Configure newly created job.
  • You can mention your source code using any available version management system[Git, SVN, CVS etc]
  • Also you can run Jenkin job against your local directory.
  • Select ‘Invoke Top-Level Maven-targets’ from Build dropdown box.
  • Enter ‘test’ as Goals
  • Save the configuration.
  • Run the Job


To setup a local working copy as source, you have to run the jenkin Job first without mentioning any source and that build will fail because there is no sources in Jenkins workspace. After first build Jenkin will create a work space for current Job. You can identify that path by checking Jenkins Job Console output. Copy all you data under your project directory to Jenkins workspace and run the Job again. Now you can see tests are running.


This post is only for beginners those who trying to integrate webdriver with Jenkins. There are lot of plugins available on Maven so you can customize you build process as you required.

  1. sk
    September 26, 2013 at 9:28 pm

    good article…good approach for quick testing..i prefer this without the intervention of java ide as time constraint always there.

    any idea how to extend your appraoch with kinda reporting.

    see link http://seleniumregressionproject.blogspot.co.uk/2013/03/taking-screenshots.html

  2. January 31, 2014 at 2:48 am

    I am new to Selenium and Automation. I have created a Java Project that contains Junit file that was exported from SE IDE. It works fine when I run it thought eclipse. How can I configure my program to fit this tutorial. If my understanding is correct I created a new maven project in eclipse, and created a new java file in the src/test/java directory. When I go to that directory and type mvn test, it always says build success (even when I purposely mess with code to fail). I am not sure what I am doing wrong. If you can please contact me that would be fantastic!

  3. July 5, 2014 at 3:44 pm

    There is certainly a lot to find out about this issue.
    I really like all the points you’ve made.

  4. July 30, 2014 at 10:49 pm

    What’s up to every body, it’s my first go to see of this webpage;
    this weblog carries remarkable and really fine material
    in support of visitors.

  5. July 31, 2014 at 5:23 pm

    Wow that was strange. I just wrote an incredibly long comment but after I
    clicked submit my comment didn’t appear.
    Grrrr… well I’m not writing all that over again. Anyhow,
    just wanted to say wonderful blog!

  6. August 8, 2014 at 8:53 pm

    Perform An Online Attorney Search When You Need
    Tofind a lawyer. Any skilled personnel knows the tricks
    of the trade and have a full knowledge of the rules.
    Finally, he filed a law suit against the car driver, the drivers insurance company, the motorcycle manufacturer and others.

  7. August 9, 2014 at 7:28 pm

    If the costs of parts, labor, and rental expenses exceed the actual cash value of your vehicle, the insurance
    company typically totals the vehicle. Our last group includes helpful
    posts on lemon laws when you buy a car along with tips
    for understanding your rights as a consumer. The Universal Technical Institute has become one of the leaders in providing automotive related education for young students
    interested in learning the “ins” and “outs” of the automotive repair industry.

  8. October 15, 2014 at 9:49 pm

    May I simply say what a relief to find an individual who really
    understands what they are talking about on the internet.
    You certainly realize how to bring a problem to light and make it important.

    A lot more people really need to look at this and understand
    this side of your story. It’s surprising
    you are not more popular given that you most certainly possess the gift.

  9. October 16, 2014 at 1:02 am

    Hi there, of course this piece of writing is really
    fastidious and I have learned lot of things from it
    about blogging. thanks.

  1. September 2, 2015 at 6:56 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: