In almost all of the Automation interview you may have
face this question where you have actually used OOPS Concept in your Automation
framework.
So In this blog, we will discuss how and where we have
actually applied below OOPs concepts in our Automation Framework.
- INTERFACE
- ABSTRACTION
- INHERITANCE
- ENCAPSULATION
- METHOD OVERLOADING
- METHOD OVERRIDING
INTERFACE
An interface in the Java programming language is an
abstract type that is used to specify a behavior that classes must implement.
An interface also contain methods and variables just like the class but the
methods declared in interface are by default abstract.
To understand this the very basic statement we write in
Selenium
WebDriver driver = new Chromedriver();
In this Case WebDriver itself is an Interface. So based
on this statement, WebDriver driver = new Chromedriver(); we are initializing
chrome 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 as mentioned earlier and Chromedriver is a class.
ABSTRACTION
As we are aware, Abstraction is
a process of hiding the implementation details from the user and showing only
relevant details to them. It also helps to reduce programming
complexity and effort.
In our Automation Framework whenever we Use Page object
Model, we write all the locator in page class and use this locator in our test it
means we are hiding our implementation from the user this is the simple example
of using abstraction in framework.
INHERITANCE
The process by which one class acquires the properties
(instance variables) and functionalities of another class is called inheritance.
When We create a Base Class in our automation Framework
to initialize WebDriver interface, waits,loggers,reports etc. and when we
extend this Base Class in other classes such as Tests and Utility Class. In
this case extending one class into other class is example of implementing
Inheritance.
ENCAPSULATION
Encapsulation is a mechanism of wrapping data
(variables) and code together as a single unit.
All the classes which we write in our automation
framework are an example of Encapsulation.
For e.g In Page object model classes, in which we declare the WebElement locator using @FindBy and initialization of this data members will be done using Constructor to utilize those in test methods.
For e.g In Page object model classes, in which we declare the WebElement locator using @FindBy and initialization of this data members will be done using Constructor to utilize those in test methods.
METHOD OVERLOADING
If a class has multiple methods having same name but
different in parameters, it is known as Method Overloading.
In Implicit wait when we use different time stamps such
as SECONDS, MINUTES, HOURS etc is one of the possible example of method
overloading.
METHOD
OVERRIDING
If subclass or child class has the same method as
declared in the parent class, it is known as method overriding in
Java.
Whenever we use a method which was already implemented/written
in another class by changing its parameters this is the example of method
overriding.
Keep Learning, Keep Sharing
Good Explanation.....bro
ReplyVery nice article ankur
ReplyThankyou ankur..very helpful..
ReplyNice very helpful for interview
Replynice and helpful.
ReplyCan you also share some tips for cracking selenium interview ?
Wow amazing .. !!! Thanks for sharing
ReplyThank you ankur..very helpful :)
ReplyCan you make one Post for Frequently asked Java programs in Interviews
Replygood explanation
ReplyCan you please check the overriding section, I think if we change the parameter, it will be overloading not overriding but great article anyways.
ReplyI was helpful for me
ReplyYou missed the example for overriding. You only explain the definition.
ReplyBut article is good. Thanks for writing this for us.
Hi Ankur,
ReplyCan you please share any good framework for Appium mobile automation. Facing challenge to run TestNG tests on multiple emulators/ physical device where multiple apps need to launch for testing. How to manage this using framework. Also observe that Appium community is not so active to upgrade these types of challenges.
1. Problem in detecting if adb devices is up and running (USB debugging should be enabled).
ReplyReally nice topics you had discussed above. I am much impressed.
selenium training in chennai |
Selenium Training in Chennai | Certification | Online Training Course | Selenium Training in Bangalore | Certification | Online Training Course | Selenium Training in Hyderabad | Certification | Online Training Course | Selenium Training in Coimbatore | Certification | Online Training Course | Selenium Training in Online | Certification | Online Training Course
I think this is the best article today. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic. Keep sharing your information regularly for my future reference.Excellent blog admin. This is what I have looked. Check out the following links for Software testing companies USA
ReplyTest automation software
Best automated testing software
Mobile app testing services
Load testing services
I think this is the best article today. Thanks for taking your own time to discuss this topic, I feel happy about that curiosity has increased to learn more about this topic. Keep sharing your information regularly for my future reference.Excellent blog admin. This is what I have looked. Check out the following links for Software testing companies USA
ReplyTest automation software
Best automated testing software
Mobile app testing services
Load testing services
Nice blog has been shared by you. before I read this blog I didn't have any knowledge about this but now I got some knowledge so keep on sharing such kind of an interesting blogs. We wish you the best of luck in all your blogging endeavors. Excellent blog admin. This is what I have looked. Check out the following links for QA services:-
ReplyIndia Best QA Testing Services Provider Company | Best Automation Testing Company in USA
The article is no doubt very helpful. Thank you so much for that but as per my knowledge in method overriding the signature of method should not change, it should have same number and type of arguments in base as well as child class.
ReplyI used to be recommended this website by my cousin. I am no longer sure whether this put up is written by way of him as no one else realize such precise approximately my trouble. You are wonderful! Thank you! free javascript courses
ReplyComplete Guide To Object Oriented Concepts In Selenium Automation Framework - Qa Automation >>>>> Download Now
Reply>>>>> Download Full
Complete Guide To Object Oriented Concepts In Selenium Automation Framework - Qa Automation >>>>> Download LINK
>>>>> Download Now
Complete Guide To Object Oriented Concepts In Selenium Automation Framework - Qa Automation >>>>> Download Full
>>>>> Download LINK B8
digital marketing training in trichy
ReplyI'm glad you found the post helpful for your research! I'll be sure to share more information on the topic in the future.
Replybest mean stack training institute
I'm glad you found the post helpful for your research! I'll be sure to share more information on the topic in the future.
Replyangular course for beginners