21. Where is Overriding used?
Answer: Override onTestFailure() in Listener to take screenshots.
22. Where is Overloading used?
Answer: Overloaded method in ContactPage: createContact(String name) and createContact(String name, String phone)
23. Why Hybrid Framework?
Answer: It combines flexibility of Keyword framework with power of Data-Driven testing to suit multi-module projects.
24. Your role/contribution in the framework?
Answer:
- Developed Page Classes
- Created business libraries
- Integrated ExtentReports
- Developed generic utilities
- Suggested backup and reporting strategies
25. What are your accomplishments?
Answer:
- Reduced test execution time by 30%
- Automated regression suite
- Improved report design
26. Challenges without Framework?
Answer:
- No code reusability
- Maintenance is tough
- Poor report generation
- Harder for CI/CD integration
27. Difference between @FindBy, @FindBys, @FindAll
Answer:
- @FindBy: Single element
- @FindBys: All conditions must match
- @FindAll: At least one condition must match
28. @FindBy vs findElement()
Answer:
- @FindBy is used in POM, initializes at object creation
- findElement() is runtime WebDriver method
29. Suggestions to improve framework?
Answer:
- Migrate from SVN to GitHub
- Replace Excel with .properties files for configs
- Embed screenshots in HTML report
30. Selenium Exceptions faced?
Answer:
- NoSuchElementException
- StaleElementReferenceException
- ElementNotVisibleException
- TimeoutException
- IllegalStateException
31. What is TestNG and its need?
Answer: TestNG is a testing framework that supports grouping, parallel execution, and advanced reporting. It solves JUnit limitations.
32. Challenges without TestNG?
Answer:
- No inbuilt grouping
- No parallel execution
- Difficult HTML reporting
- Limited assertion support
33. Why TestNG over JUnit?
Answer:
- Better annotations
- Built-in HTML reports
- Test grouping
- Parameterization
- Supports Java & .NET
- Parallel testing supported
34. Explain TestNG annotations with example
Answer:
- @BeforeClass – Launch browser
- @AfterClass – Close browser
- @BeforeMethod – Login
- @AfterMethod – Logout
- @Test – Actual test
35. Usage of @BeforeTest, @AfterTest?
Answer:
- @BeforeTest: Set up browser
- @AfterTest: Close browser
- Used for cross-browser parallel execution
36. Usage of @BeforeSuite, @AfterSuite?
Answer:
- @BeforeSuite: Initialize Extent Report
- @AfterSuite: Save report and close resources
37. TestNG Hierarchy?
Answer:
- @BeforeSuite
- @BeforeTest
- @BeforeClass
- @BeforeMethod
- @Test
- @AfterMethod
- @AfterClass
- @AfterTest
- @AfterSuite
38. What is Batch Execution in TestNG?
Answer: Executing multiple classes or tests using testng.xml.
39. Syntax of testng.xml?
<suite name=”Suite”>
<test name=”Test”>
<classes>
<class name=”com.crm.contactTest.ContactTest”/>
</classes>
</test>
</suite>
40. What is Group Execution?
Answer: Running specific groups of tests using @Test(groups={“regression”}) in test classes and defining groups in testng.xml.