Skip to main content
search

© 2021 Excellerate. All Rights Reserved

AutomationTesting and QA

Synerzip Test Automation Framework

By April 22, 2016February 21st, 2022No Comments

Introduction
Synerzip has developed a Java/Selenium/TestNG/Maven based framework to automate test cases for Web Applications. The framework is application agnostic and can be used to automate any web application. It provides Separation of Concerns by keeping page interactions, test logic and framework infrastructure separate.
Synerzip Test Automation framework is available as an open source framework and has been added to the github repository.
Framework Features
The Test Automation framework has following features:
Page Object Model
To abstract page interaction, there is a well-defined design pattern called Page Object which encapsulates page elements and provides a public interface of interactions that a user can have with that page. For example, Login Page can have interaction of logging in a user.
Base Test Case
TestBase is an abstract base class from which all the tests could be derived. It implements a singleton pattern where initialization happens only once and is shared across all the test case objects. This class initializes WebDriver (browser instance), configuration, test data, database connection, logs, etc. It also includes common methods which are to be run before and after every test case/suite.
Base Page Object
PageBase is an abstract base class from which all the page objects could be derived. It provides a default constructor and some common wrapper methods to write the interactions.
Environment Configuration and Test Data
There is a provision to read configuration & test data for different environments by specifying a simple flag. There is a file env.conf. Just mention the [env] like local/test/staging/production, and corresponding config config_[env].properties and test datadata_[env].properties file is loaded. The configuration includes any environment-specific configuration, such as base url for the application, credentials for application users, browser type or database credentials. The test data file is used for light-weight test data, which could be used in test logic; but, it is not a substitute for heavy data, which should be handled using a data provider.
Local vs. Remote
It is possible to run the automation with browser being launched local or remote. This is required when specific OS x browser combination is not available locally. For this, provide the URL of the Selenium server (HUB) which has such a required OS x browser combination attached to it. There are cloud-based service providers, like SauceLabs, BrowserStack, etc., that host such a HUB and provide browser automation on demand.
Browser Support
There is support to initialize any of these browsers – Firefox, Chrome, IE or Safari – by specifying it in the configuration file. The Firefox driver has Selenium built-in, so it doesn’t have a separate driver. For IE, Chrome or Safari, we need external driver executables to drive them. These could be stored inside the driver/ folder structure appropriately and copied to system PATH to be executed by Selenium.
Database Connection
There is a way to initialize a database connection through JDBC. This facility helps to run any integration tests, such as verify a form submission entered into database. Database connection URL and credentials can be specified in a respective configuration file. There is also a library included called “squiggle” which helps to build SQL queries elegantly.
Utility Methods
There are utility methods provided for the following:

  • Reading a CSV which could be fed to a data provider
  • Taking screenshot and re-initializing the browser for further tests

Mode of Running
There is a way to specify the mode of running – debug or production in cofing_[env].properties.
Debug run is supposed to be attended which, by default, will not quit driver and take screenshot on test failure.
Production run is supposed to be unattended and take diagnostics actions, such as taking a screenshot and re-initializing the browser for further runs.
Handing OS Dialog
There is a an AutoIt script/executable provided to handle file open dialog on Windows.
Library Dependency Management
The framework is based on Maven, a project lifecycle management tool, which takes care of resolving library dependencies, but automatically loads them from a local or a remote repository. Any update in Selenium or the driver due to browser update needs to be mentioned by the version update in pom.xml, instead of physically downloading the libraries and updating build paths.
Architecture
The architecture of this framework is illustrated below:
Architecture-TestAutomation
Why a Framework is Essential?
It is essential to develop your test automation code around a framework; otherwise, it could run into unmanageable code base, where most of the time is spent fixing the tests rather than actually running and getting useful insights out of it.
This Synerzip test automation framework is aligned towards this goal and could be used by any team to kick-start their test development and extend it according to their needs.
Useful References