Skip to main content
Selenium Java Hybrid Framework

User Guide Document

Doris Sooläte avatar
Written by Doris Sooläte
Updated over 2 years ago

Overview

This Framework has been designed using the hybrid-driven approach by bringing together Data Driven and Keyword Driven concepts to have a more efficient framework that will be suitable to automate all web applications that are data-intensive or contain unique workflows. It has been integrated with other tools like Appium, Maven, and TestNG to further strengthen the capabilities that it renders to the users.

Architecture

Hybrid Driven Framework

Framework Components

Environment Data

All data related to the test environment like application URL, test credentials, framework control variables, variables that remain constant for the entire test execution, etc. will be provided in java’s native properties file. Each environment will have separate properties file with corresponding data and their location will be configured in pom.xml.

The relative path of these files are ‘src/main/resources’. Using Maven build profile option, the user has to select the environment which in the test execution has to be performed. Any number of configuration data and its value.

Configuration Data

Value

Description

Test path

Suite.xls

This has to provide in properties file to specify the test data name in driver

reports Type

2

To enable taking screenshot ,To Disable reportsType=1

screenshot Path

Results\\

To Store the screenshot in the specific folder

Browser

Chrome

To Specify in which browser we want to test the application

Driver path

C://downloads

To specify the downloaded driver path to the framework

onSuccessScreenshot

false

To enable taking screenshots on Success report

ApplicationUrl

<url>

AUT Url

Username

<username>

Login user name

Password

<password>

Password should be encrypted using the ‘Data Encryption, Tool

Object Repository

It is a collection of objects and their properties by which a test automation tool will be able to identify the objects in the application. All the objects are stored in the spreadsheet and named as ‘AppObjectRepository.xls’ and indeed the name is customizable. It has been referenced in the properties file with the key ‘testlibrary’.Separate sheets are maintained for storing object properties from different application screens. Say, an application consisting of five screens can have the properties stored in five sheets,

Column Name

Purpose

Element Name

Any unique name to represent application object,suggested standard to follow –<ScreenName_FrameType_ObjectType_Name>

Element Type

Locator Type Identified by tools say xpath,className,linkText

Value

Object properties recognized by locator type

Datasheet

All test data specific to various test scenarios have been stored in the datasheet. The file format used for storing this information in an excel spreadsheet and named ‘suite.xls’ . The name and path are customizable and ite references the property file using the key ‘testpath’.

It contains two categories - A list of modules/projects have been listed under the ‘project’ sheet and test scenarios corresponding to each module/project are maintained in separate sheets with the same name. Say an application consisting of three modules will have one ‘project’ sheet and ‘three’ separate sheets containing test case details. In Order to execute the test cases in the module, the user has to update it to ‘Run' mode in the project and test case sheet. Test data/parameters are added as columns in the test case details sheet. Following are the mandatory fields,

Column Name

Value

TCID

Numeric and Unique

Test Case

Java class name along with package full name

Status

Either ‘Run’ or ‘No’

<a href="https://lh3.googleusercontent.com/o6zslnkeZRlcKlvLh7YPXkZW7BYXB8PZGAKkUFcl8oQGVoL1bR7-KLY5-vs2RjjD7vTFup90JYlyBNLukPVfu88s0Qd2AQax1u5Vsem8k1mbMeaHPJnNRihZhIOi_CywKGP0Jl8Y" target="_blank" rel="nofollow noopener noreferrer">https://lh3.googleusercontent.com/o6zslnkeZRlcKlvLh7YPXkZW7BYXB8PZGAKkUFcl8oQGVoL1bR7-KLY5-vs2RjjD7vTFup90JYlyBNLukPVfu88s0Qd2AQax1u5Vsem8k1mbMeaHPJnNRihZhIOi_CywKGP0Jl8Y</a>

Datasheet - project

<a href="https://lh3.googleusercontent.com/5bdyN75RUU12Dn14mqtpe4C-WZbbNyoCeSK2HLg4Cejs7v1DwLSlQ98oIl_h10ftQ5gNCHpiQ_nW24TIJzDQKiyGK74NSlH5O-wPTuVWPEAwZ49hJvv5dIMPfCThWIIOD8bq-xhP" target="_blank" rel="nofollow noopener noreferrer">https://lh3.googleusercontent.com/5bdyN75RUU12Dn14mqtpe4C-WZbbNyoCeSK2HLg4Cejs7v1DwLSlQ98oIl_h10ftQ5gNCHpiQ_nW24TIJzDQKiyGK74NSlH5O-wPTuVWPEAwZ49hJvv5dIMPfCThWIIOD8bq-xhP</a>

Datasheet - test case details

Suite Executor

It is the main script that triggers the test execution and has name it as ‘SuiteExecutor.java’. It loads all objects properties from the object repository sheet, modules, and corresponding test cases to be executed from the datasheet based on ‘Run’ Mode. It creates the testing.xml programmatically, builds into suite and class files, and triggers the test execution. The user has to always start running the script from here.

Supporting Packages

Drivers

This framework utilizes TestNG Framework capabilities of Annotations to perform initialization/pre-requisite setup or termination/post-execution activities. Usage of Annotations is a way to define the order and any dependency of execution. Some of them are WebDriver initialization according to the browser option in the properties file, HTML report header creation, loading test data specific to the test case, HTML report closure, and Time tracking for the test case. Each test case or class file should extend this in order to utilize the complete built-up feature.

TestSuite

This framework utilizes TestNG Framework capabilities of Annotations to perform initialization/pre-requisite setup or termination/post-execution activities. Usage of Annotations is a way to define the order and any dependency of execution. Some of them are WebDriver initialization according to the browser option in the properties file, HTML report header creation, loading test data specific to the test case, HTML report closure, and Time tracking for the test case. Each test case or class file should extend this in order to utilize the complete built-up feature.

Selenium Wrapper

Selenium-related methods have been generalized by including reporting and have been grouped under this package. Users can call the methods directly and built-in validations report the results accordingly. Say OpenUrl, Click, isElementPresent.

Android Wrapper

Android Mobile-related methods have been generalized by including reporting and have been grouped under this package. Users can call the methods directly and built-in validations report the results accordingly. Say OpenUrl, Click, isElementPresent.

Environment

Browser related methods have been generalized by including get browser type and execution platform have been grouped under this package

Properties

Properties files have the environment and execution properties for the test. With these variables, you can able to pass a parameter in runtime through a command prompt

ApplicationSpecifc

All application-specific methods have been grouped under this package. App methods are created in generic in a class for more re-usability. The class file corresponding to each test case is also created under this package.

Utility

The utility package contains methods that could be re-usable across other applications. It is a one-time creation process that will be utilized according to the requirement. Methods are grouped corresponding to their operations under the class files. Some of them are DateUtlity, ExcelUtlity, GIT, and RandomUtility.

HTML Reporting

Allure Reports:

Extent Reports:

Extent Reports is an open-source reporting library used in selenium test automation. Extent API can produce more interactive reports, a dashboard view, graphical view, capture screenshots at every test step, and emailable reports.

Framework Workflow

Did this answer your question?