Archive

Posts Tagged ‘webdriver’

WebDriver integration with Jenkins

August 27, 2013 10 comments

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

ProjectName

pom.xml

src

test

java

YourTest.java

  • 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″?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>anoop.philip</groupId>
<artifactId>web-driver-jenkins-integration</artifactId>
<version>1.0.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>LATEST</version>
</dependency>
</dependencies>
</project>

  • 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.

——————————————————-
T E S T S
——————————————————-
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] BUILD SUCCESS
[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

Image

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.

P.S

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.

Basic Selenium Intro..

February 10, 2011 5 comments

Selenium

Now a days ‘Selenium’ is common and popular world in software testing field.  Selenium is package of web application testing tools developed by thoughtworks. Popular tools in the Selenium package are

  • Selenium IDE
  • Selenium RC
  • Selenium Grid
  • Selenium 2 and WebDriver

Selenium IDE

I think, it is most popular tool in the selenium package because of its ease of use. Its an Firefox addon. We can easily installed as Firefox plug in on and record and playback web applications. Most importantly there is no need for technical background for using Selenium IDE.

For more info

Selenium RC

If the application under test is some what complex, Selenium RC comes into play. Because we can not do complex logics in Selenium IDE. Main thing regarding the Selenium RC is that we can create our test scripts in any language[java, php, c#, ruby, python etc] and run it on any java script enabled browsers [fire fox, Internet Explorer, Safari, Google Chrome]

For more details

Selenium Grid

Consider a test application that have hundreds of tests to run for every regression[or every day], how can we manage since running those many scripts in Selenium RC takes hours and hours to execute. To over come this situation Selenium Grid is the option. Selenium Grid executes the tests parallel and saves lot of time. And also we can run tests in multiple machines and browsers at same time.

For more details

Selenium 2 and WebDriver

This is developed to overcome some limitations of Selenium 1[RC]. It does not depend on a javascript core embedded within the browser, therefore it is able to avoid some long-running Selenium limitations. Developers proposed this tool for using following conditions :

  • Cross domain testing
  • Handling multiple frames, multiple browser windows, popups, and alerts.
  • Drag-and-drop.
  • AJAX-based UI elements.

In addition to above listed tools, there are some other tools also coming from Selenium family

  • Selenium Core
  • Selenium on Rails
  • Selenium on Ruby
  • Cubic Test
  • Bromine

References

http://seleniumhq.org/docs/01_introducing_selenium.html

http://seleniumhq.org/projects/

%d bloggers like this: