1. Role Expectations at 3 Years Experience (Java in Testing)
At 3 years of experience, Java is not evaluated like a backend developer role.
Interviewers assess how well you apply Java concepts in testing and automation contexts.
What interviewers expect at this level:
- Strong Core Java fundamentals
- Ability to apply Java in automation testing
- Understanding of OOPs for framework design
- Handling real-time automation failures
- Debugging using logs and stack traces
- Good understanding of STLC, SDLC, and Agile
- Defect reporting and RCA
- Basic backend validation using SQL
- Awareness of tools like Selenium, TestNG, Postman
- Working knowledge of defect tracking tools like Jira
At this level, interviews focus on practical Java usage in testing, not advanced Java theory.
2. Core Java Interview Questions & Structured Answers (Testing Focus)
Java Fundamentals (3 Years – Testing Perspective)
1. Why is Java commonly used in testing?
Java is widely used in testing because:
- It supports object-oriented programming
- Easily integrates with Selenium, TestNG, Maven
- Platform independent
- Large community and support
- Suitable for building scalable automation frameworks
2. Difference between JDK, JRE, and JVM?
| Component | Description |
| JDK | Development kit (compiler + tools) |
| JRE | Runtime environment |
| JVM | Executes Java bytecode |
Testers mostly interact with JDK and JVM.
3. Explain OOPs concepts with testing examples.
| OOP Concept | Testing Example |
| Encapsulation | Page Object Model |
| Inheritance | BaseTest class |
| Polymorphism | Overriding utility methods |
| Abstraction | Driver interfaces |
4. What is encapsulation and how is it used in testing?
Encapsulation binds data and methods together.
In testing:
- WebElements are private
- Actions are exposed via methods
This improves maintainability and security.
5. What is inheritance? Give a testing example.
Inheritance allows one class to acquire properties of another.
Example:
class BaseTest {
WebDriver driver;
}
class LoginTest extends BaseTest {
}
Used to reuse browser setup logic.
3. Java Collections Interview Questions (Testing Context)
6. Why are collections important for testers?
Collections help to:
- Store test data
- Capture multiple UI values
- Compare expected vs actual results
- Handle dynamic elements
7. Difference between List, Set, and Map?
| Type | 특징 |
| List | Allows duplicates |
| Set | No duplicates |
| Map | Key-value pairs |
8. When do you use ArrayList in testing?
- Store dropdown values
- Capture table data
- Compare UI results with expected data
9. Difference between ArrayList and HashSet?
| ArrayList | HashSet |
| Allows duplicates | No duplicates |
| Maintains order | No order |
10. Real-time use of Map in testing
- Store test data
- Store environment configurations
- Key-value based validations
4. Exception Handling Interview Questions (Very Important)
11. What is an exception?
An exception is an unexpected event that disrupts normal execution.
Common testing exceptions:
- NoSuchElementException
- TimeoutException
- NullPointerException
12. Checked vs unchecked exceptions?
| Checked | Unchecked |
| Compile-time | Runtime |
| IOException | NullPointerException |
13. How do you handle exceptions in testing?
- Try-catch blocks
- Explicit waits
- Proper logging
- Retry mechanisms
14. Real-time example:
try {
driver.findElement(By.id(“submit”)).click();
} catch (NoSuchElementException e) {
System.out.println(“Submit button not found”);
}
5. Java + Selenium Interview Questions
15. What is Selenium WebDriver?
Selenium WebDriver is a tool used to automate web applications by interacting directly with browsers.
16. Selenium architecture (brief)
- Java client libraries
- Browser drivers
- Browsers
17. What are locators?
Locators identify web elements:
- ID
- Name
- ClassName
- XPath
- CSS Selector
18. Which locator is fastest?
ID – because it is unique and direct.
19. How do you handle dynamic elements?
- Dynamic XPath
- CSS selectors
- Explicit waits
- Avoid absolute XPath
20. Implicit wait vs explicit wait?
| Implicit | Explicit |
| Global | Condition-based |
| Less control | More flexible |
6. TestNG Interview Questions (Java Testing)
21. Why TestNG is used?
- Annotation support
- Parallel execution
- Grouping
- Reporting
22. Common TestNG annotations:
- @BeforeSuite
- @BeforeClass
- @BeforeMethod
- @Test
- @AfterMethod
23. How do you control test execution order?
- priority
- dependsOnMethods
- testng.xml
7. STLC & SDLC (Java Tester Perspective)
24. Explain SDLC and tester role.
| Phase | Tester Role |
| Requirement | Identify test scenarios |
| Design | Review workflows |
| Development | Clarify gaps |
| Testing | Execute & validate |
| Deployment | Smoke testing |
| Maintenance | Regression & RCA |
25. Explain STLC.
- Requirement analysis
- Test planning
- Test case design
- Environment setup
- Execution
- Closure
8. Agile & Java Testing
26. Role of tester in Agile.
- Sprint planning
- Story testing
- Regression testing
- Sprint sign-off
27. Agile ceremonies:
- Sprint Planning
- Daily Stand-up
- Review
- Retrospective
9. Scenario-Based Questions + RCA
28. Script works locally but fails in CI. Why?
- Environment mismatch
- Timing issues
- Data dependency
- Browser version mismatch
29. Automation failure after UI change. What do you do?
- Update locators
- Improve locator strategy
- Re-run regression
30. Real-Time RCA Example
Issue: Login test fails intermittently
Root Cause: Hard-coded waits
Fix: Implemented explicit waits
10. Test Case & Bug Examples
31. Sample Test Case – Login
| Field | Value |
| Scenario | Valid login |
| Steps | Enter valid credentials |
| Expected | Dashboard displayed |
32. Sample Bug Report
Title: Login button not clickable
Steps:
1. Open login page
2. Enter valid credentials
3. Click Login
Expected: User logged in
Actual: Button unresponsive
Severity: High
Priority: High
11. Backend Validation Using SQL
33. Why should testers know SQL?
- Validate backend data
- Verify transactions
- Support RCA
34. Sample SQL Query
SELECT status, amount
FROM orders
WHERE order_id = 7890;
12. API Testing Awareness
35. Why API testing is important?
- Faster than UI
- Stable
- Validates business logic
36. Tools used:
- Postman
- Basic Rest Assured awareness
13. Domain Exposure Examples
Banking
- Login
- Fund transfer
- Statements
E-Commerce
- Cart
- Checkout
- Payment
14. Common Mistakes at 3 Years Experience
- Java theory without testing examples
- Weak framework explanation
- No RCA discussion
- Ignoring SQL and API basics
15. Quick Revision Cheat Sheet
- Core Java ✔
- OOPs ✔
- Collections ✔
- Exception handling ✔
- Selenium basics ✔
- STLC & Agile ✔
- RCA thinking ✔
16. FAQs – Java Interview Questions for 3 Years Experience in Testing
Q: Is deep Java knowledge required?
Core Java with testing usage is enough.
Q: Is automation mandatory?
Automation knowledge is highly preferred.
Q: What matters most in interviews?
Practical Java usage, debugging skills, and problem-solving.
