🔥 Selenium – Questions 1–10
1. What is Page Object Model (POM)?
Answer:
Page Object Model is a design pattern used in Selenium automation where each application page or reusable component is represented by a separate Java class.
The class contains:
- WebElement locators
- Page-specific actions
- Reusable methods
For example:
public class LoginPage { private WebDriver driver; private By username = By.id("username"); private By password = By.id("password"); private By loginButton = By.id("login"); public LoginPage(WebDriver driver) { this.driver = driver; } public void login(String user, String pass) { driver.findElement(username).sendKeys(user); driver.findElement(password).sendKeys(pass); driver.findElement(loginButton).click(); } }
Then the test becomes:
LoginPage loginPage = new LoginPage(driver); loginPage.login("admin", "password");
Benefits:
- Maintainability
- Reusability
- Readability
- Less duplicate code
- Easier maintenance when UI changes
2. POM vs Page Factory?
Answer:
Both are approaches related to implementing page objects.
POM
We define locators and interact with them directly.
By username = By.id("username"); driver.findElement(username).sendKeys("Pushkar");
Page Factory
Historically, Page Factory used @FindBy to initialize WebElements.
@FindBy(id = "username") WebElement username;
Then:
username.sendKeys("Pushkar");
Interview answer:
POM is the design pattern, whereas Page Factory is an implementation approach that can be used with POM. In modern Selenium projects, I generally prefer standard POM with
Bylocators because it provides explicit and straightforward element lookup.
3. What is Selenium WebDriver architecture?
Answer:
The basic flow is:
Test Script ↓ Selenium WebDriver API ↓ Browser Driver ↓ Browser
For example:
Java Test ↓ Selenium WebDriver ↓ ChromeDriver ↓ Chrome Browser
Modern Selenium uses the W3C WebDriver standard for browser automation.
When I execute:
driver.findElement(By.id("login")).click();
the WebDriver client sends the command to the browser driver, which communicates with the browser.
4. How do you handle stale elements?
Answer:
StaleElementReferenceException occurs when the DOM changes after Selenium has already located an element.
For example, an Angular/React application may re-render a component.
I handle it by:
- Locating the element again.
- Waiting for the correct condition.
- Avoiding storing WebElement references for too long.
- Using retry logic only when justified.
Example:
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); WebElement element = wait.until( ExpectedConditions.elementToBeClickable( By.id("submit") ) ); element.click();
I avoid solving the problem simply with Thread.sleep().
5. How do you handle AJAX?
Answer:
AJAX requests update parts of the page without performing a complete page refresh.
I handle AJAX using explicit waits.
For example:
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20)); wait.until( ExpectedConditions.visibilityOfElementLocated( By.id("result") ) );
If there is a loading spinner, I can wait for it to disappear:
wait.until( ExpectedConditions.invisibilityOfElementLocated( By.id("loader") ) );
The important thing is to synchronize with the application's actual state rather than using fixed sleeps.
6. How do you handle dynamic tables?
Answer:
I identify the table rows and columns dynamically.
Example:
List<WebElement> rows = driver.findElements( By.xpath("//table/tbody/tr") ); for (WebElement row : rows) { String text = row.getText(); if (text.contains("Pushkar")) { System.out.println(text); break; } }
If I need to click a particular action button in the same row, I locate the button relative to that row.
row.findElement( By.xpath(".//button[text()='Edit']") ).click();
This is more reliable than hardcoding row numbers.
7. How do you handle auto-suggestion?
Answer:
I enter the search text, wait for suggestions, retrieve the suggestion list and select the required value.
driver.findElement(By.id("search")) .sendKeys("Del"); WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); List<WebElement> suggestions = wait.until( ExpectedConditions.visibilityOfAllElementsLocatedBy( By.xpath("//ul[@class='suggestions']/li") ) ); for (WebElement suggestion : suggestions) { if (suggestion.getText().equals("Delhi")) { suggestion.click(); break; } }
I use explicit waits because suggestions are often loaded dynamically.
8. How do you handle calendar controls?
Answer:
I first identify whether it is:
- Native HTML date input
- Custom calendar
- JavaScript calendar
- Third-party calendar
For a custom calendar, I:
- Open the calendar.
- Identify current month/year.
- Compare it with the required month/year.
- Navigate using Next/Previous.
- Select the required date.
Example:
driver.findElement(By.id("date")).click(); while (!driver.findElement(By.className("month")) .getText().equals("August 2026")) { driver.findElement( By.xpath("//button[@aria-label='Next month']") ).click(); } driver.findElement( By.xpath("//td[normalize-space()='25']") ).click();
9. How do you execute tests across Chrome, Firefox and Edge?
Answer:
I parameterize the browser and environment.
For example, in TestNG:
<parameter name="browser" value="chrome"/>
Then:
@Parameters("browser") @BeforeMethod public void setup(String browser) { if (browser.equalsIgnoreCase("chrome")) { driver = new ChromeDriver(); } else if (browser.equalsIgnoreCase("firefox")) { driver = new FirefoxDriver(); } else if (browser.equalsIgnoreCase("edge")) { driver = new EdgeDriver(); } }
For larger frameworks, I maintain browser/environment configuration externally and use CI/CD parameters.
10. How do you run Selenium tests in Docker?
Answer:
I can run Selenium using Dockerized browsers, commonly through a Selenium Grid setup.
The architecture can be:
Jenkins ↓ Docker ↓ Selenium Grid ↓ Chrome / Firefox / Edge Containers ↓ Automation Tests
The benefit is that the test environment becomes more consistent and isolated.
I can also use Docker Compose to start Selenium services.
The key advantages are:
- Consistent environment
- Easy scalability
- Parallel execution
- Easier CI/CD integration
11. Explain TestNG annotations.
Important TestNG annotations include:
@BeforeSuite @BeforeTest @BeforeClass @BeforeMethod @Test @AfterMethod @AfterClass @AfterTest @AfterSuite
Typical execution:
@BeforeSuite ↓ @BeforeTest ↓ @BeforeClass ↓ @BeforeMethod ↓ @Test ↓ @AfterMethod ↓ @AfterClass ↓ @AfterTest ↓ @AfterSuite
I use these annotations to manage test setup, execution and cleanup.
12. @BeforeMethod vs @BeforeClass
@BeforeMethod
Runs before each test method.
@BeforeMethod public void setup() { // browser setup }
If there are 5 test methods, it runs 5 times.
@BeforeClass
Runs once before the first test method in the class.
@BeforeClass public void setup() { }
Interview answer:
I use
@BeforeMethodwhen each test requires independent setup and@BeforeClasswhen setup can be shared across test methods.
13. What is DataProvider?
@DataProvider is used for data-driven testing.
Example:
@DataProvider(name = "loginData") public Object[][] loginData() { return new Object[][] { {"user1", "pass1"}, {"user2", "pass2"}, {"user3", "pass3"} }; }
Use it:
@Test(dataProvider = "loginData") public void loginTest( String username, String password) { System.out.println(username); }
The same test executes with multiple datasets.
14. How do you retry failed tests?
I can use TestNG's IRetryAnalyzer.
public class RetryAnalyzer implements IRetryAnalyzer { private int count = 0; private int maxRetry = 2; public boolean retry(ITestResult result) { if (count < maxRetry) { count++; return true; } return false; } }
Then:
@Test(retryAnalyzer = RetryAnalyzer.class) public void loginTest() { }
However, I use retries carefully.
A retry should not hide a genuine application defect. I investigate the root cause of flaky failures.
15. How do you skip a test?
Using:
@Test(enabled = false) public void testCase() { }
Or dynamically:
throw new SkipException( "Test skipped because environment is unavailable" );
I prefer explaining why a test is skipped rather than silently disabling it.
16. How do you group tests?
Example:
@Test(groups = {"smoke"}) public void loginTest() { }
Another:
@Test(groups = {"regression"}) public void paymentTest() { }
Then I can configure TestNG to run only selected groups.
Typical groups:
smoke sanity regression integration critical
17. How do you execute TestNG tests in parallel?
In testng.xml:
<suite name="Regression" parallel="tests" thread-count="3">
Possible modes include:
methods classes tests instances
For Selenium, I ensure WebDriver is thread-safe, usually with ThreadLocal<WebDriver>.
18. What are TestNG listeners?
Listeners allow us to respond to test execution events.
Examples:
ITestListener ISuiteListener IInvokedMethodListener IReporter
ITestListener can handle:
onTestStart() onTestSuccess() onTestFailure() onTestSkipped()
I commonly use listeners for:
- Screenshots on failure
- Logging
- Reporting
- Custom test execution behavior
19. What is Scenario Outline?
Scenario Outline is used when the same scenario needs to run with multiple datasets.
Example:
Scenario Outline: Login Given user enters "<username>" And user enters "<password>" When user clicks login Then dashboard should be displayed Examples: | username | password | | user1 | pass1 | | user2 | pass2 |
The scenario executes once for each Examples row.
20. What is the Examples keyword?
Examples provides test data for a Scenario Outline.
Example:
Examples: | username | password | | admin | admin123 | | user | user123 |
Each row represents one test iteration.
21. What is Background?
Background contains common steps that should run before each scenario in a feature.
Example:
Background: Given user is on the login page Scenario: Valid Login When user enters valid credentials Then dashboard is displayed Scenario: Invalid Login When user enters invalid credentials Then error is displayed
The Background step applies to both scenarios.
22. What are Cucumber Hooks?
Hooks allow us to execute setup and cleanup code.
Examples:
@Before public void setup() { // browser setup } @After public void tearDown() { // browser close }
I use hooks for:
- Browser initialization
- Test data setup
- Screenshots
- Cleanup
23. What are Cucumber tags?
Tags categorize scenarios.
Example:
@smoke Scenario: Login
Another:
@regression Scenario: Payment
Then I can execute only:
@smoke
or:
@regression
This is very useful for selective execution in CI/CD.
24. What is DataTable in Cucumber?
DataTable allows us to pass structured data to a step.
Example:
When user enters following details | username | Pushkar | | city | Delhi | | role | Admin |
The step definition can receive the table and convert it into a Map, list or other structure.
It is useful when multiple fields need to be passed together.
25. How do you generate Cucumber reports?
Cucumber supports different reporting mechanisms.
I can generate:
- HTML
- JSON
- XML
For example, configuration can specify reporting plugins.
I can then integrate those reports into Jenkins or other CI/CD systems.
For enterprise projects, I may also integrate Cucumber results with Allure or another reporting solution.
26. How do you validate response schema?
I validate:
- HTTP status
- Response fields
- Data types
- Mandatory fields
- JSON structure
In Postman, JSON schema validation can be performed using appropriate assertions.
For example:
pm.test("Response has ID", function () { let json = pm.response.json(); pm.expect(json).to.have.property("id"); });
I also validate that fields contain expected data types and values.
27. How do you test negative scenarios in API testing?
I test invalid and unexpected inputs.
Examples:
- Missing mandatory field
- Invalid token
- Expired token
- Invalid data type
- Invalid ID
- Duplicate request
- Empty request body
- Invalid HTTP method
- Unauthorized user
- Boundary values
For example:
POST /users
without a required email.
I would expect an appropriate 4xx response and meaningful error message.
28. How do you validate response time?
In Postman:
pm.test("Response time is acceptable", function () { pm.expect(pm.response.responseTime) .to.be.below(2000); });
This checks whether the API response is below 2 seconds.
However, performance thresholds should be based on business and performance requirements, not arbitrary numbers.
29. How do you perform API authentication?
It depends on the application.
Common mechanisms include:
- Basic authentication
- Bearer token
- JWT
- OAuth 2.0
- API key
For Bearer token:
Authorization: Bearer <token>
In Postman, I can store the token as an environment variable:
{{accessToken}}
and reuse it across requests.
30. How do you chain multiple APIs?
Example:
Login API ↓ Get Token ↓ Create User ↓ Get User ID ↓ Update User ↓ Delete User
In Postman:
let response = pm.response.json(); pm.environment.set( "userId", response.id );
Then:
/users/{{userId}}
This allows end-to-end API workflow automation.
31. How do you automate Postman collections in Jenkins?
Typical process:
Postman Collection ↓ Newman ↓ Jenkins ↓ Report
Example command:
newman run collection.json \ -e environment.json
Jenkins can execute the command as a build step or pipeline stage.
Example:
stage('API Tests') { steps { sh 'newman run collection.json -e environment.json' } }
The results can then be published as reports.
🔥 Performance Testing – Questions 32–40
32. Explain JMeter architecture.
Basic JMeter architecture:
Test Plan ↓ Thread Group ↓ Controllers ↓ Samplers ↓ Assertions ↓ Listeners
Thread Group
Represents virtual users.
Samplers
Send requests.
Examples:
- HTTP Request
- JDBC Request
- FTP Request
Assertions
Validate responses.
Listeners
Display/store results.
Controllers
Control execution logic.
33. What is a Thread Group?
A Thread Group defines virtual users and their execution behavior.
Main settings:
Number of Threads Ramp-up Period Loop Count Duration
Example:
Users = 100 Ramp-up = 50 sec
JMeter gradually starts the users during the ramp-up period.
34. What is Ramp-up?
Ramp-up defines how long JMeter takes to start all configured threads.
Example:
Threads = 100 Ramp-up = 50 seconds
Approximately:
100 / 50 = 2 users per second
So JMeter gradually starts users rather than starting all 100 simultaneously.
35. What are JMeter Listeners?
Listeners collect and display/store test results.
Examples include:
- View Results Tree
- Summary Report
- Aggregate Report
- Response Time Graph
For large load tests, I avoid heavy GUI listeners because they consume resources.
For actual performance execution, I prefer non-GUI mode and analyze generated result files/reports.
36. What is correlation?
Correlation means capturing a dynamic value from one response and using it in a subsequent request.
Example:
Login Response ↓ Session ID = ABC123 ↓ Next Request ↓ Session ID = ABC123
In JMeter, I can use extractors such as:
- JSON Extractor
- Regular Expression Extractor
- CSS/JQuery Extractor
Example:
${sessionId}
37. What is parameterization?
Parameterization means providing different input data to virtual users.
For example, instead of every user using:
user1
we provide:
user1 user2 user3 user4
In JMeter, I can use:
CSV Data Set Config
Example:
username,password user1,pass1 user2,pass2 user3,pass3
Then:
${username} ${password}
38. How do you handle dynamic values in JMeter?
I use correlation/extractors.
Example:
If the response contains:
{ "token": "ABC123" }
I extract the token using a JSON Extractor and store it in:
${token}
Then use:
Authorization: Bearer ${token}
This is essential when APIs generate dynamic session IDs, tokens or transaction IDs.
39. Difference between Load, Stress and Spike Testing
Load Testing
Checks application behavior under expected user load.
Example:
1,000 concurrent users
Stress Testing
Pushes the system beyond expected capacity to identify breaking points.
Example:
1,000 → 2,000 → 5,000 → 10,000 users
Spike Testing
Suddenly increases or decreases the load.
Example:
100 users ↓ 5,000 users suddenly
Easy way to remember:
Load = Expected load
Stress = Beyond capacity
Spike = Sudden load change
40. How do you analyze JMeter results?
I look at:
Response Time
- Average
- Median
- Percentiles
- 90th/95th/99th percentile
Throughput
Number of requests processed per unit of time.
Error %
Percentage of failed requests.
Concurrent users
Actual active load.
Server resources
I correlate JMeter results with:
- CPU
- Memory
- Disk
- Network
- Database
- Application metrics
If response time increases significantly while CPU reaches 100%, that may indicate a CPU bottleneck.
If application response time is high but CPU is low, I investigate other areas such as database, external APIs, network or application synchronization.
41. How do you handle conflicts within your QA team?
First, I listen to both sides separately if needed.
Then I understand the actual problem and focus on facts rather than personalities.
My approach:
Understand Issue ↓ Listen to Both Sides ↓ Identify Root Cause ↓ Discuss Possible Solutions ↓ Agree on Action ↓ Follow Up
For example, if two testers disagree about test ownership, I clarify responsibilities based on the project plan and workload.
My objective is to resolve the conflict without affecting delivery or team morale.
42. How do you handle disagreement with developers?
I focus on evidence.
I provide:
- Steps to reproduce
- Screenshots/video
- Logs
- API response
- Database evidence
- Expected vs actual result
- Requirement reference
I discuss the issue with the developer professionally.
If the disagreement continues, I involve the BA/Product Owner/QA Lead.
I never make it personal.
Strong interview statement:
My objective is not to prove that the developer is wrong. My objective is to ensure that the product behaves according to the agreed requirements.
43. How do you decide release readiness?
I consider:
Functional quality
- Critical scenarios passed
- Regression completed
- No open blocker/critical defects
Defect status
- Severity
- Business impact
- Known risks
- Workarounds
Test coverage
- Requirements covered
- Integration tested
- End-to-end flows validated
Non-functional quality
Where applicable:
- Performance
- Security
- Compatibility
- Accessibility
Then I provide a QA recommendation.
Example:
"QA recommends release because all critical business flows have passed, regression is completed, and there are no open blocker/critical defects. Two medium-severity known issues remain with documented workarounds."
44. What would you do if testing time is reduced by 50%?
I would move to risk-based testing.
I would prioritize:
- Critical business flows
- High-risk areas
- Recent code changes
- Integration points
- Production defect-prone areas
- Smoke/regression automation
I would communicate the reduced scope and associated risks to stakeholders.
I would not simply execute half of the test cases randomly.
Interview answer:
If testing time is reduced, I reduce scope based on risk rather than reducing quality blindly.
45. What if there are 1,000 test cases but only one day for testing?
I would not attempt to execute all 1,000 manually.
I would categorize them:
P0 – Critical P1 – High P2 – Medium P3 – Low
Then execute:
Smoke ↓ Critical business flows ↓ Recent changes ↓ High-risk regression ↓ Automated regression
I would also check whether existing automation can cover a large portion.
Finally, I would clearly communicate:
"We can validate the critical scope within one day, but complete regression cannot be guaranteed within the available time."
46. How do you manage multiple projects?
I prioritize work based on:
- Business priority
- Release deadlines
- Risk
- Dependencies
- Team capacity
I maintain a clear task/status tracker.
For each project I track:
Requirements Test Cases Execution Defects Risks Dependencies Release Date
I also communicate early if there is a resource or timeline conflict.
Important:
I don't try to manage everything from memory. I use structured tracking and regular status communication.
47. How do you handle a critical production issue?
I follow an incident-based approach.
Issue Reported ↓ Assess Severity ↓ Reproduce ↓ Collect Evidence ↓ Identify Impact ↓ Developer Investigation ↓ Fix ↓ QA Validation ↓ Regression ↓ Production Verification ↓ RCA
During a critical issue, communication is extremely important.
I keep stakeholders updated with:
- Current impact
- Investigation status
- Workaround
- Expected next action
- Validation status
After resolution, I ensure appropriate regression coverage is added.
48. How do you calculate automation ROI?
A simple approach is:
ROI = Benefits / Cost
For example, suppose:
Manual regression effort = 100 hours Automated regression execution + maintenance = 20 hours
Potential saving:
100 - 20 = 80 hours
I also consider:
- Initial automation development cost
- Maintenance cost
- Execution frequency
- Number of releases
- Reduction in manual effort
- Defect detection benefits
- Faster feedback in CI/CD
Automation provides higher ROI when tests are stable, repetitive and executed frequently.
49. How do you review another tester's automation code?
I review:
Code quality
- Naming conventions
- Readability
- Proper Java practices
- Avoiding duplicate code
Selenium
- Stable locators
- Explicit waits
- No unnecessary sleeps
- Proper browser handling
Framework
- POM usage
- Reusability
- Separation of concerns
- Configuration management
Test design
- Independent tests
- Proper assertions
- Meaningful test data
Error handling
- Screenshots
- Logging
- Exception handling
Maintainability
I ask:
"If the application changes tomorrow, how much code would need to be modified?"
That's an important measure of automation framework quality.
50. Why should we hire you as a QA Lead/Automation Engineer?
This is one of the most important questions. I would answer it like this:
I believe I am a strong fit because I bring a combination of manual testing, automation, API testing, SQL and QA leadership experience.
I have more than 6 years of experience across web, mobile and API testing. I have worked with Selenium, Java, TestNG, Cucumber, Playwright, Postman, SQL, JMeter, Git and Jenkins.
I understand the complete QA lifecycle, from requirement analysis and test planning through execution, defect management, regression, automation and release validation.
I also focus on the quality process, not just test execution. I look at risk, business impact, automation ROI, defect trends and release readiness.
Another strength is troubleshooting. When a test fails, I try to determine whether the root cause is the application, test data, environment, API, database or automation framework rather than simply marking the test as failed.
Finally, I enjoy mentoring team members, improving QA processes and working collaboratively with developers, business analysts and product teams. I believe I can contribute both technically and from a team-leadership perspective.
⭐ Quick Revision Sheet
Before your interview, remember these one-line answers:
| Topic | Quick Answer |
|---|---|
| POM | Design pattern separating page actions/locators from tests |
| Page Factory | @FindBy-based implementation approach historically used with POM |
| Dynamic XPath | Use stable attributes, contains(), starts-with(), relationships |
| Stale Element | DOM changed; relocate element and synchronize |
| Frames | switchTo().frame() |
| Shadow DOM | Access getShadowRoot() |
| Multiple Windows | getWindowHandles() |
| Parallel Testing | TestNG + thread-safe WebDriver |
| DataProvider | Data-driven TestNG execution |
| Listener | Responds to test execution events |
| Scenario Outline | Same Cucumber scenario with multiple datasets |
| Hooks | Setup/cleanup around scenarios |
| API Chaining | Extract response value and pass to next API |
| JWT | Token commonly used for API authentication/authorization |
| Correlation | Capture dynamic value and reuse it |
| JMeter Thread | Virtual user |
| Ramp-up | Time to start configured users |
| Load | Expected load |
| Stress | Beyond expected capacity |
| Spike | Sudden load change |
| Severity | Impact of defect |
| Priority | Urgency of fixing defect |
| Regression | Verify existing functionality after changes |
| Risk-based testing | Test highest-risk areas first |
| Automation ROI | Compare automation investment against time/cost/quality benefits |
| Release readiness | Coverage + defects + risk + business impact |
🎯 Most important areas to revise before the interview
Given the questions you have, I would prioritize them in this order:
1. Selenium + Java — 30%
2. Framework + TestNG — 20%
3. API/Postman — 15%
4. SQL — 10%
5. Cucumber — 10%
6. JMeter — 5%
7. Git/Jenkins/CI-CD — 5%
8. Leadership/scenario-based questions — 5%
For a 6+ years profile, don't memorize only definitions. Be ready to explain "How did you implement this in your project?", "What problem did you face?", and "Why did you choose this approach?" after almost every technical answer.
How did you implement this in your project?", "What problem did you face?", and "Why did you choose this approach?" pls explain with example
Yes. These three follow-up questions are very important for a 6+ years QA Automation interview because the interviewer wants to know whether you have actually worked on the technology or only learned the theory.
A good way to answer is:
What I implemented → Problem I faced → Solution → Why I chose it → Result
Below are practical examples based on a typical Selenium + Java + TestNG + Cucumber + API + SQL + Jenkins project.
1. Selenium – Page Object Model
Interviewer: How did you implement POM in your project?
Answer:
In my project, I implemented Page Object Model by creating separate classes for different application pages, such as LoginPage, DashboardPage, RegistrationPage and ProfilePage.
I kept the locators and page-specific actions inside the respective Page Object classes, while the test classes contained only the test flow and assertions.
Example:
public class LoginPage { WebDriver driver; By username = By.id("username"); By password = By.id("password"); By loginButton = By.id("login"); public LoginPage(WebDriver driver) { this.driver = driver; } public void login(String user, String pass) { driver.findElement(username).sendKeys(user); driver.findElement(password).sendKeys(pass); driver.findElement(loginButton).click(); } }
Test:
@Test public void validLoginTest() { LoginPage loginPage = new LoginPage(driver); loginPage.login("testuser", "password"); Assert.assertTrue( driver.getTitle().contains("Dashboard") ); }
What problem did you face?
Initially, we had locators directly inside test cases. When the UI changed, we had to update the same locator in multiple test cases. This created maintenance problems.
Why did you choose POM?
I chose POM because it separates test logic from UI implementation. If a locator changes, I can update it in one Page Object instead of changing multiple test cases.
Result:
It reduced duplicate code and made the framework easier to maintain and scale.
2. Selenium – Explicit Wait
How did you implement it?
In my project, the application had dynamically loaded elements, especially after API calls and AJAX operations. I created reusable explicit-wait methods in a utility class.
public void waitForElement(By locator) { WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20)); wait.until( ExpectedConditions.visibilityOfElementLocated(locator) ); }
Then:
waitForElement(By.id("submit")); driver.findElement(By.id("submit")).click();
What problem did you face?
We initially experienced failures because Selenium tried to interact with elements before they were available.
For example:
Element not clickable Element not visible StaleElementReferenceException
Why did you choose explicit wait?
I chose explicit wait because the application was dynamic. I didn't want to wait for a fixed amount of time for every element. Explicit wait allows me to wait only until a specific condition is satisfied.
Good interview statement:
I avoid using
Thread.sleep()as the primary synchronization mechanism because it introduces unnecessary delays and can still fail if the application takes longer than the fixed sleep time.
3. Selenium – Dynamic XPath
How did you implement it?
Suppose the application generates IDs like:
user_12345 user_56789 user_98765
I created a dynamic XPath:
By username = By.xpath("//input[contains(@id,'user_')]");
Problem?
The application generated dynamic IDs, so the XPath based on the complete ID was not stable.
Bad:
//input[@id='user_12345']
Better:
//input[contains(@id,'user_')]
Why this approach?
I identified the static portion of the attribute and used
contains()so that the locator remained stable even when the dynamic portion changed.
4. Selenium – StaleElementReferenceException
How did you implement the solution?
In my project, some Angular-based pages refreshed portions of the DOM after API responses. Because of that, previously identified WebElements sometimes became stale.
Instead of storing the element for a long time, I re-located it when required.
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); WebElement button = wait.until( ExpectedConditions.elementToBeClickable( By.id("submit") ) ); button.click();
Problem?
The error was:
StaleElementReferenceException
Why this approach?
The DOM was changing dynamically. Re-locating the element after the DOM update ensured Selenium interacted with the current element.
5. TestNG – Parallel Execution
How did you implement parallel execution?
We had a large regression suite, and sequential execution was taking several hours. I implemented TestNG parallel execution to reduce execution time.
In testng.xml:
<suite name="Regression" parallel="tests" thread-count="4">
I also used thread-safe WebDriver management.
private static ThreadLocal<WebDriver> driver = new ThreadLocal<>();
Problem?
Sequential execution:
200 tests ↓ 4 hours
Why parallel execution?
The regression suite was large and many tests were independent. Running them in parallel reduced execution time and provided faster feedback to the development team.
Important follow-up:
Interviewer: What problem can occur with parallel execution?
Answer:
If the same WebDriver instance is shared across threads, tests can interfere with each other. That's why I use ThreadLocal WebDriver or another thread-safe driver management strategy.
6. TestNG – Screenshots on Failure
How did you implement it?
I implemented
ITestListenerand captured screenshots insideonTestFailure().
@Override public void onTestFailure(ITestResult result) { TakesScreenshot ts = (TakesScreenshot) driver; File source = ts.getScreenshotAs(OutputType.FILE); // save screenshot }
Problem?
When an automation test failed in Jenkins, it was difficult to determine what was displayed on the screen.
Why this approach?
Capturing screenshots only on failure avoids generating unnecessary screenshots for successful tests while providing visual evidence when troubleshooting failures.
7. Cucumber BDD
How did you implement Cucumber?
In my project, we used Cucumber when business-readable scenarios were useful. We created feature files using Given, When and Then, and implemented the steps in Java step-definition classes.
Feature:
Scenario: Successful login Given user is on login page When user enters valid username And user enters valid password And user clicks login Then dashboard should be displayed
Step definition:
@When("user clicks login") public void clickLogin() { loginPage.clickLogin(); }
Problem?
Business stakeholders were not always comfortable understanding technical automation code.
Why Cucumber?
Cucumber allowed us to express scenarios in business-readable language. It improved communication between QA, developers and business teams.
Important:
Don't say:
"I used Cucumber because everyone uses it."
Say:
"I used Cucumber where BDD and business-readable specifications provided value."
8. API Testing – Postman
How did you implement API testing?
I created Postman collections for different modules. I validated status codes, response body, headers, response time and business rules.
Example:
pm.test("Status code is 200", function () { pm.response.to.have.status(200); });
I also validated response data:
let response = pm.response.json(); pm.expect(response.status) .to.eql("SUCCESS");
Problem?
UI testing alone could not verify whether backend services were returning correct data. Some UI failures were actually caused by API issues.
Why API testing?
API testing allowed us to validate backend functionality independently and identify whether an issue originated from the UI or backend.
9. API Chaining
How did you implement API chaining?
Suppose:
Login API ↓ Token ↓ Create User API ↓ User ID ↓ Get User API
After Login:
let response = pm.response.json(); pm.environment.set( "token", response.token );
Then:
Authorization: Bearer {{token}}
After Create User:
let response = pm.response.json(); pm.environment.set( "userId", response.id );
Next API:
/users/{{userId}}
Problem?
APIs were dependent on values generated by previous APIs, such as authentication tokens and user IDs.
Why this approach?
API chaining allowed me to automate the complete business workflow rather than testing every API independently with hardcoded values.
10. SQL Validation
How did you use SQL in your project?
I used SQL primarily for backend validation. After performing an operation through the UI or API, I verified whether the corresponding database record was correctly inserted or updated.
For example, after user registration:
SELECT * FROM users WHERE uan = '1234567890';
I verified:
- Record exists
- Name is correct
- Status is correct
- Mobile number is correct
- Created date is correct
Problem?
UI validation alone could confirm that a success message appeared, but it did not guarantee that the data was correctly persisted in the database.
Why SQL validation?
Database validation helped verify data integrity and identify whether problems were in the UI, API or database layer.
11. Regression Testing
How did you select regression test cases?
I selected regression cases using risk and business impact. I prioritized critical business flows, areas affected by recent changes, integration points and historically defect-prone functionality.
For example:
Login ↓ Registration ↓ Profile Update ↓ Transaction ↓ Logout
Problem?
The application had a large number of test cases, and executing everything manually for every release was time-consuming.
Why this approach?
Risk-based regression ensured that the most important functionality was tested first and reduced the possibility of missing high-impact defects.
12. Automation – What did you automate?
How would you answer?
I primarily automated stable and repetitive regression scenarios such as login, registration, profile update, search, data validation and end-to-end business workflows.
Problem?
Manual execution was:
- Time-consuming
- Repetitive
- Error-prone
Why automation?
These scenarios were executed repeatedly across releases, so automation provided good ROI and faster feedback.
Important:
If interviewer asks:
"Did you automate everything?"
Answer:
No. I don't believe everything should be automated. I prioritize stable, repetitive, high-volume and business-critical scenarios.
13. Jenkins CI/CD
How did you implement Jenkins?
We integrated the automation framework with Jenkins. The source code was maintained in Git, and Jenkins checked out the latest code, built the project using Maven and executed the TestNG regression suite.
Flow:
Developer Commit ↓ Git ↓ Jenkins ↓ Maven ↓ TestNG ↓ Selenium ↓ Report
Example Maven command:
mvn clean test
Problem?
Previously, testers had to manually execute the regression suite, which delayed feedback.
Why Jenkins?
Jenkins allowed us to execute tests automatically and provide faster feedback after code changes or on scheduled runs.
14. Git
How did you use Git?
We used Git for source-code management. Each tester/developer worked on a feature or bug-fix branch and created commits for their changes.
Typical flow:
git checkout -b feature/login git add . git commit -m "Added login automation" git push origin feature/login
Then a Pull Request was created for review.
Problem?
Multiple team members were modifying automation code simultaneously.
Why Git?
Git provided version control, branching, history, collaboration and rollback capabilities.
15. JMeter Performance Testing
How did you implement JMeter?
I created JMeter test plans with Thread Groups, HTTP Requests, CSV Data Set Config, JSON Extractors, Assertions and listeners/reporting.
Example:
Thread Group ↓ Login API ↓ JSON Extractor ↓ Search API ↓ Product API ↓ Assertions
Problem?
We needed to determine whether the application could handle expected concurrent users without unacceptable response times or error rates.
Why JMeter?
JMeter allowed us to simulate multiple virtual users and measure response time, throughput and error percentage.
16. JMeter Correlation
How did you implement correlation?
Suppose Login API returns:
{ "token": "ABC123" }
I used a JSON Extractor:
Variable Name = token JSON Path = $.token
Then the next request uses:
Bearer ${token}
Problem?
The token was dynamically generated for every login, so I couldn't hardcode it.
Why correlation?
Correlation allowed the performance script to behave like a real user session using dynamic values.
17. Handling Dynamic Test Data
How did you implement test data management?
Depending on the requirement, I used CSV, JSON, Excel, database queries or API-generated data.
For example, for multiple login users:
username,password user1,password1 user2,password2 user3,password3
The automation framework reads the data and executes the same test with different values.
Problem?
Hardcoded data caused:
- Duplicate code
- Data conflicts
- Difficult maintenance
Why this approach?
Externalizing test data separates test logic from test data and makes data-driven testing easier.
18. Handling Multiple Environments
How did you handle QA, UAT and staging?
I maintain environment-specific configuration.
For example:
qa.url=https://qa.example.com uat.url=https://uat.example.com staging.url=https://staging.example.com
The environment is passed as a parameter:
mvn test -Denv=qa
Problem?
URLs, credentials, API endpoints and other configuration values were different across environments.
Why this approach?
It prevents environment-specific values from being hardcoded in test cases and makes the framework reusable.
19. Failed Automation / Flaky Test
Interviewer: What problem did you face with automation?
Strong answer:
One challenge I faced was intermittent failures where a test passed locally but failed occasionally in Jenkins.
I analyzed:
- Screenshots
- Logs
- Execution reports
- Browser behavior
- API responses
I found that the application was loading some elements asynchronously.
I replaced fixed waits with appropriate explicit waits.
Why?
Because the issue was synchronization-related, increasing the fixed sleep would only hide the problem and make execution slower.
Result:
The stability of the test suite improved significantly.
20. Production Defect
How did you handle a production defect?
First, I reproduced the issue and collected evidence. Then I checked application logs, API responses and database records where applicable.
For example:
User Registration ↓ UI Success ↓ API Response ↓ Database Record
If UI showed success but the database record was missing, I would investigate the backend/API layer.
Problem?
Production issue affecting users.
Why this approach?
I use a layered investigation approach instead of assuming that every UI problem is a UI defect.
21. Defect Not Fixed by Developer
How would you handle it?
I first discuss the issue with the developer and provide evidence.
For example:
Expected: User should receive OTP. Actual: OTP is not generated.
I provide:
- Test data
- Steps
- Screenshot
- API evidence
- Logs
- Requirement reference
Why?
Evidence-based communication avoids personal disagreement and makes it easier for the developer to understand the business impact.
If still unresolved:
I involve the BA/Product Owner/QA Lead based on the severity and impact.
22. Test Case Prioritization
How did you prioritize test cases?
I classify them based on:
Business Impact Risk Frequency of Usage Recent Code Changes Integration Production History
Example:
For a government registration system:
High priority:
Registration Aadhaar/identity verification OTP Login Profile update
Lower priority:
Cosmetic UI changes Non-critical informational pages
Why?
If testing time is limited, I want the highest business risk to receive the maximum testing attention.
23. Test Estimation
How did you estimate testing effort?
I consider:
Requirements + Complexity + Number of Test Cases + Test Data + Environment + Integration + Regression + Defect Retesting + Automation + Risk Buffer
Example:
Suppose:
100 test cases Average execution = 10 minutes
Approximate manual execution:
100 × 10 = 1,000 minutes ≈ 16.7 hours
Then I add time for:
- Setup
- Defect reporting
- Retesting
- Regression
- Communication
Why?
I don't estimate only execution time; I include the complete QA lifecycle.
24. Release Readiness
How would you decide whether to recommend release?
I check:
Requirement Coverage ↓ Functional Testing ↓ Regression ↓ Critical Defects ↓ Integration ↓ Performance/Security where applicable ↓ Known Risks
Example answer:
I would recommend release if all critical business scenarios pass, there are no open blocker/critical defects without an approved exception, regression is completed, and remaining known issues have acceptable business impact.
Why?
Release readiness should be based on risk and business impact, not simply on the percentage of passed test cases.
25. QA Status Reporting
How did you report status?
I normally provide:
Testing Status: 85% Total TC: 200 Executed: 170 Passed: 155 Failed: 10 Blocked: 5 Critical Defects: 0 High: 2 Medium: 5 Low: 3 Risk: Payment module pending
Then:
QA Recommendation: Not Ready
or:
QA Recommendation: Ready with known risks.
Why?
Management generally needs a concise view of progress, risks, blockers and release readiness rather than detailed test-case-level information.
26. Automation ROI
How did you justify automation?
Suppose:
Manual regression: 80 hours Automated execution: 10 hours Maintenance: 10 hours
Potential saving:
80 - 20 = 60 hours
If regression runs every sprint, the saving compounds over multiple releases.
Why?
I prioritize automation where tests are stable, repetitive and frequently executed because that provides better ROI.
27. Code Review
How do you review another tester's automation code?
I check:
Locators Waits Assertions POM Exception Handling Naming Duplicate Code Logging Reporting Data Management Thread Safety
For example, if I see:
Thread.sleep(10000);
I ask whether an explicit wait can be used.
If I see:
driver.findElement(...);
repeated 20 times, I check whether it should be encapsulated in a Page Object or reusable method.
Why?
The goal of code review is not just to find mistakes. It is to improve maintainability, reliability and consistency.
28. Mentoring Junior Testers
How did you mentor junior testers?
I started with basic concepts such as requirement analysis, test scenario creation and defect reporting. Then I gradually introduced API testing, SQL and automation.
For automation, I used a progression:
Java Basics ↓ Selenium ↓ TestNG ↓ POM ↓ Framework ↓ API ↓ CI/CD
Problem?
Junior testers often know the tool but don't know why it is used.
Why this approach?
I prefer hands-on mentoring where the tester works on a real feature and learns through code reviews and debugging.
29. Conflict Management
Example:
Two testers disagree about whether a defect is valid.
Tester A:
"This is a bug."
Tester B:
"This is expected behavior."
My approach:
- Check requirement.
- Check acceptance criteria.
- Reproduce behavior.
- Check previous implementation.
- Discuss with BA/Product Owner if requirement is unclear.
Why?
Requirements should be the source of truth rather than personal opinions.
30. Developer vs QA Conflict
Example:
Developer says:
"It works on my machine."
My response:
"Let's reproduce it together using the same environment and test data."
I provide:
Environment Browser Build Test Data Steps Expected Actual Logs Screenshot
Why?
This turns a disagreement into a technical investigation.
31. 1000 Test Cases + One Day
Interviewer: What will you do?
I would say:
I would not randomly select 500 test cases. I would use risk-based testing.
Priority:
P0 Critical ↓ P1 High ↓ Recent Changes ↓ Integration ↓ Critical Regression ↓ Remaining Cases
I would also use automation where available.
Then I would communicate:
"Given the one-day constraint, I can validate the critical business scope, but complete regression cannot be guaranteed."
Why?
It is better to communicate testing risk transparently than to claim full coverage without actually achieving it.
32. Testing Time Reduced by 50%
Example:
Originally:
10 days
Now:
5 days
I would:
- Identify critical functionality.
- Review recent changes.
- Reduce low-risk scope.
- Run smoke tests first.
- Use automation.
- Parallelize testing among team members.
- Communicate residual risk.
Why?
I optimize the testing strategy instead of simply cutting test cases arbitrarily.
33. Multiple Projects
How do you manage them?
I use a priority matrix:
| Project | Priority | Release | Risk |
|---|---|---|---|
| Project A | High | Friday | High |
| Project B | Medium | Next week | Medium |
| Project C | Low | Next month | Low |
I focus first on high-risk/high-priority work.
Why?
This prevents urgent work from being mixed with normal-priority tasks and makes resource planning easier.
34. Critical Production Issue
Example:
Suppose users cannot complete registration.
I would:
Incident ↓ Impact Assessment ↓ Reproduce ↓ Logs ↓ API ↓ DB ↓ Developer Fix ↓ QA Validation ↓ Production Verification ↓ RCA
Why?
For production issues, restoring service and identifying root cause are both important.
35. QA Metrics
What metrics would you report?
I would track:
Test Execution
Planned Executed Passed Failed Blocked
Defect
Open Closed Reopened Severity Defect Leakage
Automation
Automation Coverage Pass Rate Execution Time Flaky Tests
Why?
Metrics should help management understand quality and risk, not simply create numbers.
36. Selenium Framework Architecture
Interviewer: Explain your framework.
A strong answer:
My framework follows a layered architecture.
Test Layer ↓ Page Object Layer ↓ Utility Layer ↓ Driver/Configuration Layer ↓ Reporting Layer
Example:
src/test/java │ ├── tests ├── pages ├── utilities ├── listeners ├── base └── testdata src/test/resources │ ├── config └── features
Technology:
Java Selenium TestNG Maven Cucumber Git Jenkins Allure/Extent
Problem it solved:
It reduced duplicate code and made maintenance easier.
Why this architecture?
Separation of concerns allows individual components to be changed without impacting the entire framework.
37. Why Java + Selenium?
Answer:
Selenium provides browser automation capabilities, while Java gives us a mature programming ecosystem and strong support for frameworks such as TestNG, Maven and Cucumber.
Problem:
We needed:
- Cross-browser testing
- Reusable automation
- CI/CD integration
Why?
Java + Selenium integrates well with our existing automation ecosystem and provides flexibility for building a scalable framework.
38. Why TestNG?
Answer:
I use TestNG because it provides annotations, assertions, DataProvider, grouping, parallel execution, listeners and integration with Maven/Jenkins.
Problem:
We needed:
Parallel execution Data-driven testing Grouping Reporting Setup/cleanup
Why?
TestNG provides these capabilities without requiring us to build them from scratch.
39. Why Postman?
Answer:
I use Postman for API development, functional testing and automation of REST APIs.
I validate:
Status Code Response Body Headers Schema Response Time Business Rules Authentication
Problem:
UI testing couldn't validate backend services independently.
Why?
Postman allows faster feedback and helps isolate backend issues from UI issues.
40. Why Jenkins?
Answer:
Jenkins automates test execution and provides continuous feedback.
Example:
Git Commit ↓ Jenkins ↓ Maven ↓ Automation ↓ Reports
Problem:
Manual regression execution delayed feedback.
Why?
Jenkins allows scheduled and event-driven automation execution and integrates well with Git and Maven.
41. Why SQL for QA?
Answer:
SQL allows me to validate backend data and investigate defects.
Example:
After registration:
SELECT * FROM user_registration WHERE uan = '123456';
I verify that:
Registration Status = SUCCESS Mobile = Expected Name = Expected
Why?
UI validation alone isn't always sufficient to confirm database persistence and data integrity.
42. Why API Testing?
Answer:
APIs are the communication layer between applications and services. Testing them independently helps identify backend problems early.
Example:
UI ↓ API ↓ Database
If UI fails, API testing can help determine where the problem exists.
Why?
API testing provides faster execution and better backend coverage than relying only on UI tests.
43. Why Performance Testing?
Answer:
Functional testing verifies whether the application works correctly for individual users, but performance testing determines how the application behaves under load.
I measure:
Response Time Throughput Error Rate Concurrent Users CPU Memory Database Performance
Why JMeter?
JMeter can simulate multiple virtual users and supports HTTP/API testing, parameterization, correlation and reporting.
44. What if automation fails but manual testing passes?
Answer:
I first determine whether the failure is due to the application, test data, environment or automation script.
My investigation:
Automation Failure ↓ Check Screenshot ↓ Check Logs ↓ Check Locator ↓ Check Wait ↓ Check Test Data ↓ Manual Reproduction ↓ API/DB Validation
If manual testing passes consistently, I investigate the automation before reporting it as an application defect.
Why?
An automation failure does not automatically mean the application is defective.
45. What if manual testing fails but automation passes?
Same principle.
I reproduce manually and compare:
Environment Browser Test Data User API Database Execution Steps
Sometimes automation may be bypassing a validation or using different test data.
Strong answer:
I don't trust either manual or automation results blindly. I compare the actual behavior and evidence to determine the root cause.
46. How do you handle flaky tests in CI/CD?
I:
- Identify the failure pattern.
- Check logs/screenshots.
- Identify synchronization problems.
- Check environment stability.
- Fix locators/waits.
- Validate repeatedly.
- Track the test separately if needed.
I may use a limited retry mechanism, but:
I don't use retries as a permanent solution for flaky tests.
47. What would you do if automation execution takes 6 hours?
I would analyze:
Test Count Average Execution Time Sequential Execution Waits Browser Startup API Calls Database Calls
Then optimize:
- Parallel execution
- Remove unnecessary waits
- Optimize test data
- Run smoke/regression selectively
- Reuse setup where safe
- Run tests in parallel browsers/grid
For example:
6 hours sequential ↓ Parallel execution ↓ 2 hours
The exact improvement depends on test independence and infrastructure.
48. What if a requirement changes frequently?
Answer:
I first identify whether the requirement is still evolving or finalized.
For automation:
I avoid automating highly unstable functionality too early unless there is a clear business benefit.
For test cases:
I maintain traceability so that requirement changes can be mapped to affected scenarios.
Why?
This prevents unnecessary rework and keeps automation maintenance manageable.
49. What if the environment is unstable?
Answer:
First, I verify whether the issue is actually environment-related.
I check:
Application Availability API Health Database Network Server Logs Build Version Configuration
If confirmed, I report it as an environment blocker with evidence.
Then I:
- Continue testing independent modules where possible.
- Track blocked cases.
- Communicate impact.
- Resume blocked testing once environment is stable.
Strong statement:
I don't mark environment-related failures as application defects without sufficient evidence.
50. Why should we hire you?
For your profile, I recommend giving a shorter and more natural answer rather than a memorized long speech:
I have more than 6 years of experience in software testing across manual, automation, web, mobile and API testing. I have hands-on experience with Selenium, Java, TestNG, Cucumber, Playwright, Postman, SQL, JMeter, Git and Jenkins.
My strength is that I understand testing from both functional and technical perspectives. I can analyze requirements, design test scenarios, automate regression, validate APIs and databases, investigate failures and work with developers to identify root causes.
I also have experience with Agile processes and coordinating with different teams. I focus on risk-based testing and improving the overall QA process rather than just executing test cases.
I believe my combination of hands-on technical skills, testing experience and team coordination makes me a good fit for this role.
🎯 The Golden Formula for Your Interview
For almost any technical question, use this structure:
1. What?
Explain the concept.
2. How?
Explain how you implemented it.
3. Problem?
Explain the real project challenge.
4. Why?
Explain why you selected that solution.
5. Result?
Explain the benefit.
For example:
Interviewer: Why did you use Explicit Wait?
Your answer:
What: Explicit Wait waits for a specific condition.
How: I created reusable wait methods using
WebDriverWaitandExpectedConditions.Problem: Our application had dynamically loaded Angular elements, which caused intermittent failures.
Why: I selected Explicit Wait because the elements were not available immediately and fixed sleeps were inefficient.
Result: The automation became more stable and execution time was reduced because we waited only as long as necessary.
This style makes your answer sound like real project experience rather than a textbook definition.
🔥 Most important questions to practice verbally
If you have limited time before the interview, practice these 15 first:
- Explain your automation framework.
- Explain your project and responsibilities.
- How did you implement POM?
- How did you handle dynamic elements?
- How did you handle flaky tests?
- How did you implement parallel execution?
- How did you capture screenshots on failure?
- How did you integrate Selenium with Jenkins?
- How did you perform API testing?
- How did you perform API chaining?
- How did you use SQL in your project?
- How did you select regression test cases?
- How did you handle a critical production defect?
- How did you resolve conflict with a developer?
- Why should we hire you?
These 15 questions can generate many follow-up questions, so being able to answer them with a concrete project example will make you much stronger in the interview.
Absolutely. Below are interview-ready answers for all 15 questions, written in a way you can speak directly in an interview. I’ve included project example + problem + solution + why + result wherever useful.
1. Explain your automation framework
Interview Answer
In my project, I worked with a hybrid automation framework using Java, Selenium, TestNG, Maven, Page Object Model, Cucumber, Git and Jenkins.
The framework was designed with separate layers for test cases, page objects, utilities, configuration, test data, reporting and listeners.
The basic architecture was:
Automation Framework | ----------------------------------------- | | | | | Tests Pages Utilities Config Reports | | | | | TestNG POM Waits QA/UAT Allure/ Cucumber Locators Screenshots Extent | Driver | Selenium
Typical project structure
src/test/java │ ├── tests │ ├── LoginTest.java │ ├── RegistrationTest.java │ └── ProfileTest.java │ ├── pages │ ├── LoginPage.java │ ├── DashboardPage.java │ └── RegistrationPage.java │ ├── utilities │ ├── WaitUtil.java │ ├── ScreenshotUtil.java │ └── ExcelUtil.java │ ├── base │ └── BaseTest.java │ ├── listeners │ └── TestListener.java │ └── config └── ConfigReader.java
How execution works
Test Case ↓ Page Object ↓ Selenium WebDriver ↓ Browser ↓ Assertion ↓ TestNG Result ↓ Report
Problem I faced
Initially, some automation scripts had locators and test logic mixed together. When the UI changed, maintaining the scripts became difficult.
Solution
I implemented POM and reusable utility methods. Locators were maintained in Page Object classes, while common functions such as waits, screenshots and configuration were centralized.
Why this approach?
It provides reusability, maintainability, scalability and better separation of concerns.
Result
The framework became easier to maintain, and new test cases could be added without duplicating existing code.
2. Explain your project and responsibilities
Interview Answer
I have worked on web-based applications where my responsibilities included both manual and automation testing. My role covered the complete QA lifecycle, starting from requirement analysis through test execution, defect management, regression and release validation.
My responsibilities included:
Requirement Analysis
I reviewed requirements and acceptance criteria and identified test scenarios, dependencies and risks.
Test Design
I prepared test scenarios, test cases and test data covering positive, negative, boundary and integration scenarios.
Functional Testing
I performed functional, regression, smoke, sanity and end-to-end testing.
API Testing
I used Postman to validate APIs, including status codes, response body, authentication, headers and business rules.
Database Testing
I used SQL queries to validate backend data.
Automation
I automated stable and repetitive regression scenarios using Selenium with Java and TestNG.
Defect Management
I logged and tracked defects in JIRA, provided evidence and worked with developers for resolution.
CI/CD
I worked with Git and Jenkins for source-code management and automated test execution.
Example workflow
Requirement ↓ Test Scenario ↓ Test Cases ↓ Functional Testing ↓ API/DB Validation ↓ Automation ↓ Regression ↓ Defect Retesting ↓ Release Validation
Strong closing statement
My main responsibility was not only finding defects but also ensuring that the application met business requirements and that the overall testing process provided sufficient confidence for release.
3. How did you implement POM?
Interview Answer
I implemented Page Object Model by creating a separate Java class for each major page or reusable component.
For example:
LoginPage RegistrationPage DashboardPage ProfilePage
The Page Object contained:
- Locators
- Page actions
- Reusable methods
Example:
public class LoginPage { WebDriver driver; By username = By.id("username"); By password = By.id("password"); By loginButton = By.id("login"); public LoginPage(WebDriver driver) { this.driver = driver; } public void enterUsername(String user) { driver.findElement(username).sendKeys(user); } public void enterPassword(String pass) { driver.findElement(password).sendKeys(pass); } public void clickLogin() { driver.findElement(loginButton).click(); } }
Test:
@Test public void loginTest() { LoginPage loginPage = new LoginPage(driver); loginPage.enterUsername("admin"); loginPage.enterPassword("admin123"); loginPage.clickLogin(); Assert.assertTrue( driver.getTitle().contains("Dashboard") ); }
Problem
When locators were directly inside test scripts, UI changes required modifications in multiple places.
Why POM?
With POM, if the username locator changes, I update it only in
LoginPage.
Result
It improved code reusability, readability and maintainability.
4. How did you handle dynamic elements?
Interview Answer
I handled dynamic elements using a combination of stable locators, dynamic XPath/CSS selectors and explicit waits.
Suppose the application generates:
user_12345 user_67890 user_98765
Instead of:
//input[@id='user_12345']
I would use:
//input[contains(@id,'user_')]
Example:
By username = By.xpath("//input[contains(@id,'user_')]");
Problem
The application generated dynamic IDs, so the complete ID was changing between executions.
Solution
I identified the static portion of the attribute and created a dynamic locator.
I also use explicit waits:
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); WebElement element = wait.until( ExpectedConditions.visibilityOfElementLocated( username ) );
Why?
A stable locator alone is not enough if the element is dynamically loaded. I need both reliable identification and proper synchronization.
5. How did you handle flaky tests?
Interview Answer
First, I don't immediately add retries. I investigate why the test is flaky.
My approach is:
Test Failure ↓ Check Screenshot ↓ Check Logs ↓ Check Locator ↓ Check Wait ↓ Check Test Data ↓ Check Environment ↓ Reproduce ↓ Root Cause ↓ Fix
Example
I faced a situation where a test passed locally but failed intermittently in Jenkins.
After investigation, I found that a button was loaded asynchronously after an API response.
The script was doing:
driver.findElement( By.id("submit") ).click();
I changed it to:
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20)); wait.until( ExpectedConditions.elementToBeClickable( By.id("submit") ) ).click();
Problem
The application was dynamic and the test was not synchronized correctly.
Why this solution?
Explicit wait synchronizes the automation with the actual application state instead of waiting for an arbitrary fixed time.
Result
The test became more stable.
Important interview statement
I consider retries a temporary safety mechanism, not a solution for flaky automation.
6. How did you implement parallel execution?
Interview Answer
We had a large regression suite and sequential execution was taking several hours, so I implemented parallel execution using TestNG.
Example:
<suite name="Regression" parallel="tests" thread-count="4">
TestNG can execute:
methods classes tests instances
depending on the requirement.
Problem
Suppose:
200 test cases Sequential execution = 4 hours
Solution
We divided execution across multiple threads.
Thread 1 → Tests 1–50 Thread 2 → Tests 51–100 Thread 3 → Tests 101–150 Thread 4 → Tests 151–200
Important consideration
WebDriver must be thread-safe. I avoid sharing the same driver instance across parallel tests. I can use
ThreadLocal<WebDriver>to maintain an independent driver per thread.
Example:
private static ThreadLocal<WebDriver> driver = new ThreadLocal<>();
Why?
Parallel execution reduces regression execution time and provides faster feedback.
Result
The overall execution time was significantly reduced, depending on infrastructure and test independence.
7. How did you capture screenshots on failure?
Interview Answer
I implemented a TestNG
ITestListenerand captured screenshots in theonTestFailure()method.
Example:
public class TestListener implements ITestListener { @Override public void onTestFailure( ITestResult result) { TakesScreenshot ts = (TakesScreenshot) driver; File source = ts.getScreenshotAs( OutputType.FILE ); // Save screenshot } }
Problem
When a test failed in Jenkins, I couldn't directly see the browser state at the time of failure.
Solution
I captured:
- Screenshot
- Test name
- Exception
- Logs
Why only failed tests?
Taking screenshots for every test generates unnecessary files and increases report size.
Result
Debugging failed automation became much easier.
8. How did you integrate Selenium with Jenkins?
Interview Answer
I integrated the automation framework with Jenkins so that tests could execute automatically instead of requiring manual execution.
The workflow was:
Developer Code ↓ Git ↓ Jenkins ↓ Maven ↓ TestNG ↓ Selenium ↓ Browser ↓ Test Results ↓ Report
Jenkins executes:
mvn clean test
We can also pass environment parameters:
mvn clean test -Denv=qa
Problem
Manual regression execution was time-consuming and delayed feedback.
Why Jenkins?
Jenkins provides CI/CD integration, scheduled execution, parameterized execution and automated reporting.
Example
We could schedule:
Nightly Regression
or trigger execution after code changes.
Result
QA received faster feedback about application stability.
9. How did you perform API testing?
Interview Answer
I used Postman for API testing. I created collections based on application modules and validated both technical and business-level responses.
For each API, I validated:
Request
- URL
- HTTP method
- Headers
- Query parameters
- Request body
- Authentication
Response
- Status code
- Response body
- Headers
- Response time
- Business rules
Example:
pm.test("Status code is 200", function () { pm.response.to.have.status(200); });
Then:
let response = pm.response.json(); pm.test("Status is SUCCESS", function () { pm.expect(response.status) .to.eql("SUCCESS"); });
Problem
Sometimes a UI issue was actually caused by the backend API.
Why API testing?
API testing helps validate backend functionality independently of the UI and makes defect isolation faster.
Example
UI ↓ API ↓ Database
If UI fails, I can test the API separately to determine where the issue is.
10. How did you perform API chaining?
Interview Answer
API chaining means taking a dynamic value from one API response and using it in another API request.
For example:
Login API ↓ Access Token ↓ Create User API ↓ User ID ↓ Get User API
Suppose Login returns:
{ "token": "ABC123" }
I store it:
let response = pm.response.json(); pm.environment.set( "token", response.token );
Then next API:
Authorization: Bearer {{token}}
If Create User returns:
{ "id": 10025 }
I store:
let response = pm.response.json(); pm.environment.set( "userId", response.id );
Then:
/users/{{userId}}
Problem
Values such as tokens, session IDs and user IDs were dynamically generated.
Why chaining?
Hardcoding these values would make the test unreliable and difficult to maintain.
Result
The complete API business workflow could be automated using dynamic data.
11. How did you use SQL in your project?
Interview Answer
I used SQL mainly for backend validation and defect investigation.
For example, after registering a user through the UI, I validated the database record.
SELECT * FROM users WHERE uan = '1234567890';
I verified:
Name Mobile Email Status Created Date Registration ID
Example workflow
UI Registration ↓ API ↓ Database ↓ SQL Validation
Problem
The UI might display a success message, but that doesn't always confirm that the data was correctly persisted.
Why SQL?
Database validation helped me verify data integrity and determine whether an issue was in the UI, API or database layer.
Another example
Finding second-highest salary:
SELECT MAX(salary) FROM employee WHERE salary < ( SELECT MAX(salary) FROM employee );
12. How did you select regression test cases?
Interview Answer
I selected regression test cases using a risk-based approach rather than simply executing test cases randomly.
I consider:
- Critical business functionality
- Recent code changes
- Integration points
- High-risk modules
- Historically defect-prone areas
- Customer-facing functionality
- Production defects
- Automation availability
Example
For a registration application:
High priority:
Login Registration OTP Identity verification Profile update Transaction Logout
Problem
The application had a large number of test cases, and executing the complete suite manually for every release was not practical.
Why risk-based regression?
It ensures that critical and high-risk functionality gets tested first.
Example prioritization
P0 → Critical business flow P1 → High-risk functionality P2 → Medium-risk functionality P3 → Low-risk/cosmetic
Strong statement
If time is limited, I would rather communicate the remaining testing risk clearly than claim that complete regression has been performed when it hasn't.
13. How did you handle a critical production defect?
Interview Answer
For a critical production issue, my first priority is to understand the business impact and reproduce the problem quickly.
My approach is:
Production Issue ↓ Impact Assessment ↓ Reproduce ↓ Collect Evidence ↓ API Validation ↓ Database Validation ↓ Developer Investigation ↓ Fix ↓ QA Validation ↓ Regression ↓ Production Verification ↓ RCA
Example
Suppose users are unable to complete registration.
I would check:
UI ↓ API ↓ Database
If the UI sends the request correctly but the API returns a 500 error, I would provide the API request/response details to the developer.
Problem
The issue is impacting real users and potentially blocking a critical business process.
Why this approach?
It helps identify the root cause quickly instead of spending time investigating the wrong layer.
After the fix
I perform:
- Retesting
- Regression
- Production verification
- RCA
- Additional test coverage
Strong statement
For a production defect, communication is as important as technical investigation. I keep stakeholders informed about impact, status, workaround and validation.
14. How did you resolve conflict with a developer?
Interview Answer
If a developer disagrees with a defect, I don't treat it as a personal conflict. I focus on evidence and requirements.
For example, if I report:
"OTP is not generated."
The developer says:
"It is working correctly."
I provide:
Environment Build Version Test Data Steps Expected Result Actual Result Screenshot API Request API Response Logs Requirement Reference
Then I reproduce the issue with the developer if necessary.
If the requirement is unclear
I involve the:
- Business Analyst
- Product Owner
- QA Lead
Problem
The disagreement may be caused by:
- Different environments
- Different test data
- Requirement misunderstanding
- Actual defect
Why this approach?
Evidence-based discussion helps us solve the problem rather than arguing about who is right.
Excellent interview statement
"My objective is not to prove that the developer is wrong; my objective is to make sure the application behaves according to the agreed requirement."
15. Why should we hire you?
This is the answer I recommend you memorize in terms of points, not word-for-word.
Interview Answer
I believe I am a good fit for this role because I bring more than 6 years of experience in software testing across manual, web, mobile and API testing.
I have hands-on experience with Selenium, Java, TestNG, Cucumber, Playwright, Postman, SQL, JMeter, Git and Jenkins.
I understand the complete QA lifecycle, including requirement analysis, test planning, test case design, functional testing, regression, API testing, database validation, automation and release validation.
One of my strengths is troubleshooting. When a test fails, I don't immediately assume it is an application defect. I investigate whether the issue is related to the application, API, database, test data, environment or automation script.
I also focus on risk-based testing and automation ROI. I automate stable, repetitive and business-critical scenarios rather than trying to automate everything.
From a team perspective, I can work effectively with developers, business analysts and other QA members, and I can also mentor junior testers and contribute to improving the overall QA process.
So, I believe I bring a combination of technical testing skills, automation experience, problem-solving ability and team collaboration, which would allow me to contribute effectively to this role.
For your interview, don't stop after the definition.
For example, don't say only:
"I know Page Object Model. It separates locators from test cases."
Instead say:
"I implemented POM in my project because we had multiple regression scripts using the same pages. Initially, locators were duplicated across test cases. When the UI changed, maintenance became difficult. So I created separate Page Object classes and moved the locators and page actions there. This reduced duplication and made maintenance easier."
That small addition — "Initially we had a problem → I implemented a solution → here is why → here was the result" — makes your answer sound much more like genuine project experience.
For any follow-up question, remember:
WHAT → HOW → PROBLEM → SOLUTION → WHY → RESULT
Example:
What: I used explicit waits.
How: I implementedWebDriverWaitwithExpectedConditions.
Problem: Dynamic elements were causing intermittent failures.
Solution: I waited for the required element state.
Why: It was better than fixedThread.sleep().
Result: Test stability improved and unnecessary waiting was reduced