Monday, 20 October 2014

Reducing Test Automation cost while maintaining the efficiency

With the increasing competition in software development industry, Organizations are looking for the proof solutions to keep up themselves parallel or ahead of their competitors. So to be in the competition companies need to be equipped with latest technologies and other resources and it will cost a lot of investment in terms of money, setup etc.

After all these challenges many Researchers and Engineers are continuously working to develop such things that can reduce cost & risk and maximize the efficiency. From the past few years the concept of virtualization and cloud-based infrastructure has played a major role to cope up with these challenges.

Nowadays, Organizations are adopting virtualization and cloud-based infrastructure to reduce the cost and scale up the efficiency. Now coming to the point, Virtualization and cloud-based infrastructure can scale the test automation by reducing the physical hardware required to setup a test environment. With the amalgamation of these technologies we can test web application on a variety of browser, device and operating system combinations.

Selenium Webdriver has unrivalled support for testing web application in virtual environment, executing test in parallel, maximizing speed, coverage and minimizing the cost. In this post we will see how to accomplish this by using Selenium Webdriver.

Selenium Grid allows us to execute multiple instance of Webdriver or RC driver in parallel which uses same code base, and controls all the test cases running on virtual or distributed systems. Selenium Grids comprises of Hub and Nodes.

Hub: It can be considered as a server / a central point that will receive all test requests and will distribute to appropriate nodes / clients based on the configuration settings.

Nodes: Nodes are the client machines (either physical or virtual) connected to Hub which creates instances of Webdriver to execute the tests.



Implementation of Selenium Grid:

Download “selenium-server-standalone.jar”.

Configuring Hub

Start the Hub using following command:

java -jar selenium-server-standalone.jar -role hub







By default it will start automatically on port 4444. If port is unavailable the user can set by adding it to the command:

java -jar selenium-server-standalone.jar -port 4343 -role hub

Now, verify the hub has started by launching it on browser:

http://localhost:4444














Click on console link and then on view config link to see the configuration:





















Configuring Nodes

Now place the “selenium-server-standalone.jar” on node machines and start node using following command:

java -jar selenium-server-standalone.jar -role node -hub http://localhost:4444/grid/register







After registering the node again view the configuration on Hub:















As you can see in the above image that node has been registered with the hub and Browser support and configuration detail is available to user.

Now all the configuration part has been completed so we can start writing our test cases and executing it on the registered nodes.

Script Creation

Create a project in any IDE you like. Find the sample code below:


















After running the test script you can check session created for all the running nodes by launching the following:
http://localhost:5555/wd/hub








Stay tuned to see more updates.

No comments:

Post a Comment