QA Interview Questions for QA role | 4 Years Experience
QA Interview Questions for QA role | 4 Years Experience
1. Tell Me About Yourself
Sample Answer
I am a QA Engineer with 4 years of experience in Manual and Automation Testing. I have worked extensively on Web and API automation using Selenium WebDriver, Java, TestNG, Maven, and RestAssured. I have experience in designing and maintaining Hybrid frameworks with Page Object Model (POM).
I am involved in requirement analysis, test case design, execution, defect reporting using Jira, CI/CD integration using Jenkins, and cross-browser testing. I also have experience in API automation and validating responses using POJO classes.
2. Test Case: Search Button on Amazon Not Working
Sample Answer
Test Case ID: TC_AMZ_001
Title: Verify Search Button Functionality
Precondition: User navigates to Amazon homepage
Test Steps:
- Open browser
- Navigate to https://www.amazon.in
- Enter product name in search textbox (e.g., “Laptop”)
- Click on Search button
Expected Result:
User should be redirected to search results page displaying relevant products.
Actual Result:
Search button does not respond / No navigation happens.
Defect Raised:
- Summary: Search button not working on homepage
- Severity: High
- Priority: High
- Steps to Reproduce: Mention above steps
- Environment: Chrome 120, Windows 10
3. Selenium 4 – Navigate to Google
Sample Answer
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class GoogleTest {
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.com");
driver.manage().window().maximize();
driver.quit();
}
}
4. What is WebDriver? Interface or Class?
Sample Answer
WebDriver is an interface in Selenium. It defines methods like get(), findElement(), close(), quit().
Classes like ChromeDriver, FirefoxDriver implement this interface.
5. Can’t We Write ChromeDriver Instead of WebDriver?
Sample Answer
We can write ChromeDriver driver = new ChromeDriver(); but best practice is:
WebDriver driver = new ChromeDriver();
Because it follows Abstraction & Polymorphism. If we change browser to FirefoxDriver, we only change the object, not the reference type.
6. Difference Between Class and Interface
Sample Answer
| Class | Interface |
|---|---|
| Can have method implementation | Contains abstract methods (before Java 8) |
| Supports constructors | No constructors |
| Single inheritance | Multiple inheritance supported |
7. Why Can’t We Write Class Logic in Interface?
Sample Answer
Interface is meant to provide 100% abstraction (design level). Logic should be written in implementing classes to ensure flexibility and reusability. Before Java 8, interfaces could not contain method bodies.
8. Login to Google – Framework Structure (POM)
Sample Answer
BaseClass:
public class BaseClass {
public static WebDriver driver;
public void initializeDriver() {
driver = new ChromeDriver();
driver.manage().window().maximize();
}
}
LoginPage (POM):
public class LoginPage {
WebDriver driver;
By email = By.id("identifierId");
By nextBtn = By.id("identifierNext");
public LoginPage(WebDriver driver){
this.driver = driver;
}
public void login(String username){
driver.findElement(email).sendKeys(username);
driver.findElement(nextBtn).click();
}
}
Test Class:
public class LoginTest extends BaseClass {
@Test
public void verifyLogin(){
initializeDriver();
driver.get("https://accounts.google.com");
LoginPage lp = new LoginPage(driver);
lp.login("test@gmail.com");
Assert.assertTrue(driver.getTitle().contains("Google"));
driver.quit();
}
}
9. Java Program – Find 2nd Maximum Element
Sample Answer
public class SecondMax {
public static void main(String[] args) {
int[] arr = {10, 5, 20, 8, 25};
int max = Integer.MIN_VALUE;
int secondMax = Integer.MIN_VALUE;
for(int num : arr){
if(num > max){
secondMax = max;
max = num;
} else if(num > secondMax && num != max){
secondMax = num;
}
}
System.out.println("Second Max: " + secondMax);
}
}
10. Did You Develop the Framework?
Sample Answer
Yes, I contributed to developing a Hybrid framework using Selenium, Java, TestNG, Maven, and POM.
I was responsible for Base class creation, utility classes, report generation using Extent Reports, and CI integration with Jenkins.
11. POJO Classes & API Automation Logic
Sample Answer
public class User {
private String name;
private String job;
// getters and setters
}
Sending Request:
User user = new User();
user.setName("John");
user.setJob("QA");
Response response =
given()
.contentType(ContentType.JSON)
.body(user)
.when()
.post("/users");
Extract Response:
String id = response.jsonPath().getString("id");
System.out.println(id);
12. Jenkins – Can You Build a Pipeline?
Sample Answer
Yes, I can create Freestyle and Pipeline jobs. I configure Git repository, build triggers, Maven goals (clean test), and generate reports.
13. Can We Use Script to Create Jenkins Pipeline?
Sample Answer
pipeline {
agent any
stages {
stage('Build') {
steps {
sh 'mvn clean'
}
}
stage('Test') {
steps {
sh 'mvn test'
}
}
}
}
14. Do You Know Linux?
Sample Answer
Yes, I have basic knowledge of Linux commands for navigating directories, creating files, checking logs, and running automation scripts in CI environments.
15. Linux Command to Create a File
Sample Answer
touch filename.txt
Or
cat > filename.txt