The Anatomy of Darwinbox’s Automation Testing Ecosystem

Darwinbox
Tech@Darwinbox
Published in
6 min readMay 26, 2020

--

We at Darwinbox use automation testing primarily for regression and sanity re-testing. But before we dive into our applications for it, we wanted to answer some preliminary question first, such as - What is automation testing? What are its benefits? And lastly, what are the different tools and platforms available for automation testing?

A Brief Intro to Automation Testing:

Automation Testing is a technique in software testing that makes use of special software tools to control the execution of tests and then compares actual test results with predicted or expected results. It is used to automate repetitive tasks and other testing tasks which are difficult to perform manually.

Benefits of Automation Testing:

Traditional Manual testing can be time-consuming and cost-intensive. Automated tests, on the other hand, can be developed as a one-time activity, in order to avoid all manual interventions in the future. Automation tests can run independently once developed, and can, therefore, help significantly improve the speed of testing as well as the test coverage.

There are several automation testing tools and frameworks available in the market such as:

  • QTP: QTP is a functional testing tool developed by HP, which is best suited for regression testing of the applications. It is a licensed/commercial tool and is one of the most popular tools available in the market. It compares the actual and the expected result and reports the results in the execution summary.
  • HP Runner: LoadRunner is a software testing tool developed by Micro Focus. It is used to test applications, measure system behaviour and improve performance under load. LoadRunner can simulate thousands of users concurrently using an application software recording and later analyzes the performance of key components of the application. LoadRunner simulates user activity by generating messages between application components or by simulating interactions with the user interface such as key-presses or mouse movements. These messages and interactions can be generated and stored within the scripts.
  • Selenium: Selenium WebDriver tool is used to automate web application testing to verify that it is working as expected. It supports several popular browsers such as Firefox, Chrome, IE, and Safari. It also supports different programming languages such as C#, Java, Perl, PHP and Ruby for writing test scripts. However, since it can be used for testing for web applications only, it cannot qualify for window-based applications. Selenium Webdriver is platform-independent since the same code can be used on different operating systems like Microsoft Windows, Apple OS and Linux. It is one among the components of the Selenium family, which also includes Selenium IDE, Selenium Client API, Selenium Remote Control, and Selenium Grid.

Building a Plug-and-Play Ecosystem for Testing at Darwinbox:

At Darwinbox, the scope of the application and the underlying modules is enormous, lending reliance on manual testing infeasible. Since most of these tests are repetitive in nature with large numbers of test cases, we automated our test suite to improve accuracy while also reducing manual intervention. Automation is primarily used for regression and sanity re-testing.

We use a Hybrid model of a module-based framework and a data-driven framework allowing us to leverage the best benefits of most automation testing frameworks. Some of the benefits of our hybrid model are:

  • The testing pattern can be made up of a number of reusable modules
  • Improved and effective test design, execution, and traceability
  • Enhanced speeds for the test performance
  • A system or platform-independent framework

Different tech tools used for automation testing at Darwinbox are:

  • Java
  • Selenium
  • HTTPClient
  • GitHub
  • Jenkins (Weekly and Custom Triggers)

Automation Testing Process Flow:

Automation Testing Process Flow
Automation Testing Process Flow and Architecture at Darwinbox

Using the tech tools mentioned in the previous section, we have created an automation testing architecture or process flow that we use internally. Here’s a step-by-step walkthrough of the same:

  • Git Repository: Repositories in Git contain a collection of files of various versions of a project. These files are imported from the repository into the local server of the user for further updations and modifications in the content of the file.
  • Jenkins: Jenkins is a powerful application that allows continuous integration and continuous delivery of projects, regardless of the platform it is being worked on. It is a free source software that can handle any kind of build or continuous integration. It can be integrated with a number of testing and deployment technologies. We use Jenkins to build and test our software projects continuously.
  • Maven: Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information. Using Maven we can build and manage any Java-based project.
  • TestNG Framework: TestNG is a testing framework. It structures, groups, and launches tests. It also generates testing reports. It manages all the dependencies and different flows for building a project.
  • Automation Scripts: An automation script consists of a launch point, variables with corresponding binding values, and the source code. One can use wizards to create the components of an automation script. You can create scripts and launch points or simply create a launch point and associate it with an existing script.
  • Apache POI Library: Apache POI is a popular API that allows programmers to create, modify, and display MS Office files using Java programs. It is an open-source library developed and distributed by Apache Software Foundation to design or modify Microsoft Office files using Java programs.
  • Data Excel File: File IO is a critical part of any software process. We frequently create a file, open it & update something or delete it on our computers. Same is the case with Selenium Automation. We need a process to manipulate files with Selenium. Java provides us with different classes for File Manipulation with Selenium. We can read and write on Excel files with the help of the Java IO package and Apache POI library.

A Use Case of Automation Testing at Darwinbox:

Darwinbox’s Leave Module that is used by employees is a prime use-case of how automation testing can be leveraged.

The logic used for Darwinbox’s Leave Module

Let’s break this down:

Each employee is of a different Employee Type within the system. Different Employee Types, in turn, have different types of leaves and allotted numbers of each assigned to them.

So first we first collect all the details of the employee such as Employee Type, Designation, Probation period, etc. Next using automation testing we check if the said employee has un-used leaves available that he/she could apply for.

Next, we check if the employee is permitted to apply for half-day leaves. If Yes, then the employee can apply for a half-day leave, if No then s/he can only apply for full day leaves.

Using automation testing, all these test cases are tested in barely any time.

Some Common Challenges We Solved For:

a. Improving Testing Speeds: Since we are also creating test data at runtime, the test data setup itself was taking up the majority of our time instead of the actual test code that needed to run.

In order to reduce the time taken we replaced the UI Selenium Calls with API/HttpClient Calls instead. This not only improved our testing speeds from 2 hours to just 10 mins but also made our enhancements a lot simpler.

Here is a code snippet which completes the form waiting for ajax calls and saves a single policy with 175 fields in just 2 mins with the UI Call:

new CreateManageLeavesPage.createLeavePolicy ()

The same policy can be created with the createPolicy Service in just 3 seconds. Since this is just a test data setup, we don’t need to worry about the policy validation:

new LeaveService().createLeaveForPolicy(request,leaveBalancePolicy);

b. Having multiple Parallel Executions within the same Instance: Since a few of our modules are dependent on time change it is practically not possible to use multiple parallel executions within the same instance.

However, since browser initialization was time-consuming whenever a test would get executed, we reduced the initialization time by clearing the cookies every time a test gets completed thus also making tests independent.

That’s all for now, watch out for more on all things Tech at Darwinbox!

~ Written by Sandeep Kumar Doddi, Product Testing Lead at Darwinbox

--

--