Cloud Test Automation Using Selenium

Cloud Test Automation Using Selenium

150 150 VOLANSYS

Cloud Testing is a means of testing cloud-based applications that use resources found in the cloud. By resources, we mean any element (hardware, software, and infrastructure) necessary to carry out the tests. Cloud testing provides an end-to-end solution that transforms the way testing is done and can help an organization boost its competitiveness by reducing the cost of testing without negatively impacting mission-critical production applications. By leveraging a cloud computing solution for testing, organizations can shorten provisioning time because the cloud enables provisioning of test servers on demand. This helps ensure unused servers are not sitting idle. Generally, more than 80% of the validation processes are repetitive, with testers performing same testing steps manually in each new build.

  • Why Selenium?

The reason for the popularity of Selenium can mainly be attributed to the flexibility and perfection achieved through the tools it offers. It is compatible with a wide variety of browsers and offers great flexibility to write text scripts as well. Furthermore, Selenium provides robust support to a variety of programming languages, including C#, Java, Python, and Ruby. Even just a basic knowledge of any of this language is enough to work with Selenium. Here below we would have a look at the key benefits of the tool.

  • Cost effective: It is an open source tool
  • Language: Supports many languages like Java, Ruby, and Python and C #
  • Browser: Supports multiple browsers like IE, Mozilla, Opera, Chrome, and Safari so can be used for cross-browser testing and can be integrated easily to the newly launched browser
  • Framework: Supports multiple frameworks like Junit, TestNG, Bromine, Nunit, Rspec which make the automation more robust and can developed own framework
  • Operating System: Supports multiple operating systems like Windows, Mac, Linux
  • Time-Saving: With the help of selenium grid, parallel execution of the test cases can be done
  • Cloud Automation Testing Using Selenium

Today’s software applications are mostly web-based and with the cloud infrastructure gaining prominence, they are mostly deployed on cloud servers.

Selenium is unarguably the most widely used open source solution to meet the needs of your testing project. Selenium can be successfully used with cloud services to test web apps across multiple browsers and platforms. Selenium interacts with web browsers to test actions, inputs and expected outcomes to improve device and platform coverage.

  • VOLANSYS Automation Framework for Cloud Testing

Automation framework is a strategy for the automation, it provides the structured way for the automation for obtaining the quality work with quantity and effectiveness. There are many predefined frameworks in Selenium like JUnit, TestNG, NUnit etc.

VOLANSYS has carried out comprehensive analysis on different Selenium automation framework and found that none of them offered a complete benefit. Hence, VOLANSYS has developed a Data-Driven Framework for an end to end solution for cloud automation testing.

  • VOLANSYS Selenium Data Driven Framework Approach

VOLANSYS Selenium Data Driven Framework is an implementation of function modularization and abstraction layer. It’s an excel based automation framework. It has 3 layers:

  1. External Layer (Test Case Layer)
  2. Application Function Layer ( It consists application-related functions)
  3. Framework Layer (It consists core framework functions)

In VSDDF, all the test cases will reside in the external layer and call the function from Application Function Layer and it will invoke framework layer function. This framework is an excel based and all test cases and test data will reside in single excel file which makes this framework easier to manage it. The user can choose test cases which they want to execute it from Excel file and also can provide their test data into this excel.

In VSDDF, we have kept all object repository to property file which can be read at the run time so it makes easy to maintain element locators. Similarly, there is a property file for configuration related data.

We have integrated this VSDDF with continuous integration tool Jenkins and Source Code Management tool Bit Bucket (Git).

  • Automation Framework Flow

  • Features of VOLANSYS Selenium Data Driven Framework
  • Works extremely powerful with different browsers such as Mozilla, Chrome, and Opera etc.
  • VSDDF is a maven based framework so the user does not worry about dependency management
  • Execution can be triggered at one click either from Jenkins/locally
  • Execution can be triggered automatically using Jenkins when any changes are done on BitBucket/Git code
  • VSDDF provides a feature for uploading test result to Test Rail (Test Management tool) using Test Rail APIs
  • Detailed Report generation includes application logs, line and bar graphs, platform details, test execution details such as the number of passes, the number of fails, total Test cases, each test case with line by line test steps, screen shot at the time of failure etc
  • Benefits of Selenium Data Driven Framework
  • Since scripting is done with Excel, it is simple and easy to create test cases. Even a manual tester can write test cases once he knows about customized methods and how to trace elements from the application
  • Manual test cases and Automation test cases can be maintained in the same sheet
  • Highly productive and scalable
  • Cost effective since it reduces man efforts
  • Return on Investment (ROI) using Selenium Data Driven Framework
Before implementation of Selenium After implementation of Selenium
Total Test cases: 130 Total Test cases: 130
Time to execute test cases: 10 hours Time to execute test cases: 3.5 hours
  • Challenges Faced During Implementation
  • The web application is built using AngularJS so the majority of the time we were not able to get unique locators
  • Extracting data from web-table was difficult due to the developer has implemented slick-grid for lazy loading
  • Some of the element was not getting identified at run time because it was created at runtime with dynamic locator values
  • Data Import related test scripts were getting failed due to interactions with windows pop up
  • There are test cases failure due to radio button selection was not working as the developer has made radio button in such a way that selection was not permitted
  • Selenium Test Scripts were taking too much time to run it
  • VOLANSYS Solutions on Challenges
  • Unique locator problems: We use JavaScript executor where we could not able to find unique elements
  • Extracting data from Slick-grid: We used slick functions and java scripts to extract data from web-table
  • Dynamic Elements: We used regex and ancestor and sibling techniques to identify such elements
  • Data Import failures: We used Auto IT/Robot class in order to deal with windows pop up
  • Radio button selection problem: We worked closely with development team and identify actions which are being performed on click of the radio button and we called that functions using JavaScript
  • Selenium script performance issue: For this problem, we have done lots of R&D and implemented below things to improve performance
    1. Executing test script that will check data dependency only once and resolve data dependency
    2. We have used fast locator wherever possible
    3. We have grouped test cases according to business functionality
    4. We have eliminated static wait wherever possible
    5. We have changed test execution flow and it significantly improves execution timings
  • Conclusion

Using Selenium as a functional testing tool we have significantly reduced the test execution timing as well as manual repetitive efforts. Selenium is an open source automation tool so it has saved the cost incurred for licensing tools like HP UFT (Unified Functional Testing).

About Author: Sagar Bhatt

Sagar is associated with VOLANSYS Technologies as a Senior Engineer and having thorough experience in Automation Testing using Selenium, Appium, and UFT (Unified Testing Tool). He possesses a vivid knowledge of core JAVA, TestNG, Jenkins and VB Scripting. Reach him out on LinkedIn