Selenium Test Automation: From the ground up

Ninety-nine percent of the software applications today run in the internet browser either in a laptop or on a mobile device. The efficiency of testing such applications widely varies among organizations globally. In this digital era of highly interactive and responsive software applications, the organizations are forced to adopt some form of agile methodology making test automation a frequent need of the hour.

Test automation is all about employing an automated tool to run repeated tests against an application to be tested. Test automation has core advantages such as repeated regression testing, quick feedback to developers, No limitations on test case execution, supporting agile and many other development methodologies, clean documentation of test cases, bug reporting, highlighting defects that are missed in the manual testing.

There are many options available to support test automation. Out of many commercial and open source tools available Selenium is the most widely used open source tool for test automation. Selenium can be best defined as a combination of different software tools, with each of them having a different aspect to support test automation.

Selenium Implementation – An Example:

Consider a company that wants to implement an open source test automation solution from scratch using Selenium. Assume that the company had an existing automation framework which they need to migrate right away in couple of weeks. In couple of weeks they need to get everything up and going, while continuing to support the current framework. The only way to approach this situation is the scrum way.

Step 1: Selecting a language

Selenium WebDriver supports many languages like Java, C#, Ruby, etc., the first step is to pick a language implementation to use. Let us assume the language to be Java. Once the language is freezed the next selection of tools becomes easy.

Step 2: Selecting an integrated development environment for Selenium scripts

The company has an option to choose between NetBeans or IntelliJidea or Eclipse as integrated development environment for Selenium scripts. Eclipse was chosen as it had some nice plugins for other tools the company has been using like TestNG, Git, Maven, etc.

Step 3: Selecting a dependency manager

To set up a large scale test framework, the company will need to look out of the Selenium APIs and that’s exactly where the dependency manager comes into picture. The dependency manager will be able to automatically download the files the company project needs to build the project. There is a wide variety of tools available for dependency manager for the company to choose from for the java language like Maven, Gradle, Ant, etc. The company preferred to go with Maven as it is the most robust tool to handle the dependencies and is hooked with the other tools being used.

Step 4: Selecting version control management tool

The company made a choice to go with Git as their source code management tool for its complete development projects, as it is the most popular tool for open source projects and supports with plugins for most of the tools being used with Selenium.

Step 5: Selecting the right testing framework

The company needed a way to organize and create tests. There are many options available from the testing frameworks to choose from. On evaluating all the options the company decided to go with TestNG as it the most popular tool for java language. It is mostly Junit framework with additional functionality such as advanced reporting, data driven testing, strong execution model etc. Also it integrates well with Eclipse and Maven.

Step 6: Test execution & scalability

The simple setup of Selenium grid was put to handle test execution and scalability. All it needed is a set of virtual machines, with one of them serving as Selenium hub and rest of machines as a node to the hub. These machines supported all the 3 browsers (IE, Chrome & Firefox) needed to run the test execution on a single operating system. In future the company can scale up the grid with additional machines covering different operating systems and different browser versions.

Step 7: Hook into the continuous integration pipeline

On evaluation of all the options available, Jenkins has been picked up as a continuous integration tool for this project as it gave options to create Maven style jobs that aligned into Git (source code management tool selected earlier). Two Jenkins servers were set up – one to work with the company’s own test instance and second one to work with the instance that the developers used. This way the company has automated scheduled and not scheduled requests.

Conclusion:

After implementing the above steps the Company’s automated test suite was organized in 3 levels

  • Level A – Web services tests – verifying all the services that were automated were up and running
  • Level B  – Smoke tests – high level tests
  • Level C – Rest are all regression tests

This grouping of test suite has provided the options for the company starting first with web service tests, to see if any of the services were down after the build. After this the smoke tests get kicked off followed by the regression tests. Jenkins keeps a build history where all test results can be viewed and an email alert has been configured to let the company know when a build fails by including test run results

Overall we have covered with an example how a Selenium test automation can be set up in an organization.

Views: 434

Add a Comment

You need to be a member of Software Testing Club - An Online Software Testing Community to add comments!

Join Software Testing Club - An Online Software Testing Community

Adverts

© 2017   Created by Rosie Sherry.   Powered by

Badges  |  Report an Issue  |  Terms of Service