14Apr
Automation Testing with Selenium WebDriver

Description

Creating automated tests for any web application is a challenge for everyone. People also charged with testing applications to keep pace with new features while balancing the need for integration and regression tests.

By applying test automation, lead times for regression tests can be seriously decreased while improving the accuracy and consistency of them. Two of the biggest barriers to getting started are picking an automation tool and developing a framework for writing the tests.

Difference between Selenium WebDriver and Selenium-RC

Selenium WebDriver uses each browser’s native support for automation and makes direct calls to the browser. How these direct calls are made, and the features they support, it’s all depends on the browser you are using. You can learn information on each ‘browser driver’ in the course.

  • Selenium-RC: It uses Javascript to drive the web page and it runs inside the Javascript sandbox.
  • Selenium WebDriver: It uses native automation, which is less prone to errors and faster also. But this is supported by fewer browsers.

For those who are familiar with Selenium-RC, this is one quite different from what you have used too. Selenium-RC works in the same way for each supported browser. When the browser was loaded, it ‘injected’ javascript functions into the browser and then used javascript to drive the AUT within the browser. But the WebDriver does not use this technique.

Setting Up a Selenium WebDriver Project

Installing a Selenium means, you are setting up a project in a development so that you can write a program using it. How you do this depends on your development environment and your programming language?

Java

The easiest way to install a Selenium 2.0 Java project is to use Maven. Maven will download the Java bindings and all its dependencies and will create a project for you, by using a maven pom.xml file. Once you have done this, you can now import the maven project into your preferred IDE, Ellipse or IntelliJ IDEA.

Before starting, create a folder to add your Selenium project files. Then, you need a pom.xml file to use Maven. This can be created with a text editor. We won’t give the details for using Maven. Your pom.xml file will look something like this. Create this file in the folder you created for your project.

?

Be sure you specify here the most current version.

Now, copy CD into the project directory and run Maven from a command line.

This will download Selenium and its’ all dependencies and will also add them to the project.

Then, import this project into your preferred developed environment.

C#

In Selenium 2.2.0, the C# bindings are distributed as a set of signed DLLs along with other DLLs. Before 2.2.0, all selenium DLL’s were unsigned. In case, if you’re using Windows Vista or above, you’ve­­ to unblock the zip file from properties before unzipping it.

Unzip all the contents of the zip file and add a reference to every unzipped DLL to your project in Visual studio or any other to your choice.

Python

If you’re using python for test automation then maybe you are also familiar with developing with python. To add Selenium to your python environment, run the following command from command line.

Pip install selenium

Pip requires pip to be installed and it also has the dependency on setup tools.

PHP

These bindings are provided by third-party, you’ve to refer to their documentation on how to get started/install.

JavaScript

If you use node.js for developing your applications, the selenium project provides you Javascript bindings on npm.

Install the Javascript bindings with npm by running the following command on any command-line:

npm install selenium-WebDriver

Software Automation Framework Support Engines

You can take some general-purpose tools and apply them to any specific keyword-driven engine implementation. You can migrate from one automation tool to another, or even can use various automation tools simultaneously. E.g. you could use Selenium WebDriver and IBM Rational Functional tester at the same time.

The list of the implementation tools currently supported is as under.

  • · Selenium WebDriver
  • · Android Test Automation
  • · IBM Rational Functional Tester
  • · IBM Rational Robot
  • · Smart Bear Test Complete

Final Thoughts

  • · Selenium WebDriver is a powerful test tool to conduct Functional and regression testing. Selenium is open source software which supports various programming languages, Browsers, and operating Environment.
  • · Selenium WebDriver can also use to conduct Batch Testing, Data Driven Testing, Cross Browser Testing, and Database Testing.

?