DAO
DAO
(Interview Questions 2)
What is Data Access Object in Java? And where you have used it in
your automation Framework?
• In Java, a DAO (Data Access Object) is a design pattern that provides an abstract
interface for accessing data from a database.
• It separates the logic for retrieving and storing data from the business logic of the
application.
• This separation of concerns helps to improve the maintainability and flexibility of
the application.
Usage:
• A DAO typically consists of a set of methods that correspond to common database
operations, such as reading, inserting, updating, and deleting records
• These methods typically take arguments that correspond to the data being
manipulated, and they return results that indicate the success or failure of the
operation.
• In your Test Automation Framework you are interested only in the Reading
Operation.
1
Test Automation Academy Jatin Shharma
Drawback Of DAO:
• There are a few potential drawbacks to using a DAO design pattern in Java.
• Increased complexity:
o Adding a DAO layer to an application can increase the overall complexity of the
codebase, as it adds another layer of abstraction.
o This can make it more difficult to understand and debug the application.
• Performance overhead: Using a DAO can add a small amount of performance overhead
to an application, as it requires additional method calls and object creation
• Limited flexibility:
o A DAO may provide a fixed set of methods that correspond to common database
operations, but it may not be able to handle more complex or specialized queries.
2
Test Automation Academy Jatin Shharma
Where to Use DAO in your Test Automation Framework?
Example:
o Where the user records have been updated properly by UI or API automation
o Verify if the Dropdowns are populated correctly on the UI
3
Test Automation Academy Jatin Shharma