where do you use abstraction in your framework code example
Example 1: where do you use abstarction in your framework
I used in defining a common super class while writing POM layer of the framework
We usually create an abstract class named
BasePage to have all common members for every page written
in this class like getPageTitle().
Then each Page class (HomePage, LoginPage, DashboardPage
etc.) inherit from BasePage.
Sometimes one may need to change the behavior of methods
implemented in superclass. So, subclass has freedom to
override that method where we use polymorphism.
This is how we use Abstract class in real projects.
Example 2: where do you use abstraction in your framework
I have created my PageBase class as super
class of the all page classes.
I have collected all common elements
and functions into PageBase class and
all other page classes extent PageBase class.
By doing so, I don't have to locate very
common WebElements and it provides
reusability in my framework.
I have implement abstraction in my POJO
classes for API Testing. My POJO classes
implements Comparable interface and
I override the compareTo() abstract method.
These concepts are commonly used in
framework development. Abstract class
is used in defining a common super
class while writing Page Object Model
layer of the framework. We usually create
an abstract class named PageBase to have
all common members for every page written
in this class for example getPageTitle().
Then each Page class
(HomePage, LoginPage, DashboardPage etc.)
inherit from BasePage. Sometimes one
may need to change the behavior of
methods implemented in superclass.
So, subclass has freedom to override
that method where we use polymorphism.
This is how we use Abstract class in projects.
Example 3: where do you use abstraction in your framework
I used in defining a common super class while writing POM layer of the framework
We usually create an abstract class named
BasePage to have all common members for every page written
in this class like getPageTitle().
Then each Page class (HomePage, LoginPage, DashboardPage
etc.) inherit from BasePage.
Sometimes one may need to change the behavior of methods
implemented in superclass. So, subclass has freedom to
override that method where we use polymorphism.
This is how we use Abstract class in real projects