0% found this document useful (0 votes)
39 views

Selenium Framework Explanation

The document describes an automation test framework that uses the page object model design pattern. It details the framework structure including packages for pages and tests, a test base class for common functions, a utility class for reusable code, and properties files for static data. It also discusses use of test data from Excel files, Maven for building and dependencies, TestNG for test execution, Git version control, and Jenkins for continuous integration. Extent reports are used for test reporting.

Uploaded by

aksathua21
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Selenium Framework Explanation

The document describes an automation test framework that uses the page object model design pattern. It details the framework structure including packages for pages and tests, a test base class for common functions, a utility class for reusable code, and properties files for static data. It also discusses use of test data from Excel files, Maven for building and dependencies, TestNG for test execution, Git version control, and Jenkins for continuous integration. Extent reports are used for test reporting.

Uploaded by

aksathua21
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

How to Explain Test Automation Framework to the Interviewer

Type of Framework:
In our project, we are using Data-driven Framework by using Page Object Model design
pattern with Page Factory.
POM: is an object design pattern in Selenium, where web pages are represented as
classes, and the various elements on the page are defined as variables on the class. All
possible user interactions can then be implemented as methods on the class
Packages: We have separate packages for Pages and Tests. All the web page related classes
come under Pages package and all the tests related classes come under Tests package.
For ex: Home Page and Login Page have a separate classes to store element locators. For
the login test there would be a separate class which calls the methods from the Home
Page class and Login Page class.
Test Base Class: Test Base class deals with all the common functions used by all the pages. This
class is responsible for loading the configurations from properties files, Initializing the
WebDriver, Implicit Waits, Extent Reports and also to create the object of FileInputStream
which is responsible for pointing towards the file from which the data should be read.
Utility Class: Utility class stores and handles the functions (The code which is repetitive in
nature such as waits, actions, capturing screenshots, accessing excels, sending email etc.,)
which can be commonly used across the entire framework. The reason behind creating utility
class is to achieve reusability.
Properties file: This file stores the information that remains static throughout the framework
such as browser specific information, application URL, screenshots path etc. All the details
which change as per the environment and authorization such as URL, Login Credentials are kept
in the config.properties file. Keeping these details in a separate file makes easy to maintain.
Screenshots: Screenshots will be captured and stored in a separate folder and also the
screenshots of a failed test cases will be added in the extent reports.
Test Data: All the historical test data will be kept in excel sheet (controller.xlsx). By
using ‘controller.xlsx’, we pass test data and handle data driven testing. We use Apache POI to
handle excel sheets.
Maven: We used maven for building, executing and dependency purpose. Integrating the
TestNG dependency in POM.xml file and running this POM.xml file using Jenkins/GitLab.
TestNG: running all the tests at the same time like regression, smoke test scripts, for that
reason we are using TestNG. This also helps to achieve parallel and group execution.
Version Control: We are using GIT for storing all the scripts at a centralized repository.
Jenkins: By using Jenkins CI (Continuous Integration) Tool, we execute test cases on daily basis
and also for nightly execution based on the schedule. Test Result will be sent to the peers using
Jenkins.
Extent Reports: For the reporting purpose, we are using Extent Reports. It generates beautiful
HTML reports. We use the extent reports for maintaining logs and also to include the
screenshots of failed test cases in the Extent Report.
What is a Framework?
A framework defines a set of rules or best practices which we can follow in a systematic way to
achieve the desired results.
Tell me some popular Test Automation Frameworks?
There are different types of test automation frameworks and the most common ones are:
 Modular Testing Framework
 Data Driven Testing Framework
 Keyword Driven Testing Framework
 Hybrid Testing Framework
 Behavior Driven Development Framework

What are the advantages of using Test Automation Framework?


 Saves time and money. Automation testing is faster in execution
 Reusability of code. Create one time and execute multiple times with less or no
maintenance
 Easy reporting. It generates automatic reports after test execution
 Easy for compatibility testing. It enables parallel execution in combination of different
OS and browser environments
 Low cost maintenance. It is cheaper compared to manual testing in a long run
 Automated testing is more reliable
 Automated testing is more powerful and versatile
 It is mostly used for regression testing. Supports execution of repeated test cases
 Minimal manual intervention. Test scripts can be run unattended
 Maximum coverage. It helps to increase the test coverage

Where you have applied OOPs in your Automation Framework?


 ABSTRACTION
 INTERFACE
 INHERITANCE
 POLYMORPHISM
 METHOD OVERLOADING
 METHOD OVERRIDING
 ENCAPSULATION
 ABSTRACTION
ABSTRACTION
Abstraction is the methodology of hiding the implementation of internal details and showing
the functionality to the users.
In Page Object Model design pattern, we write locators in a Page Class. We utilize these locators
in tests but we can’t see these locators in the tests. Literally we hide the locators from the tests

INTERFACE
An interface in Java looks similar to a class but both the interface and class are two different
concepts. An interface can have methods and variables just like the class but the methods
declared in interface are by default abstract. We can achieve 100% abstraction and multiple
inheritance in Java with Interface.
In Selenium WebDriver driver = new FirefoxDriver();
WebDriver itself is an Interface. we are initializing Firefox browser using Selenium WebDriver.
It means we are creating a reference variable (driver) of the interface (WebDriver) and creating
an Object. Here WebDriver is an Interface and FirefoxDriver is a class.

INHERITANCE
Extending one class into other class is known as Inheritance.
We create a Base Class in the Framework to initialize WebDriver interface, WebDriver waits,
Property files, Excels, etc., in the Base Class. We extend the Base Class in other classes such as
Tests and Utility Class.

POLYMORPHISM
Polymorphism allows us to perform a task in multiple ways. Combination of overloading and
overriding is known as Polymorphism.

METHOD OVERLOADING
A class having multiple methods with same name but different parameters is called Method
Overloading
We use implicit wait in Selenium. Implicit wait is an example of overloading. In Implicit wait we
use different time stamps such as SECONDS, MINUTES, HOURS etc.

METHOD OVERRIDING
Declaring a method in child class which is already present in the parent class is called Method
Overriding. Examples: get and navigate methods of different drivers in Selenium.

ENCAPSULATION
Encapsulation is a mechanism of binding code and data together in a single unit.
All the classes in a framework are an example of Encapsulation. In POM classes, we declare the
data members using @FindBy and initialization of data members will be done using Constructor
to utilize those in methods.

What type of test cases do you pick up to automate?


I focus on the test cases which should be executed in a repetitive manner such as regression
test cases, smoke and sanity test cases.
What type of test cases you won’t pick up to automate?
Before picking up the test cases to automate, I do check whether the application is stable or
not. So based on this, I don’t pick up test cases when the AUT changes frequently and the test
cases which run only one time. When I do usability and exploratory testing.
How you build Object Repository in your project?
In Selenium, we call objects as locators (such as ID, Name, Class Name, Tag Name, Link Text,
Partial Link Text, XPath, and CSS). Object repository is a collection of objects. One of the ways to
create Object Repository is to place all the locators in a separate file (i.e. properties file). But
the best way is to use Page Object Model. In the Page Object Model Design Pattern, each web
page is represented as a class. All the objects related to a particular page of a web application
are stored in a class.

You might also like