1. What is a framework? Explain types of frameworks
Answer: A framework is a set of rules or guidelines used to create and design test cases efficiently. Types include:
- Linear Framework – Test scripts run sequentially.
- Modular Framework – Divides application into modules.
- Data-Driven Framework – Test data is separated from scripts.
- Keyword-Driven Framework – Actions are defined using keywords.
- Hybrid Framework – Combines multiple frameworks (Data + Keyword).
2. Which framework have you used and why?
Answer: I used the Hybrid Framework because our project has complex modules and requires test data. It combines the advantages of both data-driven and keyword-driven approaches.
3. Explain your framework with components
Answer: My hybrid framework includes:
- Page Object Model (POM)
- Apache POI for Excel
- TestNG for execution
- ExtentReports for reporting
- Generic libraries (waits, browser launch)
- Maven for dependency management
- Jenkins for CI/CD
4. What is the role of automation in your project?
Answer: Automation ensures faster regression testing, reduces manual errors, and improves coverage. It’s used for smoke, sanity, and regression testing in our Agile lifecycle.
5. What are the benefits of using a framework?
Answer:
- Code reusability (object repo, libraries)
- Easy test development & execution
- Better maintainability
- XPath updates are easier with POM
- Supports cross-browser testing
- Custom reporting with ExtentReports
- Screenshot capturing using Listeners
- Dynamic credential handling
- Maven auto-fetches dependencies
- Jenkins supports remote execution
6. What is POM design pattern? Explain its rules
Answer: POM (Page Object Model) is a design pattern where each web page has a corresponding Java class. Rules include:
- One class per page
- WebElements as private members
- Methods representing actions
- Use of PageFactory for object initialization
7. How many Page Classes have you created?
Answer: I created 25+ Page Classes covering Login, Home, Contacts, Leads, Campaigns, and Products modules.
8. How many modules have you worked on?
Answer: I worked on 4 major modules – Login, Contacts, Leads, and Campaigns.
9. Advantages of POM Object Repository?
Answer:
- Easy maintenance
- Code reusability
- Cleaner test scripts
- Avoids duplication
- Promotes modular design
10. Program: Store and Access Object in POM
public class LoginPage {
@FindBy(name=”user_name”)
private WebElement username;
public LoginPage(WebDriver driver) {
PageFactory.initElements(driver, this);
}
public void login(String user, String pass) {
username.sendKeys(user);
// password and submit logic
}
}
11. Program to Read Data from Excel
FileInputStream fis = new FileInputStream(“./data.xlsx”);
Workbook wb = WorkbookFactory.create(fis);
String data = wb.getSheet(“Sheet1”).getRow(0).getCell(0).getStringCellValue();
12. What is Data-Driven Testing?
Answer: Data-driven testing separates test logic from data. It allows running the same test with multiple inputs.
13. How to achieve Data-Driven Testing?
Answer: Using Apache POI or @DataProvider in TestNG.
14. Why use Excel over Database for test data?
Answer: Excel is user-friendly, portable, and easily editable by non-technical users.
15. How to run the same test with multiple data?
Answer: Using TestNG’s @DataProvider annotation.
16. Where do you use Polymorphism?
Answer: In the base class – WebDriver driver = new ChromeDriver(); allows cross-browser compatibility.
17. Where is Upcasting used?
Answer: WebDriver driver = new FirefoxDriver(); enables browser independence.
18. Where is Inheritance used?
Answer: All test classes extend BaseClass to reuse setup/teardown logic.
19. Where is Abstraction used?
Answer: Implemented ITestListener interface to log reports/screenshots.
20. Where is Encapsulation used?
Answer: POM classes – WebElements are private, and access is via public methods.
👉The Next 20 Questions-I: AUTIMATION TESTING
👉The Next 10 Questions-II: AUTOMATION TESTING