Selenium Interview Questions and Answers
Selenium Interview Questions and Answers
Answer:
Selenium is an open-source suite for automating web browsers. It enables testers to write scripts in
multiple languages (Java, Python, C#, etc.) to simulate user actions and validate web applications.
Core components:
Example:
driver.get("https://example.com");
System.out.println(driver.getTitle());
driver.quit();
Interview Tip: Highlight that WebDriver provides direct OS-level communication with browsers,
unlike Selenium RC’s JavaScript injection.
Answer:
Selenium IDE Record & playback tool Limited (no coding) Manual playback in browser
Tip: Say – “WebDriver + Grid are industry standards today; IDE is for quick demos only.”
Answer:
Works only for web applications, not desktop or mobile (without Appium).
Tip: When asked, mention how you overcame these using third-party tools (e.g., Robot class, Extent
Reports, JDBC).
Answer:
Locators tell Selenium which element to interact with.
Types include:
ID
Name
Class Name
Tag Name
CSS Selector
XPath
Example:
driver.findElement(By.id("username")).sendKeys("Deepika");
driver.findElement(By.cssSelector("input[type='password']")).sendKeys("pass123");
driver.findElement(By.xpath("//button[text()='Login']")).click();
Tip: Prefer ID for speed → CSS Selector → XPath (last resort when dynamic).
Answer:
Example:
Answer:
driver.close() closes the current browser tab/window where the WebDriver is focused.
driver.quit() closes all browser windows and ends the entire WebDriver session.
Example:
Tip: Always use quit() in teardown (@AfterMethod) to free memory and avoid orphan ChromeDriver
processes.
Example:
// LoginPage.java
WebDriver driver;
this.driver = driver;
PageFactory.initElements(driver, this);
email.sendKeys(user);
password.sendKeys(pass);
loginBtn.click();
}
Tip: Mention that it reduces duplication and aligns with the Single Responsibility Principle.
Answer:
Use the Select class to interact with <select> HTML elements.
Example:
select.selectByVisibleText("India");
select.selectByValue("IN");
select.selectByIndex(2);
Tip: For non-<select> dropdowns (custom HTML), use Actions class + click() or JavaScriptExecutor.
Answer:
Web pages may have nested <iframe> tags.
Use driver.switchTo().frame() and driver.switchTo().defaultContent().
Example:
driver.switchTo().frame("frameName");
driver.findElement(By.id("button")).click();
Tip: You can switch by index, name, or WebElement. Always switch back after actions.
Answer:
Use the Alert interface to handle browser alerts.
Example:
System.out.println(alert.getText());
alert.accept(); // OK
// alert.dismiss(); // Cancel
Tip: For HTML pop-ups (not JS alerts), handle them as normal WebElements.
Q11. How do you capture screenshots in Selenium?
Answer:
Use the TakesScreenshot interface.
Example:
FileUtils.copyFile(src, dest);
Answer:
The Actions class simulates advanced user gestures like hover, drag-drop, or double-click.
Example:
act.moveToElement(menu).perform();
Tip: Always use perform() at the end to execute the built action chain.
Answer:
Waits synchronize the script with the browser’s speed.
Types:
Example:
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("loginBtn")));
Tip: Prefer explicit waits for dynamic elements instead of large implicit waits.
Answer:
Synchronization ensures Selenium commands execute only when the webpage and elements are
ready.
It avoids exceptions like ElementNotInteractableException or NoSuchElementException.
Example:
wait.until(ExpectedConditions.elementToBeClickable(loginBtn)).click();
Answer:
driver.manage().timeouts().implicitlyWait(10,
Implicit Global for driver session No
TimeUnit.SECONDS)
Specific
Explicit Yes WebDriverWait
element/condition
Example:
.withTimeout(Duration.ofSeconds(20))
.pollingEvery(Duration.ofSeconds(2))
.ignoring(NoSuchElementException.class);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("username")));
Tip: Use Fluent Wait for dynamic or slow-loading elements; combine it with ExpectedConditions for
robustness.
Answer:
XPath (XML Path Language) is a syntax used to navigate through elements and attributes in an
XML/HTML document.
In Selenium, it’s mainly used to locate elements when id or name aren’t reliable.
Example:
Tip: XPath works both on HTML and XML DOM trees → great for dynamic pages.
Answer:
Tip: Always use relative XPath; absolute breaks on small DOM changes.
Answer:
Dynamic IDs often change with each reload (e.g., ctl00_main_123).
Use functions like contains(), starts-with(), ends-with().
Example:
driver.findElement(By.xpath("//input[contains(@id,'user')]"));
driver.findElement(By.xpath("//button[starts-with(@id,'login_')]"));
Tip: Combine text and partial attribute matches for stable locators.
Answer:
Axes let you traverse relationships between elements.
Tip: Demonstrating Axis use shows deep XPath mastery—rare skill in interviews.
Answer:
Tip: Use CSS for simple static elements; XPath for dynamic and text-based search.
Answer:
driver.findElement(By.xpath("//a[text()='Login']"));
driver.findElement(By.xpath("//button[contains(text(),'Submit')]"));
Tip: text() is handy for buttons and links without unique IDs.
Answer:
driver.findElement(By.xpath("//button[@id='login' or @name='submit']"));
Answer:
driver.findElement(By.xpath("(//input[@type='text'])[2]"));
Answer:
driver.findElement(By.xpath("//input[@id='email']/parent::div"));
Tip: Useful when only the child has known locators and parent needs interaction.
Answer:
normalize-space() ignores extra spaces in text content.
driver.findElement(By.xpath("//a[normalize-space()='Sign In']"));
Answer:
driver.findElement(By.cssSelector("input[id='username']"));
driver.findElement(By.cssSelector("button[class*='submit']")); // contains
driver.findElement(By.cssSelector("div#loginForm input[type='text']"));
Answer:
Partial match
contains() //input[contains(@id,'user')]
anywhere
Answer:
System.out.println(row.getText());
Tip: Use dynamic XPath with loop index when validating grid data.
Answer:
Shadow DOM is a separate DOM tree inside elements (e.g., web components).
XPath cannot access Shadow DOM directly; you must use JavaScript Executor.
Example:
shadowRoot.findElement(By.cssSelector("#innerButton")).click();
Tip: Mention Shadow DOM handling as a plus point – rarely known detail.
Answer:
Tip: End with this as a summary if the interviewer asks your “approach to locator strategy.”
Q31. How to open multiple browser windows and switch between them?
Answer:
When a new window or tab opens, Selenium can handle it using window handles.
Example:
driver.switchTo().window(handle);
System.out.println(driver.getTitle());
// Switch back
driver.switchTo().window(parent);
Tip: Stress that getWindowHandles() returns a Set, so always iterate to find the new window.
Answer:
Use the Actions class for mouse operations.
Example:
act.dragAndDrop(src, target).perform();
Tip: Some HTML5 drag-drops fail with standard API; mention you can use JavaScriptExecutor
workaround.
Answer:
If the <input type="file"> element is present, send the file path directly.
Example:
driver.findElement(By.id("uploadFile")).sendKeys("/Users/deepika/Documents/sample.txt");
Tip: If upload uses a system dialog, use Robot class or AutoIt (Windows).
Example (Chrome):
prefs.put("download.default_directory", "/Users/deepika/Downloads");
options.setExperimentalOption("prefs", prefs);
Tip: This is a key coding challenge — remember that Selenium doesn’t handle OS dialogs.
Answer:
Use HttpURLConnection to verify response codes of all anchor tags.
Example:
conn.connect();
Answer:
Tip: Tooltips are usually stored in the title attribute or as hidden divs.
Q37. How to scroll a webpage using Selenium?
Answer:
Use JavaScriptExecutor to scroll vertically or to specific elements.
Example:
js.executeScript("window.scrollBy(0,500)");
js.executeScript("arguments[0].scrollIntoView(true);", footer);
Answer:
act.contextClick(button).perform();
Tip: Combine with Keys.ARROW_DOWN and Keys.ENTER for selecting from context menus.
Answer:
Tip: Interviewers often tweak this to “print all links in the footer.”
Answer:
System.out.println(checkbox.isDisplayed());
System.out.println(checkbox.isEnabled());
System.out.println(checkbox.isSelected());
Tip: Always combine isDisplayed() checks with waits to avoid false negatives.
Q41. How to handle dynamic web tables and fetch a cell value?
Answer:
By.xpath("//table[@id='orders']/tbody/tr[3]/td[2]")
);
System.out.println(cell.getText());
Tip: For unknown row counts, loop through tr and td using nested loops.
Answer:
Collections.sort(sorted);
Assert.assertEquals(original, sorted);
Answer:
Hidden elements can’t be accessed directly—use JavaScript.
"return document.getElementById('hidden').textContent;"
).toString();
Example:
try {
btn.click();
} catch (StaleElementReferenceException e) {
btn = driver.findElement(By.id("refresh"));
btn.click();
Answer:
Use JavaScript to temporarily change element style.
Example:
Answer:
JavaScriptExecutor allows executing JavaScript directly in the browser through WebDriver.
It’s used when native Selenium methods fail (e.g., for hidden elements, scrolling, or modifying DOM
properties).
Example:
Tip: Mention that you use it for hidden elements, performance measurements, or dynamic scrolling.
Answer:
AJAX updates elements asynchronously without reloading the page.
Hence, use Explicit Waits to ensure elements are ready before interacting.
Example:
System.out.println(message.getText());
Tip: Interviewers like when you mention “AJAX requires synchronization using WebDriverWait.”
Answer:
Headless browsers run tests without opening a visible UI — ideal for CI/CD pipelines.
Example (Chrome):
options.addArguments("--headless", "--window-size=1920,1080");
driver.get("https://example.com");
Tip: Emphasize how headless mode saves execution time in Jenkins or GitHub Actions.
Answer:
Use ChromeOptions or FirefoxOptions to accept insecure certificates.
Example:
options.setAcceptInsecureCerts(true);
Tip: Mention that this is important when automating lower environments (QA/UAT) with self-signed
certificates.
Q50. How to perform Cross-Browser Testing in Selenium?
Answer:
Use WebDriver instances for different browsers (Chrome, Edge, Firefox, Safari).
Example:
WebDriver driver;
if(browser.equalsIgnoreCase("chrome"))
else if(browser.equalsIgnoreCase("firefox"))
else
Tip: Mention Selenium Grid or cloud services like BrowserStack for large-scale compatibility testing.
Answer:
Selenium Grid allows parallel test execution across multiple browsers and machines.
It consists of:
Tip: Say you’ve used Grid to reduce test cycle time via parallelism.
Answer:
Pass credentials directly in the URL.
Example:
driver.get("https://username:[email protected]/basic_auth");
Tip: For new browser versions (where this is blocked), use Robot Class or AutoIT.
Q53. How to add browser extensions in Selenium?
Answer:
Use ChromeOptions or FirefoxProfile.
Example:
options.addExtensions(new File("/Users/deepika/Downloads/adblock.crx"));
Example:
driver.manage().addCookie(cookie);
System.out.println(driver.manage().getCookies());
driver.manage().deleteAllCookies();
Answer:
Use LogEntries and LogType.BROWSER.
Example:
System.out.println(entry.getMessage());
Example (Legacy):
caps.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
Answer:
Disable browser notifications using ChromeOptions.
Example:
options.addArguments("--disable-notifications");
Tip: Useful for e-commerce or social media apps where notification pop-ups interrupt test flow.
Answer:
Tip: Explain that automation reliability > 90% is achieved by solid waits + clean locators.
Answer:
Use the parallel attribute in testng.xml.
Example:
<test name="ChromeTest">
<parameter name="browser" value="chrome"/>
<classes><class name="tests.LoginTest"/></classes>
</test>
<test name="EdgeTest">
<classes><class name="tests.LoginTest"/></classes>
</test>
</suite>
Tip: Say that parallel execution improves efficiency by up to 50% in regression runs.
Answer:
Selenium 4 introduced the getFullPageScreenshotAs() method (for Firefox and Chrome).
Example:
Selenium Fundamentals
Coding Challenges
Encapsulation: Hiding internal state and exposing behavior through public methods.
In test automation: Page Objects encapsulate locators and low-level interactions; tests call
high-level methods (e.g., loginPage.login(user, pass)), preventing tests from depending on
internal locator changes.
Polymorphism: The ability for different classes to be treated as the same type.
In test automation: You can write methods to accept WebDriver interface or an abstract
Browser type. Also used when different page implementations provide a common interface.
// constructor + methods
// ...
@BeforeMethod
initDriver("chrome");
@Test
lp.login("user","pass");
Common Pitfalls
Explain how OOP makes tests maintainable and how you used POM (a practical example).
Mention tradeoffs: abstraction is great, but over-abstraction can hide what's being tested.
Examples
// Overloading
// Overriding
class BaseTest {
@Override
Pitfalls
Interview Tip
Give a concrete example from your framework where you used overloading for convenience
and overriding to customize behavior.
Java has four access levels for classes, methods, and variables:
2. protected — accessible within the same package and subclasses (even if in different
packages).
Keep locators (WebElement) private to prevent tests from manipulating elements directly —
expose meaningful actions through public methods in page classes.
Use protected for fields/methods you want subclasses (like specific test classes) to access but
not outsiders.
Example
// ...
// ...
Emphasize how you enforce encapsulation and why it helps minimize test breakage when UI
changes.
final (keyword)
o Final variable: value cannot be changed after initialization—useful for constants (final
String BASE_URL = "...").
finally (block)
o A block used with try-catch that always executes whether an exception occurs or not
(unless JVM exits). Use it to release resources (files, DB connections). In test
automation, finally can ensure cleanup, but prefer test framework tearDown
methods.
finalize() (method)
o A method that the garbage collector may call before collecting an object. Deprecated
and unreliable — don't rely on it. Use explicit resource management instead (try-
with-resources or explicit close()).
Example
try {
// some code
} catch(Exception e) {
// handle
} finally {
// cleanup
Pitfalls
Don’t use finalize() for essential cleanup; it’s non-deterministic. Use try-with-resources for
streams or @After teardown.
Interview Tip
Mention best practices: use final for constants and immutable references; use finally
sparingly and rely on TestNG/JUnit teardown for predictable cleanup.
Java exception handling uses try, catch, finally, and throw/throws. Exceptions are objects derived
from Throwable. There are two categories:
Pattern in automation
Use targeted catches (e.g., NoSuchElementException) when you have a fallback strategy like
retries.
Don’t swallow exceptions. Log them with stack traces or rethrow to fail the test if
appropriate.
Prefer more specific exceptions rather than catch (Exception e).
int attempts = 0;
while(attempts < 2) {
try {
driver.findElement(by).click();
break;
} catch (StaleElementReferenceException e) {
attempts++;
Pitfalls
Interview Tip
Explain how you handle expected transient exceptions (stale elements) gracefully and when
you let tests fail fast.
throws: used in a method signature to declare that the method might throw certain checked
exceptions to the caller.
Use throw when you detect an error condition and want to signal it immediately.
Use throws when a method calls code that might cause a checked exception and you don’t
want to handle it there.
Automation example
Methods that read config files can declare throws IOException and the test runner can
handle/report it.
Pitfalls
Don’t overuse throws to avoid handling errors — declare exceptions when the caller needs
to manage them.
Interview Tip
Show you understand exception propagation and how it affects test flow.
Q67. What are Collections in Java and why are they used in Selenium?
Detailed Answer
Java Collections Framework provides reusable data structures: List, Set, Queue, Map, etc. They
simplify storing, iterating and manipulating groups of objects. In Selenium, Collections are used to
store lists of WebElements, capture text, compare data sets, and assert ordered/unordered results.
Tips
Pitfalls
Interview Tip
Demonstrate using Map for parameterized test data or List to verify UI tables.
List
Set
o No duplicates allowed.
Map
Example
map.put("username", "deepika");
Interview Tip
Explain real examples: using Map to hold row->expectedValue mapping for validation.
Q69. How do you read and write data from files in Java?
Test frameworks often need to read configuration, credentials, or test data. There are multiple APIs:
prop.load(fis);
}
Best Practices
Keep credentials secure (not plain text in code or repo); use environment variables or secret
stores.
Pitfalls
Interview Tip
Show you know which format you chose and why (CSV for simple data, Excel if stakeholders
prefer spreadsheets).
static binds a variable or method to the class, not to instances. Useful for:
Example
Pitfalls
Overusing static for stateful objects (like WebDriver) can cause concurrency issues in parallel
runs. Prefer instance-level drivers or thread-local storage.
Interview Tip
String a = "hello";
In Frameworks
Pitfalls
Overuse of immutability where mutability is expected can increase object creation overhead.
Use judiciously.
Interview Tip
== compares references (whether two variables point to the same object in memory).
Example
In Automation Assertions
Always use .equals() (or Assert.assertEquals()) to check content equality. Using == on strings
or wrapper objects will lead to subtle bugs.
Interview Tip
Show you understand that for custom objects, you must override equals() and hashCode()
correctly when used in collections or comparisons.
Use-case in Automation
Build long strings (e.g., building an HTML report), constructing large log messages, or
dynamically building XPath strings in loops.
Example
Pitfalls
Avoid many string concatenations in loops with +; use StringBuilder to improve performance.
Interview Tip
Lambda expressions provide a concise way to represent an anonymous function (a block of code)
that can be passed around. They reduce boilerplate and are commonly used with Java Streams API
for functional-style data processing.
Example (Selenium)
Benefits
Pitfalls
Overly complex lambda expressions can be harder to debug; prefer clear, small lambdas.
Interview Tip
Demonstrate one use-case where a lambda reduced several lines of imperative code into a
succinct operation (e.g., filtering elements).
Q75. How do you use Streams in Java 8 for Selenium automation?
.stream()
.map(WebElement::getText)
.map(String::trim)
.collect(Collectors.toList());
Common Operations
Benefits in automation
Pitfalls
Streams can be less readable for complex logic; break into steps or use helper methods.
Interview Tip
Mention that streams simplified a data validation scenario (e.g., comparing API response list
with UI list).
Detailed Explanation
Array
o Fixed size; can store primitives and objects; direct indexing is fast.
ArrayList
list.add("one");
Interview Tip
Explain why you use ArrayList to store WebElement results (dynamic and integrated with
Streams).
Example
WebDriver createDriver();
Benefits
Interview Tip
Give an example where you used an interface to support local and remote drivers (or to
decouple logging/reporting implementations).
Abstract class
o Can have state (fields) and implemented methods.
Interface
o Defines a contract; before Java 8, could only have abstract methods. Now supports
default and static methods.
When to use
Use abstract classes for BaseTest where you provide common setup with fields.
Use interfaces for capabilities (e.g., Loggable, Retryable) that many unrelated classes might
implement.
Interview Tip
Show you choose the right tool: BaseTest as abstract class (shared code), and IDriverFactory
as an interface for pluggable drivers.
Synchronization controls access to shared resources by multiple threads to prevent race conditions.
In automation, synchronization matters when running tests in parallel threads (TestNG parallel
execution). Without proper synchronization, shared data (logs, singletons) can get corrupted.
Example
// thread-safe logging
Alternatives
Use ConcurrentHashMap, ThreadLocal (e.g., ThreadLocal<WebDriver>) to isolate driver per
thread.
Pitfalls
Interview Tip
Demonstrate you used ThreadLocal<WebDriver> or other thread-safe patterns to enable
parallel test execution.
Q80. How do you handle properties/config files in Java automation frameworks?
Allows running the same code against different environments (dev/qa/prod) without code
changes.
Common approach
Load them at framework startup using Properties class, or better, use a configuration utility
that supports environment overrides.
Example
prop.load(fis);
Enhancements
Support CLI args or system properties (e.g., -Denvironment=qa) to switch environments in CI.
Pitfalls
Interview Tip
Describe how your runner reads a -Denv=qa system property and picks the right properties
file for the test run.
Section 6 – TestNG Framework (Q81–Q100)
Detailed Explanation:
TestNG (Test Next Generation) is a Java-based testing framework inspired by JUnit and NUnit but
designed to make automated testing more powerful and flexible. It provides annotations, grouping,
parameterization, parallel execution, and advanced reporting — all crucial for managing large
Selenium test suites.
Key Benefits:
Example:
@BeforeMethod
@Test
@AfterMethod
System.out.println("Close browser");
}
Output Order:
Interview Tip:
Be ready to explain how TestNG helped you structure tests, manage dependencies, and generate test
reports automatically in your current project.
Q82. What are TestNG annotations, and why are they useful?
Detailed Explanation:
Annotations in TestNG control test execution flow. Each annotation tells TestNG when and how to
execute a method in the lifecycle.
Annotation Purpose
Example:
@BeforeSuite
@BeforeTest
@BeforeMethod
@Test
@AfterMethod
Interview Tip:
Mention you understand execution order — it’s a frequent practical interview question.
Detailed Explanation:
Example:
@BeforeClass
@BeforeMethod
driver.get("https://app.example.com");
Interview Tip:
Explain how using @BeforeClass avoids browser relaunch for every test (saves time).
Q84. How can you prioritize test cases in TestNG?
Detailed Explanation:
By using the priority attribute in the @Test annotation.
Example:
@Test(priority=1)
@Test(priority=2)
@Test(priority=3)
Default behavior:
If priority isn’t defined, TestNG runs tests in alphabetical order of method names.
Pitfalls:
Interview Tip:
State that you use dependsOnMethods for true functional dependencies (e.g., checkout depends on
login).
Detailed Explanation:
These attributes define test dependencies — when a test should only run if another test/group
passes.
@Test
@Test(dependsOnMethods={"login"})
@Test(dependsOnGroups={"smoke"})
Pitfall:
If a dependent test fails, the next test is skipped (not failed).
Interview Tip:
Mention you use dependencies to maintain business flow integrity without manual sequencing.
Detailed Explanation:
Groups let you organize and run related tests (e.g., smoke, regression, sanity).
Example:
@Test(groups={"smoke"})
@Test(groups={"regression"})
In testng.xml:
<groups>
<run>
<include name="smoke"/>
</run>
</groups>
Benefits:
Interview Tip:
Mention grouping is part of your test suite management strategy — e.g., smoke tests before full
regression.
Example:
@DataProvider(name="loginData")
{"user1","pass1"},
{"user2","pass2"}
};
@Test(dataProvider="loginData")
Interview Tip:
Explain how you used DataProvider to test multiple credential sets or form inputs dynamically.
Detailed Explanation:
You can define parameters in the testng.xml file and fetch them using @Parameters.
Example:
@Parameters("browser")
@Test
Used for multiple data sets Used for single parameter values
Interview Tip:
Mention that you use @Parameters for environment or browser parameters, and @DataProvider for
test data.
Detailed Explanation:
Use the enabled=false attribute in the @Test annotation.
Example:
@Test(enabled=false)
// not executed
Interview Tip:
Explain you disable tests temporarily for unstable or environment-dependent cases (not delete).
Detailed Explanation:
testng.xml is the suite configuration file that controls which tests, classes, and groups are executed.
It defines suite-level structure and parameters.
Example:
<classes>
<class name="tests.LoginTest"/>
<class name="tests.DashboardTest"/>
</classes>
</test>
</suite>
Interview Tip:
Show you can create dynamic test suites and run parallel tests using XML configuration.
Detailed Explanation:
Parallel execution reduces total test time and can run on multiple browsers/environments.
<test name="SmokeTests">
<classes>
<class name="tests.LoginTest"/>
</classes>
</test>
</suite>
Pitfalls:
Interview Tip:
Mention you implemented parallelism using ThreadLocal drivers to run tests safely across multiple
threads.
Detailed Explanation:
Hard Assertion (Assert): Fails the test immediately when an assertion fails.
Soft Assertion (SoftAssert): Collects all failures and reports them after all checks.
Example:
soft.assertTrue(isLoggedIn);
soft.assertEquals(actualTitle, "Dashboard");
Use-case:
Soft assertions are great for verifying multiple UI elements in one test.
Interview Tip:
Explain that you use SoftAssert when multiple independent checks exist in a single test.
Detailed Explanation:
Listeners are interfaces that let you customize test behavior and reporting by listening to TestNG
events like test start, pass, or fail.
Common Listeners:
ITestListener
ISuiteListener
IInvokedMethodListener
takeScreenshot(result.getName());
Register in XML:
<listeners>
<listener class-name="utilities.Listeners"/>
</listeners>
Interview Tip:
Mention you integrated screenshot capture and extent reporting using listeners.
Example:
int count = 0;
if (count < 2) {
count++;
return true;
return false;
Attach it to test:
@Test(retryAnalyzer=RetryAnalyzer.class)
Interview Tip:
Say you used retry logic to handle flaky tests caused by temporary network/UI delays.
Q95. How can you run a specific group of tests from command line or Jenkins?
Jenkins Integration:
Interview Tip:
Explain you parameterized test group execution in Jenkins to save CI time.
Detailed Explanation:
TestNG generates default HTML reports, but for better visuals, integrate ExtentReports or Allure.
extent.flush();
Interview Tip:
Show you integrated ExtentReports and attached screenshots for failures automatically.
Example:
@Test
Interview Tip:
Explain skipping is better than failing when the environment is not ready or dependent data is
missing.
Detailed Explanation:
Use class variables, or store data in a Map, or use dependency (dependsOnMethods).
Example:
String orderId;
@Test
@Test(dependsOnMethods="createOrder")
Interview Tip:
Explain you use such dependencies to maintain state across related tests logically.
Example:
@Test
@Factory
new LoginTest("user1"),
new LoginTest("user2")
};
Interview Tip:
Mention factories are powerful when each test instance needs a unique setup (e.g., multi-user
testing).
Detailed Explanation:
Jenkins executes tests via Maven build step (mvn test -PRegression).
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
Interview Tip:
Highlight CI integration and how TestNG results were published automatically in Jenkins reports.
Q101. What are the different types of locators in Selenium? Which one is most preferred and why?
Detailed Explanation:
Locators are used to identify web elements in Selenium. Choosing the correct locator directly
impacts test reliability and maintainability.
Types of Locators:
3. className – Targets elements by class (less reliable if multiple elements share same class).
Best Practice:
Detailed Explanation:
Relative XPath: Starts from any node (//) and is more flexible.
Example: //input[@name='username']
Interview Tip:
Show how you use functions like contains(), starts-with(), or dynamic attributes in XPath.
Q103. How do you handle dynamic elements whose attributes change frequently?
Detailed Explanation:
Dynamic elements (like IDs that change every load) cause flaky tests.
Techniques to handle:
2. driver.findElement(By.xpath("//input[contains(@id,'user')]"));
4. //label[text()='Username']/following-sibling::input
Interview Tip:
Explain how you created dynamic XPaths using partial matches and stabilized flaky locators using
WebDriverWait.
Detailed Explanation:
Method Description Returns Behavior when not found
Example:
Interview Tip:
Mention you use findElements() in validations (e.g., verifying no duplicates or counting rows).
Detailed Explanation:
Selenium waits handle synchronization issues between the test and the browser.
1. Implicit Wait:
Applies globally for all element searches.
2. driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
5. wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("login")));
6. Fluent Wait:
Polls periodically until condition is met or timeout expires.
8. .withTimeout(Duration.ofSeconds(30))
9. .pollingEvery(Duration.ofSeconds(5))
10. .ignoring(NoSuchElementException.class);
Best Practice:
Use Explicit Waits for specific element actions and Implicit Waits for global baseline.
Interview Tip:
Explain how replacing Thread.sleep() with smart waits reduced flakiness in your project.
Q106. What are different types of exceptions you have faced in Selenium?
Handling Example:
try {
driver.findElement(By.id("login")).click();
} catch (NoSuchElementException e) {
Interview Tip:
Mention you’ve handled flaky exceptions by adding retries and wait conditions.
Detailed Explanation:
Web pages may have <iframe> elements, and Selenium can’t access inner content until you switch to
it.
Methods:
// By index
driver.switchTo().frame(0);
// By name or ID
driver.switchTo().frame("frameName");
// By WebElement
driver.switchTo().frame(frame);
// Return to default
driver.switchTo().defaultContent();
Interview Tip:
Explain that frame handling is critical for pages with embedded widgets like payment gateways.
Detailed Explanation:
Use getWindowHandles() and switchTo().window().
Example:
driver.switchTo().window(win);
if (driver.getTitle().contains("Checkout")) {
break;
Interview Tip:
Describe a real case — for example, verifying payment or help pages opened in new tabs.
Types of Alerts:
Example:
System.out.println(alert.getText());
alert.accept();
Interview Tip:
Add that you use ExpectedConditions.alertIsPresent() to avoid timing issues.
Q110. How do you perform mouse and keyboard actions?
Detailed Explanation:
Use the Actions class for advanced user interactions.
Example:
act.moveToElement(driver.findElement(By.id("menu"))).click().build().perform();
act.keyDown(Keys.CONTROL).click(elem).keyUp(Keys.CONTROL).perform();
Common Use-Cases:
Keyboard shortcuts
Interview Tip:
Mention you implemented hover-based submenus or drag-drop in test scenarios.
driver.findElement(By.id("fileUpload")).sendKeys("/path/to/file.txt");
Robot class
JavaScript Executor
Interview Tip:
Mention for CI/CD compatibility you prefer direct sendKeys() method over Robot.
Detailed Explanation:
When Selenium APIs cannot perform an action (e.g., hidden elements), JavaScriptExecutor executes
JS commands directly in the browser.
Example:
Use-Cases:
Scrolling
Interview Tip:
Give an example where element.click() failed and JavaScriptExecutor solved it.
Detailed Explanation:
POM is a design pattern where each page is represented as a class with locators and methods.
Example:
WebDriver driver;
this.driver = driver;
PageFactory.initElements(driver, this);
username.sendKeys(user);
password.sendKeys(pass);
Benefits:
Reusability
Maintainability
Reduces duplication
Interview Tip:
Mention how you built your framework with POM + PageFactory pattern.
Q114. What is the difference between Page Object Model and Page Factory?
Detailed Explanation:
Page Factory: A Selenium class that initializes elements annotated with @FindBy.
Example:
@FindBy(id="loginBtn")
WebElement loginBtn;
Interview Tip:
Mention PageFactory improves readability but you ensure lazy loading and null safety.
Example:
Automation Tip:
Integrate this in your TestNG Listeners to capture screenshots on failures.
Detailed Explanation:
Use browser options to bypass SSL warnings.
Example (Chrome):
options.setAcceptInsecureCerts(true);
Interview Tip:
Mention you configured browser profiles in CI to auto-accept SSL for testing environments.
Q117. How do you handle dropdowns in Selenium?
Detailed Explanation:
Use Select class for <select> elements.
Example:
select.selectByVisibleText("India");
select.selectByIndex(2);
select.selectByValue("IN");
Interview Tip:
For non-select dropdowns, mention using Actions or direct click()s.
Detailed Explanation:
Standard Selenium can’t access Shadow DOM directly. Use JavaScript to pierce it.
Example:
Interview Tip:
Highlight that Shadow DOM handling is essential for modern web apps built with frameworks like
Polymer or Lit.
Q119. How do you upload files when file input is not accessible (hidden)?
Answer:
When <input type="file"> is hidden, direct sendKeys() won’t work.
Use:
Example:
js.executeScript("document.querySelector('#upload').style.display='block';");
driver.findElement(By.id("upload")).sendKeys("/path/to/file.txt");
Q120. How do you maximize test reusability and reduce duplication in Selenium?
Detailed Explanation:
Example:
.until(ExpectedConditions.elementToBeClickable(locator))
.click();
Interview Tip:
Explain how you created a utility library to avoid repeating WebDriver code.
Detailed Explanation:
An automation framework is a structured approach to writing and maintaining test scripts efficiently.
It provides a reusable foundation that defines:
Key Benefits:
Enhances consistency
src/
main/java/
base/
utilities/
pageObjects/
test/java/
testCases/
testData/
config/
reports/
drivers/
Interview Tip:
Describe your framework layers (BaseTest, PageObjects, Utilities, Data, Reports) and emphasize
maintainability and modularity.
Detailed Explanation:
Interview Tip:
When asked about framework structure, be specific — e.g., “We used Page Object + TestNG + Extent
Reports integrated with Jenkins.”
Q123. What is a Hybrid Framework in Selenium?
Detailed Explanation:
A Hybrid Framework combines features of multiple frameworks like Data-Driven, Keyword-Driven,
and Modular frameworks.
Example:
Benefits:
Maximum flexibility
High reusability
Easy maintenance
Example Flow:
Interview Tip:
Explain your hybrid setup — e.g., “Our framework used data-driven logic from Excel and keywords to
define test steps dynamically.”
Data Source External files (Excel, CSV) External file defining action keywords
Interview Tip:
Explain both can be merged for flexibility — your hybrid framework used data from Excel and
keywords for reusable steps.
Detailed Explanation:
data[i][j] = sheet.getRow(i+1).getCell(j).toString();
return data;
Interview Tip:
State you decoupled data from logic, allowing multiple user credential combinations to run
dynamically.
Detailed Explanation:
Common Data Management Approaches:
Best Practice:
Interview Tip:
Mention you used JSON for API validations and Excel for UI tests to maintain uniformity.
Detailed Explanation:
In a Keyword-Driven Framework, test steps are written as keywords in an external file (Excel or
XML). Each keyword maps to a method in the automation library.
Example Excel:
Execution Engine:
switch(keyword) {
Interview Tip:
Say your framework supported non-technical users to write Excel-based keywords for tests.
Detailed Explanation:
A Modular Framework divides the application under test into independent modules. Each module
has its own test scripts and reusable functions.
Example:
modules/
login/
cart/
checkout/
Benefits:
Interview Tip:
Explain that when one module changes (e.g., login), only that script is updated, not the entire suite.
Detailed Explanation:
BaseTest is the foundation of most frameworks. It handles:
WebDriver initialization
Configuration loading
Reporting integration
Example:
@BeforeMethod
driver.manage().window().maximize();
@AfterMethod
driver.quit();
Interview Tip:
Mention all test classes extend BaseTest, ensuring consistent setup and cleanup.
Detailed Explanation:
Use config.properties and System properties.
Example:
browser=chrome
url=https://qa.portal.com
timeout=10
prop.load(fis);
Interview Tip:
Explain that CI pipelines (Jenkins) override configs dynamically with -Denv=qa.
Detailed Explanation:
Utilities are reusable functions common across tests:
WaitHelper
ScreenshotUtil
ExcelUtil
BrowserUtil
LogUtil
Example:
.until(ExpectedConditions.visibilityOfElementLocated(locator));
Interview Tip:
Show you organized your utilities in a separate utils package for modularity.
Detailed Explanation:
Integrate Extent Reports or Allure Reports for professional results.
Example (Extent Reports):
extent.flush();
Output:
An HTML report with step-level logs, colors, and screenshots.
Interview Tip:
Mention that your reports automatically attach screenshots on failure via TestNG Listeners.
Detailed Explanation:
Logging helps in debugging and audit trails.
Example (log4j2.xml):
<AppenderRef ref="Console"/>
<AppenderRef ref="File"/>
</Logger>
Usage:
log.info("Login started");
Interview Tip:
State that logging improves traceability, especially in CI failures.
Detailed Explanation:
CI/CD compatibility.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.22.0</version>
</dependency>
Interview Tip:
Mention using Maven profiles (-PRegression) to run specific test suites.
Q135. What is continuous integration (CI) and how does it fit into test automation?
Detailed Explanation:
CI is the practice of integrating code changes frequently and validating them automatically.
In Automation:
Interview Tip:
Say, “Our CI pipeline runs smoke tests on every commit and regression nightly.”
Steps:
Interview Tip:
Mention you parameterized builds for dynamic environment selection (-Denv=qa).
Q137. What are Extent Reports and how do you integrate them?
Detailed Explanation:
Extent Reports provides visually rich test execution reports.
Integration:
test.addScreenCaptureFromPath("error.png");
Interview Tip:
Highlight that screenshots are captured automatically through Listeners.
Detailed Explanation:
Example:
if(browser.equalsIgnoreCase("chrome"))
else if(browser.equalsIgnoreCase("firefox"))
Interview Tip:
Mention Selenium Grid or cloud platforms (BrowserStack, LambdaTest) for scalable cross-browser
runs.
Detailed Explanation:
Selenium Grid enables distributed parallel execution across multiple machines or browsers.
Architecture:
Command Example:
Interview Tip:
State that you used Grid to run regression tests across Chrome, Firefox, and Edge in parallel.
Detailed Explanation:
1. Use Git for version control.
Interview Tip:
Say your team followed GitFlow branching and used pull requests for peer review before merging to
main.
Detailed Explanation:
API testing validates the backend logic, data exchange, and response handling of an application
without using the UI. It ensures that:
Benefits:
Example:
Testing a “Login API” that accepts JSON body:
"username": "user1",
"password": "pass123"
You check whether the API returns 200 OK and a valid token.
Interview Tip:
Emphasize API testing helps identify defects before UI layers are built, saving time and effort.
Interview Tip:
Mention that REST APIs are most common and you’ve tested them using Postman and Rest Assured.
Q143. What are the main HTTP methods used in REST APIs?
Interview Tip:
Explain how you validated CRUD operations using different HTTP methods in automation scripts.
Detailed Explanation:
Example:
Host: api.example.com
Content-Type: application/json
"username": "user1",
"password": "pass123"
}
Interview Tip:
Mention how you dynamically construct headers and bodies using Java Maps in Rest Assured.
Response Structure:
Example Response:
"id": 101,
"name": "Deepika",
"role": "QA"
Interview Tip:
Be ready to list status code categories:
1xx – Informational
2xx – Success
3xx – Redirection
Common Tools:
Interview Tip:
Mention you start with Postman for exploration, then automate stable endpoints using Rest Assured.
Q147. What is Rest Assured, and why is it used for API automation?
Detailed Explanation:
Rest Assured is a Java-based library that simplifies testing RESTful APIs. It uses a readable syntax
similar to Gherkin.
Advantages:
Supports JSON/XML.
Example:
given()
.baseUri("https://api.example.com")
.contentType("application/json")
.body("{\"username\":\"user1\", \"password\":\"pass123\"}")
.when()
.post("/login")
.then()
.statusCode(200)
.body("token", notNullValue());
Interview Tip:
Highlight that Rest Assured fits perfectly into hybrid Selenium-TestNG frameworks.
Detailed Explanation:
Use .body() with JSON path expressions.
Example:
response.then().assertThat().body("name", equalTo("Deepika"));
Advanced:
Assert.assertEquals(city, "Hyderabad");
Interview Tip:
Explain JSONPath is powerful for deeply nested response validation.
Q149. How do you validate status codes and headers in Rest Assured?
Example:
given()
.when().get("/users")
.then()
.statusCode(200)
Interview Tip:
Mention validating both body and headers ensures full response correctness.
Q150. How do you pass query parameters and path parameters in Rest Assured?
given().queryParam("page", 2).when().get("/users");
given().pathParam("userId", 101).when().get("/users/{userId}");
Interview Tip:
State that query params are used for filters/pagination, and path params for specific records.
Types of Authentication:
Example:
given().auth().basic("admin", "password").when().get("/dashboard");
.when().get("/profile");
Interview Tip:
Describe how you fetch access tokens dynamically in pre-test setup.
Q152. What is the difference between authentication and authorization?
Term Purpose
Interview Example:
Authentication → /login
Authorization → /admin/dashboard
Interview Tip:
Give an example: “I validated that unauthorized users get 403 response.”
Q153. How do you handle POST requests with JSON body in Rest Assured?
Example:
body.put("name", "Deepika");
given()
.contentType("application/json")
.body(body.toString())
.when()
.post("/users")
.then()
.statusCode(201);
Interview Tip:
Mention you use dynamic JSON creation via Map or POJO for reusability.
Detailed Explanation:
Schema validation ensures that response structure matches the expected JSON schema.
Example:
given()
.get("/users/1")
.then()
.assertThat()
.body(matchesJsonSchemaInClasspath("userSchema.json"));
Interview Tip:
State that schema validation helps detect missing or extra fields early.
Detailed Explanation:
API tests can support UI tests by:
Example:
.post("/createOrder")
.jsonPath().getString("orderId");
driver.findElement(By.id("orderSearch")).sendKeys(orderId);
Interview Tip:
Mention this hybrid integration significantly reduces UI test time.
Q156. How do you handle dynamic values in API testing (like tokens or IDs)?
Detailed Explanation:
Capture dynamic data from API responses and reuse them in subsequent requests.
Example:
.post("/login")
.jsonPath().getString("token");
.then().statusCode(200);
Interview Tip:
Show that chaining requests helps maintain test flow realism.
Detailed Explanation:
Example:
data.put("name", "Deepika");
data.put("age", 29);
given().body(data).post("/users");
Interview Tip:
Mention you maintain a payloadBuilder class to centralize request templates.
Example:
// PUT
given().body("{\"name\":\"Deepika\",\"role\":\"QA\"}").put("/users/1");
// PATCH
given().body("{\"role\":\"Lead QA\"}").patch("/users/1");
Interview Tip:
State that PATCH is faster and used for minor updates.
Q159. How do you validate performance in API testing?
Detailed Explanation:
Example:
Interview Tip:
Highlight that you validate response times in CI to ensure no performance degradation.
Detailed Explanation:
2. Jenkins job runs API test suite (mvn clean test -PAPI).
Interview Tip:
Explain how your pipeline runs both UI and API suites separately and merges reports for unified view.
Detailed Explanation:
Database testing ensures that data stored, updated, or retrieved by the application is correct and
consistent. It involves verifying:
Data integrity
Data consistency
Example:
After submitting a “New Order” on UI, you check in DB:
Interview Tip:
Mention that in your projects you validated DB entries after UI actions (like verifying user creation or
order submission).
Detailed Explanation:
1. Structural Testing:
2. Functional Testing:
4. Regression Testing:
Interview Tip:
Say you performed data validation and referential integrity checks post UI actions.
Detailed Explanation:
JDBC (Java Database Connectivity) is an API that enables Java applications to connect to databases,
execute queries, and fetch results.
Architecture:
Interview Tip:
Mention that you use JDBC in Selenium/Rest Assured frameworks for data validation.
Example Code:
Connection conn = DriverManager.getConnection(
while(rs.next()){
System.out.println(rs.getString("username"));
rs.close();
stmt.close();
conn.close();
Interview Tip:
Explain that connection details (URL, username, password) are stored in config files, not hardcoded.
Scenario Example:
Example Code:
Statement st = con.createStatement();
rs.next();
Assert.assertEquals(uiValue, dbValue);
Interview Tip:
Emphasize end-to-end validation — from UI → API → DB.
Q166. What are some common SQL commands used in testing?
Interview Tip:
Mention you frequently used SELECT queries for data verification and JOIN for relational data checks.
Best Practices:
Example:
return con;
Interview Tip:
Highlight connection pooling or utility reuse for efficiency.
Approach:
1. Perform delete operation on UI.
2. Execute SQL:
4. Expect count = 0.
Example:
rs.next();
Assert.assertEquals(rs.getInt(1), 0);
Interview Tip:
Say you use count-based validation to confirm deletions instead of catching exceptions.
Detailed Explanation:
Handle using try-catch or throw it to higher layers.
Example:
try {
} catch(SQLException e) {
e.printStackTrace();
Best Practice:
Use logging (log.error(e.getMessage())) and fail test gracefully.
Interview Tip:
Show you have error handling for connection failures in CI/CD pipelines.
Detailed Explanation:
Use PreparedStatement to prevent SQL injection and improve performance.
Example:
ps.setInt(1, 101);
ResultSet rs = ps.executeQuery();
Interview Tip:
Explain that using PreparedStatement avoids hardcoding and SQL injection risks.
Detailed Explanation:
Data integrity testing ensures the accuracy and consistency of data over its lifecycle.
Types of Integrity:
Example:
Check that OrderID in Orders exists in Customers table.
Interview Tip:
Highlight your experience validating foreign key consistency after transactional operations.
Detailed Explanation:
When DB schema changes (new columns, constraints), migration testing ensures no data loss or
corruption occurs.
Example:
Interview Tip:
Mention DB migration testing during version upgrades or cloud migrations (e.g., on AWS RDS).
Detailed Explanation:
Example:
rs.next();
return rs.getString("status");
In Test:
Assert.assertEquals(getOrderStatus(1234), "Shipped");
Interview Tip:
Explain you integrated DB validations to ensure backend reflects UI actions correctly.
INNER Returns records with matching keys in SELECT * FROM Orders o INNER JOIN Customers c
JOIN both tables ON o.CustID = c.ID
RIGHT
All from right + matched from left
JOIN
Interview Tip:
Give a real example: verifying customer names joined with order details.
Q175. How do you verify numeric and string data types in DB testing?
Example:
DESC customers;
Automation Check:
Interview Tip:
Say you validated column data types during schema regression tests.
Example Flow:
3. Verify in DB:
Code Example:
Assert.assertTrue(rs.next());
Interview Tip:
Mention integrating DB verification after successful API calls.
Q177. What are stored procedures and how do you test them?
Detailed Explanation:
Stored Procedures are SQL code blocks stored in DB that perform tasks like data insert/update.
Execution:
Automation Example:
cs.setInt(1, 101);
cs.setString(2, "Active");
cs.execute();
Interview Tip:
Say you tested stored procedures to ensure they perform correct updates and rollbacks.
Detailed Explanation:
A trigger automatically executes after insert/update/delete events.
Example:
Trigger on “Orders” updates “Inventory” when a new order is placed.
Test Flow:
Interview Tip:
Explain you validated trigger logic by verifying impact on dependent tables.
Q179. How do you ensure your automation framework supports multiple databases (e.g., MySQL,
Oracle, SQL Server)?
Detailed Explanation:
dbType=oracle
dbURL=jdbc:oracle:thin:@localhost:1521:orcl
if(dbType.equals("mysql"))
Class.forName("com.mysql.cj.jdbc.Driver");
Interview Tip:
Highlight your framework supports multi-DB testing by externalizing connection parameters.
Q180. What are some best practices for database testing in automation?
Best Practices:
Interview Tip:
Conclude by saying you ensure data accuracy, referential integrity, and transaction safety in all DB
validations.
Detailed Explanation:
BDD is a software development approach that bridges the communication gap between technical
and non-technical stakeholders by describing system behavior in plain English using structured
formats.
It focuses on what the system should do, not how it does it.
Key Features:
Example:
A login feature written in Gherkin:
Interview Tip:
Say: “BDD helps ensure everyone speaks the same language — testers, developers, and business
teams.”
Detailed Explanation:
Cucumber is an open-source tool that supports BDD. It reads Gherkin feature files and maps them
to step definitions (Java, Python, JS, etc.) for automation.
Cucumber executes:
Detailed Explanation:
Gherkin is a domain-specific language used to write Cucumber scenarios in plain English.
Gherkin Keywords:
Feature
Scenario
Given → setup/precondition
When → action
Example:
Interview Tip:
Mention that Gherkin makes tests readable and traceable to user stories.
Main Components:
Interview Tip:
Say your project used Page Object Model + Cucumber for modular and maintainable design.
Steps:
2. Add dependencies:
3. <dependency>
4. <groupId>io.cucumber</groupId>
5. <artifactId>cucumber-java</artifactId>
6. <version>7.15.0</version>
7. </dependency>
8. <dependency>
9. <groupId>io.cucumber</groupId>
10. <artifactId>cucumber-junit</artifactId>
11. <version>7.15.0</version>
12. </dependency>
14. src/test/java
Interview Tip:
Mention that Maven simplifies dependency management, and pom.xml controls the entire setup.
Detailed Explanation:
A feature file describes a user feature or functionality in business-readable format.
Example:
Interview Tip:
Explain that each feature corresponds to one business module or epic.
Detailed Explanation:
A step definition file links the Gherkin steps to executable Java code.
Example:
@Given("user is on the homepage")
driver.get("https://rahulshettyacademy.com");
Interview Tip:
Say: “Each Gherkin step must have one matching annotated method in a Step Definition class.”
Detailed Explanation:
The runner file integrates Cucumber with JUnit or TestNG and triggers execution of feature files.
@RunWith(Cucumber.class)
@CucumberOptions(
features = "src/test/java/features",
glue = "stepDefinitions",
tags = "@Smoke"
Interview Tip:
Explain that you can run Cucumber tests selectively using tags in the runner file.
Detailed Explanation:
Hooks are like setup and teardown methods executed before or after each scenario.
Example:
@Before
@After
public void teardown() {
driver.quit();
Interview Tip:
Say you use Hooks for driver initialization, login, or database cleanup.
Detailed Explanation:
Tags categorize and filter test cases for execution.
Example:
@Smoke @Login
In Runner:
@CucumberOptions(tags = "@Smoke")
Interview Tip:
Mention that tags help run subsets like @Smoke, @Regression, or @Sanity.
Detailed Explanation:
Scenario Outline allows data-driven testing using Examples tables.
Example:
Examples:
| username | password |
| user1 | pass123 |
| user2 | pass456 |
Interview Tip:
Say Scenario Outline eliminates redundant test steps for multiple data sets.
Q192. What are Backgrounds in Cucumber?
Detailed Explanation:
Background is used to define steps common to all scenarios within a feature.
Example:
Background:
Interview Tip:
Use Background only when setup steps are identical across all scenarios.
Detailed Explanation:
Data tables are used to pass structured data to step definitions.
Example:
Step Definition:
System.out.println(data.get(0).get("Name"));
Interview Tip:
Mention data tables simplify bulk input handling in tests like user registration.
Detailed Explanation:
Use regular expressions in step definitions to accept dynamic values.
Example:
When user logs in with username "Deepika" and password "QA123"
Step Definition:
loginPage.login(username, password);
Interview Tip:
Explain regex parameterization reduces code duplication.
Detailed Explanation:
Use glue option in the runner class to specify multiple packages:
Interview Tip:
Say you separate logic into module-based step definitions for scalability.
Detailed Explanation:
Example:
driver.findElement(By.id("search")).sendKeys(product);
driver.findElement(By.id("searchBtn")).click();
Interview Tip:
Explain Cucumber only handles test flow; Selenium performs actual automation.
Detailed Explanation:
Cucumber provides multiple built-in reporting plugins:
pretty – console logs
Example:
Interview Tip:
Mention you used Extent or Allure reports for enhanced visuals and Jenkins integration.
Q198. How do you run Cucumber tests from command line or Jenkins?
Command Line:
Jenkins Integration:
Interview Tip:
Highlight that Jenkins runs Cucumber tests as part of CI pipeline with scheduled triggers.
Interview Tip:
Say you combine both: “We use Cucumber for BDD and TestNG for parallel execution & reporting.”
Advantages:
Limitations:
Interview Tip:
Mention that with good tagging and modular design, Cucumber remains highly scalable.
Q201. What is Continuous Integration (CI) and why is it important in automation testing?
Detailed Explanation:
Continuous Integration (CI) is the practice of frequently integrating code into a shared repository
and automatically verifying it through builds and tests.
Example:
When a developer pushes new code → Jenkins triggers an automated test run → QA gets results
immediately.
Interview Tip:
Say you configured Jenkins jobs that run Selenium + API tests after every Git commit.
Detailed Explanation:
Jenkins is an open-source CI/CD tool written in Java that automates building, testing, and
deployment of applications.
Key Features:
Interview Tip:
Say you use Jenkins to trigger nightly regression builds and publish automation reports.
Steps:
Interview Tip:
Mention you also configured Jenkins on a Linux server using yum install jenkins in production setup.
Detailed Explanation:
3. Add:
o Build command:
Interview Tip:
Explain that you configured Jenkins to pull code from GitHub and run the Selenium regression suite
automatically.
Detailed Explanation:
Jenkins Pipeline is a suite of plugins that allows defining CI/CD workflows as code using a Jenkinsfile.
Advantages:
Version-controlled.
Example Jenkinsfile:
pipeline {
agent any
stages {
stage('Build') {
steps {
stage('Test') {
steps {
sh 'mvn test'
stage('Report') {
steps {
publishHTML(target: [
reportDir: 'target',
reportFiles: 'cucumber-reports.html',
])
Interview Tip:
Mention that your team uses Declarative Pipelines for better readability and modularity.
Q206. How do you trigger Jenkins jobs automatically?
Detailed Explanation:
Interview Tip:
Say: “We used GitHub Webhooks to trigger Jenkins builds instantly on every merge to the main
branch.”
Detailed Explanation:
Use Parameterized Builds to pass environment-specific values (like browser, URL, or environment).
Steps:
Interview Tip:
Say you use parameterized Jenkins builds to test across QA, UAT, and Prod environments.
Steps:
Interview Tip:
Mention you used webhooks for continuous testing integration with GitHub commits.
Detailed Explanation:
For TestNG → Use emailable-report.html.
Interview Tip:
Say your Jenkins jobs automatically archive reports and send email notifications to stakeholders.
Q210. What is the difference between Freestyle and Pipeline jobs in Jenkins?
Interview Tip:
Say: “We migrated from Freestyle to Jenkinsfile-based Pipelines for maintainability and Git
versioning.”
Detailed Explanation:
H2***
Interview Tip:
Mention you scheduled nightly regression jobs and configured auto-report emails on completion.
Detailed Explanation:
Interview Tip:
Say you use Maven + Jenkins to ensure consistent dependency management across builds.
Detailed Explanation:
Interview Tip:
Mention Jenkins executes your Selenium + Cucumber suite daily with Extent HTML reports.
Detailed Explanation:
echo $BROWSER
or in Java:
System.getenv("BROWSER");
Interview Tip:
Say you externalized environment variables for flexible, environment-agnostic test runs.
Detailed Explanation:
o On success/failure.
Interview Tip:
Say you configured Jenkins to send pass/fail summary + HTML report links to team members.
Detailed Explanation:
Use Jenkins pipeline stages or TestNG parallel execution.
Example:
parallel (
Interview Tip:
Mention parallel execution helped reduce regression time by 50%.
Detailed Explanation:
Interview Tip:
Say: “We configured multiple Jenkins agents to run tests across OS and browser combinations.”
Best Practices:
Detailed Explanation:
Jenkinsfile defines your CI/CD pipeline as code and lives inside your Git repository.
Example:
pipeline {
agent any
stages {
Interview Tip:
Say Jenkinsfile enables version control and better maintainability of pipelines.
Q220. What are the best practices for using Jenkins in automation projects?
Best Practices:
Interview Tip:
Say: “We follow CI/CD best practices — code → test → report → deploy, all through Jenkins pipeline
automation.”
Detailed Explanation:
Git is a distributed version control system used to track changes in source code. It allows multiple
team members to work on the same project simultaneously without conflicts.
Interview Tip:
Say: “We use Git to maintain automation code, manage parallel feature development, and trigger
Jenkins builds.”
Detailed Explanation:
GitHub is a cloud-based hosting platform for Git repositories.
It provides:
Interview Tip:
Say Git is the tool, GitHub is the service that hosts and manages repositories.
Commands:
cd /path/to/project
git init
git add .
Command:
Explanation:
Creates a local copy of a remote repository on your machine.
Interview Tip:
Mention that you often clone automation repositories to contribute or debug issues locally.
Q225. What is the purpose of git add and git commit commands?
git commit Saves staged changes with a message git commit -m "Added login tests"
Interview Tip:
Explain the staging concept — files must be added (add) before being committed (commit).
Detailed Explanation:
A branch represents an independent line of development.
It allows multiple testers or developers to work on features without affecting the main codebase.
Example Commands:
Interview Tip:
Say you use feature branches for new test modules, then merge them into main after review.
Steps:
Q228. What are merge conflicts and how do you resolve them?
Detailed Explanation:
Merge conflicts occur when two branches modify the same line in a file.
Steps to resolve:
2. <<<<<<< HEAD
3. your code
4. =======
6. >>>>>>> feature-branch
8. Run:
Interview Tip:
Say you often resolve merge conflicts when parallel automation updates happen on shared test files.
Command:
Interview Tip:
Mention you use SSH or personal access tokens (PAT) for authentication since password-based
pushes are deprecated.
Q230. How do you pull the latest code from the repository?
Command:
Interview Tip:
Say you always pull before starting new work to avoid conflicts.
Q231. How do you check the current status of your Git repo?
Command:
git status
Output shows:
Modified files.
Untracked files.
Interview Tip:
Say: “I use git status regularly to ensure I only commit intended changes.”
Detailed Explanation:
The .gitignore file tells Git which files or folders to exclude from tracking.
Example:
target/
logs/
*.class
config.properties
Interview Tip:
Say you exclude build folders, reports, and credentials files for security and cleanliness.
Q233. What is the difference between git fetch and git pull?
Interview Tip:
Say you use git fetch to review remote changes before merging them.
Q234. How do you revert a commit in Git?
Command:
Explanation:
Creates a new commit that undoes the changes of the given commit without rewriting history.
Interview Tip:
Say you use revert when a faulty test script breaks Jenkins build.
Command:
git clean -f
Interview Tip:
Mention it’s useful to clean workspace before merging or pushing updates.
Command:
git log
Options:
Interview Tip:
Say you use commit history to trace who modified a test module or configuration.
Detailed Explanation:
A Pull Request is a request to merge your branch changes into another branch (usually main) on
GitHub.
Flow:
Q238. What are Git tags, and when do you use them?
Detailed Explanation:
Tags mark specific points in Git history (e.g., release versions).
Example:
Interview Tip:
Mention you tag stable releases like “Regression_Pass_v3.2” before major deployments.
Steps:
Interview Tip:
Say Jenkins-Git integration ensures continuous testing on every commit.
Q240. What are the best practices for using Git in test automation projects?
Best Practices:
o main → stable
Interview Tip:
Say: “Following Git branching and PR reviews improved our automation code stability and
collaboration.”
Detailed Explanation:
A Test Strategy is a high-level document that defines the approach, objectives, resources, and scope
of testing across all phases of a project.
It answers “how testing will be done” and ensures alignment between QA, Dev, and Business teams.
Key Elements:
Exit criteria
Example:
For a healthcare app:
Interview Tip:
Say: “I created a project-wide Test Strategy that aligned automation and manual efforts for end-to-
end validation.”
Example:
A Test Plan for Release 1.2 defines test objectives, timelines, and roles for that release;
A Test Strategy defines how testing will be done across all releases.
Interview Tip:
Say: “I developed detailed Test Plans derived from our organization-level Test Strategy.”
Components:
1. Test Objectives
3. Test Approach
4. Test Environment
5. Test Deliverables
9. Resource Planning
Interview Tip:
Mention you created Test Plans in Excel, Word, or ALM/Azure DevOps for all major releases.
Detailed Explanation:
Effort estimation predicts how long testing activities will take, considering scope and complexity.
Common Methods:
Test Case Point Method: Based on number and complexity of test cases.
Interview Tip:
Say: “I use test case complexity and past velocity to estimate QA efforts per sprint.”
Detailed Explanation:
Risk-Based Testing prioritizes test cases based on the likelihood and impact of failures.
Steps:
Example:
UI styling → Low
Interview Tip:
Say: “In one release, we prioritized testing claim validation logic first, as it impacted billing directly.”
Detailed Explanation:
Conditions that must be met before Test environment ready, build deployed, test data
Entry
testing starts prepared
Interview Tip:
Say you defined clear Entry/Exit criteria in every Test Plan to maintain release discipline.
Test
High-level user flow “Verify user can log in”
Scenario
Interview Tip:
Say: “Scenarios help visualize user journeys; cases ensure complete validation.”
Based on:
Business impact
Frequency of use
Defect-prone areas
Time constraints
Example:
Interview Tip:
Say you used Priority + Severity matrix in ALM/Azure DevOps to prioritize effectively.
Definition:
Test Coverage = The degree to which requirements are tested.
Formula:
Example:
Interview Tip:
Say: “We achieved 95% functional and 80% automation coverage in regression.”
Common Metrics:
Defect Density
Pass/Fail Rate
Automation Coverage
Defect Leakage
Interview Tip:
Mention you tracked metrics in Excel dashboards or tools like Power BI or Azure DevOps.
Defect Density Defects / Module Size (e.g., LOC or Function Points) 25 defects / 500 LOC = 0.05
Defect Leakage (Defects found in UAT / Total defects) × 100 (5/50)×100 = 10%
Interview Tip:
Say: “We reduced defect leakage from 18% to 8% by improving regression coverage.”
Detailed Explanation:
Include:
o Passed/Failed/Pending count
o Defects logged/resolved
o Risk summary
Example:
Metric Count
Executed 180
Passed 160
Failed 20
Interview Tip:
Say: “I shared daily QA status reports with stakeholders including blockers and risk updates.”
Detailed Explanation:
A Traceability Matrix (RTM) maps requirements to corresponding test cases to ensure 100%
requirement coverage.
Example:
Interview Tip:
Say you maintained RTM in Excel or ALM to avoid missed test coverage.
Detailed Explanation:
Automate regression.
Interview Tip:
Say: “I ensured every user story had test cases and acceptance criteria before sprint commitment.”
Detailed Explanation:
Exploratory testing is unscripted testing where testers explore the application using intuition and
experience to uncover unexpected issues.
When to use:
Interview Tip:
Say: “I complement structured test cases with exploratory sessions to catch edge defects.”
Best Practices:
Interview Tip:
Mention your team built automated test data generators for consistent regression testing.
Approach:
Interview Tip:
Say you worked with DevOps teams to ensure environment stability for test runs.
Steps:
Interview Tip:
Say: “We implemented continuous QA improvement via metrics-driven retrospectives.”
Interview Tip:
Say: “Verification = Are we building right? Validation = Are we building the right thing?”
Deliverables:
Test Plan
Test Data
Traceability Matrix
Defect Reports
QA Sign-Off Document
Interview Tip:
Mention that QA deliverables ensure accountability and compliance in every release.
Detailed Explanation:
An automation framework is a structured, reusable set of guidelines, components, and tools that
help automate test scripts efficiently and consistently.
It defines how tests are created, executed, and maintained — ensuring scalability, modularity, and
reporting.
Key Components:
Test scripts
Object repositories
Reporting mechanism
Configuration files
Logging
Interview Tip:
Say: “A well-designed framework reduces maintenance effort and enables faster onboarding of new
testers.”
Interview Tip:
Mention your experience with Hybrid POM + Cucumber framework for Selenium and API testing.
Benefits:
1. Reusability of code
2. Easy maintenance
3. Scalability
4. Better reporting
Interview Tip:
Say: “Our hybrid framework allowed us to reduce regression execution time by 60%.”
Detailed Explanation:
POM is a design pattern that creates a class for each web page, encapsulating web elements and
actions related to that page.
Benefits:
Improves readability
Easier maintenance
Example:
WebDriver driver;
By username = By.id("userEmail");
By password = By.id("userPassword");
By loginBtn = By.id("login");
this.driver = driver;
driver.findElement(username).sendKeys(user);
driver.findElement(password).sendKeys(pass);
driver.findElement(loginBtn).click();
Interview Tip:
Say you use POM with BaseTest and utility classes for cleaner code architecture.
Q265. What is the folder structure of a typical Selenium Hybrid Framework?
Example Structure:
src/test/java/
├── pageObjects/
├── testCases/
├── utilities/
├── testData/
├── reports/
├── resources/
├── config.properties
├── log4j2.xml
pom.xml
Interview Tip:
Explain how each folder has a defined responsibility (POM, test data, utilities, configuration, reports).
Detailed Explanation:
The BaseTest class is a parent class that initializes the WebDriver, configurations, and reporting.
All test classes extend this class.
Example:
@BeforeMethod
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
driver.get("https://app.under.test/");
@AfterMethod
Interview Tip:
Say BaseTest reduces code redundancy and centralizes setup logic.
Detailed Explanation:
Use a config.properties file for environment-specific data:
browser=chrome
url=https://app.test.com
username=admin
password=pass123
Utility Code:
prop.load(fis);
Interview Tip:
Say: “We externalized configurations to make the framework flexible across environments.”
if (browser.equalsIgnoreCase("chrome"))
else if (browser.equalsIgnoreCase("firefox"))
else if (browser.equalsIgnoreCase("edge"))
return driver;
}
Interview Tip:
Mention cross-browser compatibility testing using Selenium Grid or parallel execution in TestNG.
Options:
Database: JDBC
Example (DataProvider):
@DataProvider(name="loginData")
Interview Tip:
Say: “We built a data-driven framework using Excel sheets and TestNG DataProviders.”
Detailed Explanation:
Use Log4j2 or SLF4J to track execution flow.
log4j2.xml Example:
<AppenderRef ref="FileAppender"/>
</Logger>
Usage:
log.info("Launching browser...");
Interview Tip:
Say you use Log4j2 for detailed execution tracking and debugging.
Common Tools:
Extent Reports (most popular)
Allure Reports
test.pass("Login successful");
extent.flush();
Interview Tip:
Mention: “We used Extent Reports integrated with Jenkins for visually rich reporting.”
Detailed Explanation:
Use Maven for:
Dependency management
Plugin integration
pom.xml Example:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.23.0</version>
</dependency>
Interview Tip:
Say Maven ensures consistent builds and smooth integration with Jenkins.
Detailed Explanation:
Use TestNG with parallel attribute in testng.xml:
<test name="ChromeTest">
</test>
<test name="FirefoxTest">
<classes><class name="tests.LoginTest"/></classes>
</test>
</suite>
Interview Tip:
Say: “Parallel execution helped us cut regression time from 3 hours to 1.5.”
Example:
Interview Tip:
Mention reusable utilities promote code reusability and cleaner test scripts.
Detailed Explanation:
Listeners monitor test execution and perform actions based on test events (start, success, failure).
Example:
}
}
In testng.xml:
<listeners>
<listener class-name="utilities.Listeners"/>
</listeners>
Interview Tip:
Say you used listeners for screenshot capture and report logging on test failure.
Options:
1. priority attribute
2. dependsOnMethods
3. dependsOnGroups
Example:
@Test(priority=1)
@Test(priority=2, dependsOnMethods="login")
Interview Tip:
Mention dependency management ensures logical test flow and prevents false failures.
Q277. How do you integrate APIs or Database tests into your Selenium framework?
Approach:
Example:
Assert.assertTrue(response.contains("Deepika"));
Interview Tip:
Say you unified UI + API + DB automation under one Maven project for full-stack validation.
Detailed Explanation:
Your framework integrates with Jenkins (or GitHub Actions) to enable:
Automatic builds
Parallel execution
Centralized reporting
Example:
Interview Tip:
Say: “Each commit triggers Jenkins, which executes the automation suite and sends HTML reports via
email.”
Best Practices:
3. Externalize data/configs.
Interview Tip:
Say: “We built a scalable hybrid framework reused across multiple microservices applications.”
Q280. What are common challenges faced in framework design and how did you overcome them?
Challenge Solution
High maintenance due to frequent UI changes Used dynamic XPaths and Page Factory
Interview Tip:
Say: “We continuously improved framework efficiency by analyzing failure trends and optimizing
architecture.”
Detailed Explanation:
Test reporting provides visibility into the test execution results, defects, and overall product quality.
A good report communicates:
What passed/failed
Environment details
Execution trends
Interview Tip:
Say: “Our automated reports help stakeholders make go/no-go release decisions confidently.”
Q282. What are the popular reporting tools used in automation frameworks?
Extent Reports Rich HTML reports with screenshots, logs Supports interactive charts
Cucumber
Built-in for BDD frameworks Scenario-based output
HTML
Interview Tip:
Mention you integrated Extent Reports and Allure Reports with TestNG + Jenkins.
ExtentReports extent;
ExtentTest test;
@BeforeTest
extent.attachReporter(spark);
@Test
test.info("Launching application");
test.pass("Login successful");
@AfterTest
extent.flush();
Interview Tip:
Say: “We added custom logs and screenshots for each failed test step.”
MediaEntityBuilder.createScreenCaptureFromPath(screenshotPath).build());
}
Screenshot Utility:
return path;
Interview Tip:
Explain you automated screenshot capture via TestNG listeners.
Detailed Explanation:
Allure is a lightweight, open-source reporting tool that integrates easily with TestNG, JUnit, and
Cucumber.
It provides:
Trend graphs
Step-level detail
Interview Tip:
Say: “We integrated Allure to visualize API + UI test results together.”
Detailed Explanation:
Jenkins automates:
Test execution
Report publishing
Email notifications
Pipeline Example:
stage('Test Execution') {
steps {
sh 'mvn clean test'
stage('Publish Report') {
steps {
Interview Tip:
Say you used Jenkins pipelines to run nightly regression and publish reports to Slack/Email.
Explanation:
Automation coverage = (Automated Test Cases / Total Test Cases) × 100
Tracking Methods:
Formula:
Example:
If 100 hours manual effort is saved monthly and automation setup took 300 hours:
ROI = (100 × 12 – 300) / 300 = 300%
Interview Tip:
Show that you quantify automation value to justify tool and resource costs.
Metric Description
Interview Tip:
Mention you use dashboards for trend analysis and continuous improvement.
Definition:
Defect Leakage = Bugs that escape to later phases (e.g., UAT or Production).
Formula:
Defect Leakage = (Defects found after release / Total defects found) × 100
Minimization Strategies:
Pair testing
Interview Tip:
Say: “We reduced leakage by 40% by enhancing automation regression scope.”
Formula:
Use:
It helps identify high-risk modules requiring more testing or refactoring.
Interview Tip:
Say: “We prioritized testing on high-density modules like Claims Processing in our healthcare
domain.”
5. Regular refactoring
Interview Tip:
Say you apply code review checklists for all new scripts before merging.
Approach:
Interview Tip:
Mention continuous monitoring helps detect flaky tests or environment instability early.
Contents:
Environment details
Recommendations
Example:
Passed: 460
Failed: 40
Pass %: 92%
High Defects: 8
Interview Tip:
Say: “We presented TSRs to business teams weekly for transparency.”
Q295. What are Flaky Tests, and how do you handle them?
Definition:
Flaky tests pass or fail inconsistently due to environment instability, timing, or dependencies.
Causes:
Improper waits
Dynamic data
Browser latency
Solutions:
Interview Tip:
Say you used TestNG retry analyzer to re-run flaky tests automatically.
Tools Used:
JIRA Dashboards
Interview Tip:
Say you built QA dashboards combining test execution trends and defect density graphs.
Approach:
3. Categorize failures
Definition:
Continuous monitoring involves tracking test health, failures, and coverage in real time as part of
CI/CD.
Tools:
Jenkins
ELK stack
Grafana dashboards
Interview Tip:
Say continuous monitoring ensures fast feedback loops in Agile pipelines.
Techniques:
Weekly dashboards
ROI visuals
Interview Tip:
Say: “We used Power BI dashboards linked with Jenkins logs for live reporting.”
Q300. What are your best practices for maintaining test reports and results?
Best Practices:
Interview Tip:
Say: “Every Jenkins run emails HTML reports and summary charts to stakeholders automatically.”
Section 17 – Behavioral QA Leadership & STAR-Based Questions (Q301–Q320)
Q301. Tell me about a time you identified a major defect before production.
Situation:
In my healthcare project, I was testing a claims adjudication module before UAT release.
Task:
I noticed a data mismatch between the UI claim summary and backend database — something that
could have impacted billing accuracy.
Action:
I created a data-driven regression script that compared API and database outputs for 100+ claim
records, exposing a rounding logic issue in pricing.
Result:
The defect was fixed before production, avoiding ~$50,000 in billing errors.
Tip:
Show your attention to detail and technical verification beyond UI — it highlights Dive Deep and
Deliver Results.
Q302. Describe a time when you had to deliver results under tight deadlines.
Situation:
We had a 2-day window to validate a hotfix for an integration issue before deployment.
Task:
Automation suite had to be selectively executed and validated overnight.
Action:
I used TestNG groups and Jenkins pipeline triggers to execute only “critical smoke” scenarios and
generated quick reports for sign-off.
Result:
We achieved 100% test completion within the timeline and enabled an on-schedule release.
Tip:
Focus on prioritization and execution speed — a great Deliver Results example.
Q303. Give an example of when you earned the trust of your developers.
Situation:
Developers initially felt QA raised false alarms during API regression testing.
Action:
I started attaching API request/response logs, screenshots, and SQL validations with every defect,
reducing ambiguity.
Result:
Over time, developers began involving QA early in sprint reviews.
Tip:
This reflects Amazon’s principle Earn Trust — show consistency, transparency, and clarity in
communication.
Q304. Tell me about a time when a test failed, and you investigated the root cause.
Situation:
A login test in Jenkins pipeline kept failing randomly.
Action:
I checked logs, identified an intermittent server timeout, and implemented a retry mechanism using
TestNG RetryAnalyzer.
Result:
Failures dropped by 90%.
Tip:
Focus on your debugging mindset and ability to stabilize flaky tests — demonstrates Dive Deep.
Situation:
Regression runs used to take 4 hours on a single browser.
Action:
I implemented parallel execution using TestNG + Selenium Grid and added browser parameters in
Jenkins jobs.
Result:
Execution time reduced by 60%.
Tip:
Show Invent & Simplify — mention measurable improvement.
Situation:
A production issue in the patient-claims workflow slipped through UAT.
Action:
I led the root-cause analysis, found that an API parameter change wasn’t included in regression tests,
and updated the automation scripts accordingly.
Result:
We prevented similar incidents by integrating API regression with the nightly suite.
Tip:
Demonstrates ownership, accountability, and continuous improvement.
Situation:
The team wanted to use Excel-based test data, but maintenance was high.
Action:
I proposed moving to JSON files with Jackson parser, explaining how it simplifies hierarchical data
handling.
Result:
The team adopted JSON, cutting data maintenance effort by 40%.
Tip:
Shows your technical leadership and ability to guide process improvements.
Q308. Tell me about a time you learned a new tool quickly for a project.
Situation:
We had to start API automation, but no one knew Rest Assured.
Action:
I completed a Udemy certification in a week, built a working prototype, and trained 3 teammates.
Result:
We automated 120 API test cases in the next sprint.
Tip:
Shows Learn and Be Curious — a great Amazon-style example.
Situation:
A teammate disagreed about test priorities during sprint planning.
Action:
I arranged a short sync, used Jira reports to show business impact, and we reprioritized based on
defect severity.
Result:
Sprint testing stayed on schedule without friction.
Tip:
Emphasize collaboration, not confrontation — QA leadership is about negotiation and data-based
decisions.
Action:
I immediately regenerated data, fixed the script, and re-ran the pipeline. Post-demo, I added data
refresh logic before every run.
Result:
Avoided future disruptions and built team trust.
Tip:
Shows Ownership — taking responsibility without excuses.
Q311. Have you ever gone above and beyond your QA role?
Situation:
Developers were overloaded with backend validation tasks.
Action:
I learned SQL queries and automated data verification through JDBC scripts.
Result:
QA turnaround time improved by 30%.
Tip:
Demonstrates initiative — aligns with Bias for Action.
Q312. How do you handle high-severity bugs discovered late in the cycle?
Action Plan:
Tip:
Shows calm, structured decision-making under pressure.
Q313. Tell me about a time when automation helped your team save effort.
Situation:
Manual smoke testing took 2 hours per build.
Action:
I automated it and integrated with Jenkins.
Result:
Saved ~10 hours per week across sprints.
Tip:
Demonstrate measurable impact — “Saved X hours/week” is powerful.
Action Steps:
2. Implement retries
Tip:
Shows adaptability and technical control of environments.
Situation:
A new team member struggled with Selenium locators.
Action:
I conducted short daily mentoring sessions, explained XPath patterns, and paired on exercises.
Result:
Within a month, the tester independently contributed to regression automation.
Tip:
Highlights leadership and coaching mindset.
Situation:
During UI testing, I noticed inconsistent validation rules between frontend and backend.
Action:
I raised it as a design issue during sprint review, backed with API data samples.
Result:
The architecture team refactored validation logic for consistency.
Tip:
Shows your system-level thinking — not just testing, but quality ownership.
Answer:
Tip:
Say: “We achieved in-sprint automation for 70% of features.”
Approach:
Tip:
Shows strategic QA mindset.
Q319. Tell me about a time when your testing prevented a release failure.
Situation:
During release validation, automation caught a session timeout issue after 15 minutes of inactivity.
Action:
Raised critical bug with steps and logs.
Dev fixed session handling before release.
Result:
Avoided production outage for thousands of users.
Tip:
Show real impact — “prevented customer-facing issue.”
Tip:
Detailed Explanation:
Agile is an iterative software development approach where teams deliver small, incremental
releases frequently. QA plays a continuous role rather than testing at the end.
Collaborative delivery
Interview Tip:
Say: “In Agile, QA is embedded from requirement grooming to sprint reviews — not a gatekeeper but
a quality enabler.”
QA Responsibilities in Scrum:
Interview Tip:
Mention: “We followed the shift-left approach — testing starts as soon as stories are ready for
development.”
Sprint Planning Define sprint goals Estimate QA effort, clarify test scope
Retrospective Analyze what went well Suggest process & test improvements
Interview Tip:
Say: “I used retrospectives to propose automation coverage tracking.”
Interview Tip:
Emphasize collaboration and faster feedback loops in Agile.
Q325. What is the Definition of Done (DoD) and Definition of Ready (DoR)?
Example:
DoD includes — “Code merged, unit tests passed, functional automation executed, defects closed.”
Interview Tip:
Say QA helps define DoD with testing completeness criteria.
Sprint:
A time-boxed development cycle (usually 2–3 weeks) focused on delivering specific user stories.
Sprint Backlog:
The list of user stories and tasks selected for the sprint, owned by the team.
Interview Tip:
Show understanding of commitment and prioritization in sprint goals.
Best Practices:
Interview Tip:
Say: “We maintained a sprint automation ratio of 70%, enabling CI-ready test packs.”
Detailed Explanation:
Shift-left means starting testing earlier in the SDLC — during design and development phases.
Benefits:
Cost savings
Reduced rework
Example:
QA reviews user stories, writes acceptance tests before code is written.
Interview Tip:
Say: “We adopted shift-left by pairing QA with developers during unit test creation.”
Detailed Explanation:
Shift-right involves testing in production or near-production environments — focusing on resilience,
performance, and monitoring.
Examples:
A/B testing
Chaos engineering
Production monitoring
Interview Tip:
Say: “We used shift-right to monitor real-time API latency using Grafana and automated health
checks.”
Approach:
Interview Tip:
Say: “We classified user stories by risk and customer impact, focusing automation on the top 20%
critical paths.”
Definition:
CI ensures that code changes from multiple developers are integrated and tested automatically in a
shared repository.
Tools:
Jenkins, GitHub Actions, Azure DevOps, GitLab CI.
Interview Tip:
Mention you integrated your Selenium/TestNG suite with Jenkins CI pipeline.
Definition:
CD automates the deployment of tested builds to staging or production environments, ensuring
quick, safe releases.
Pipeline Example:
Interview Tip:
Say: “Our CI/CD pipeline automatically deployed tested builds nightly to the QA environment.”
Responsibilities:
Interview Tip:
Say QA bridges Dev and Ops by embedding quality in every stage — from build validation to
production monitoring.
Best Practices:
Interview Tip:
Say: “We introduced QA huddles twice a week to align on blockers and automation targets.”
Key Metrics:
Defect leakage
Interview Tip:
Say: “We tracked sprint defect leakage and aimed for <5%.”
Action Steps:
Interview Tip:
Say: “We avoid partial closures — a story is marked ‘done’ only if automation and manual testing are
complete.”
Challenge Solution
Interview Tip:
Show proactive problem-solving, not just listing challenges.
Stages Involved:
Interview Tip:
Say you configured Jenkins jobs to trigger Selenium + API tests on every build push.
Interview Tip:
End strong: “Agile QA is not just automation — it’s about enabling faster, safer releases through
collaboration and intelligence.”
Detailed Explanation:
A test strategy outlines how testing will be performed — defining scope, approach, resources, tools,
and risk mitigation.
Key Components:
Interview Tip:
Say: “I created a hybrid QA strategy focusing on early automation and parallel test execution for
faster feedback.”
Approach:
Interview Tip:
Show a data-driven mindset — “We used historical story points and defect trends for accurate
estimation.”
Action Plan:
Interview Tip:
Say: “QA adds value by asking the right questions early — preventing misaligned development.”
Corrective Actions:
Interview Tip:
Say: “We reduced post-release defects by 30% after implementing root cause analysis sessions per
sprint.”
Steps:
Interview Tip:
Say: “Our selective regression reduced execution from 8 hours to 2 hours.”
Action Plan:
2. Reproduce in QA environment.
Approach:
Example:
stage('Smoke Tests') {
steps {
Interview Tip:
Say you used a “quality gate” model in Jenkins for continuous validation.
Method:
Daily stand-up updates
“Out of 250 regression tests, 243 passed (97%). 2 critical defects logged impacting the billing
workflow.”
Interview Tip:
Shows clarity, confidence, and stakeholder awareness.
Approach:
Interview Tip:
Say: “I believe in mentorship and clear ownership to keep the team engaged.”
Q350. How do you handle defects that developers claim are “not reproducible”?
Approach:
3. Compare configurations.
Interview Tip:
Show collaboration, not confrontation — “I treat such cases as learning opportunities to improve
environment parity.”
Strategy:
Example:
Order creation → API validation → DB status check → UI confirmation.
Interview Tip:
Say: “We used end-to-end validation combining API + UI automation.”
Q352. How do you handle dependencies between teams (Dev, QA, Ops)?
Approach:
Interview Tip:
Shows ownership and coordination ability in cross-functional teams.
Best Practices:
Interview Tip:
Say: “We used Confluence to maintain living documentation updated every sprint.”
Metric Description
Interview Tip:
Say: “We tracked automation ROI and reduced test cycle time by 50%.”
Steps:
Example:
Reduced flaky tests by stabilizing waits and reusing driver utilities.
Interview Tip:
Show your mindset of Inspect and Adapt.
Approach:
Example:
Interview Tip:
Say: “We automated browser validation across Chrome, Firefox, and Edge in Jenkins CI.”
Approach:
Best Practices:
Interview Tip:
Especially in healthcare domain, emphasize HIPAA and data privacy awareness.
Strategy:
Interview Tip:
Say: “We used Jenkins jobs to auto-verify environment readiness before test execution.”
Answer:
Automation is evolving toward intelligent, integrated testing — combining AI, cloud, and continuous
validation.
Key trends:
Self-healing frameworks
Interview Tip:
End powerfully: “The future QA engineer is not just a tester — but a quality engineer who ensures
product excellence at every stage.”