Coforge Automation Interview Questions
These are the questions from a Coforge automation testing interview, with a model answer — and code where it's expected — for each one. The interview had several technical rounds covering your project and framework, Selenium, API testing, SQL, Java concepts and coding. A closely related topic: Cognizant & Infosys Automation Testing Interview Questions.
Project & Framework
Explain your project. What is your sprint length?
Start with the domain and application in one line, then explain your team size, your role, technology stack and the areas you own.
Most teams use two-week sprints, but always state the sprint length used by your own team and explain how testing fits into the sprint.
A good answer should cover:
- What the application does
- Your team's size and structure
- Your responsibilities
- Automation and manual testing responsibilities
- Framework and tools
- How testing fits into development and sprint activities
- Your contribution to releases and regression cycles
See How to Explain Your Project.
Have you created a framework from scratch? What challenges did you face?
If you have built a framework from scratch, explain the order in which you developed it.
A typical sequence is:
- Project and Maven setup
- Driver factory
- Base classes
- Page Object Model
- Configuration management
- Test-data handling
- Utilities and reusable methods
- Reporting
- CI/CD integration
Then explain the challenges you encountered and how you solved them.
Typical challenges include:
- Flaky test synchronization
- Dynamic locators
- Test-data collisions
- Browser compatibility
- Parallel execution
- CI-only failures
- Environment-specific configuration
- Maintaining reusable page components
Don't just say that you "fixed flaky tests." Explain what caused the flakiness, what you changed and what improvement you observed.
See Build a Framework From Scratch.
Where have you used inheritance?
A common example is having test classes extend a BaseTest class.
The BaseTest can contain common functionality such as:
- WebDriver setup
- Browser configuration
- Test setup and teardown
- Common environment configuration
Similarly, page classes can extend a BasePage class containing shared functionality such as:
- Explicit wait utilities
- Common click methods
- Element visibility checks
- JavaScript helpers
- Common navigation methods
For example:
public class LoginTest extends BaseTest {
// Test methods
}
public class LoginPage extends BasePage {
// Login page methods
}
See OOP Concepts in Your Framework.
How many test cases did you automate in one sprint?
Give an honest number and provide the context behind it.
For example:
"I typically automated around 15–25 test cases in a sprint, depending on complexity, while also maintaining existing automation scripts and supporting regression execution."
The number alone isn't enough. Explain how you prioritize automation.
For example:
- Business-critical scenarios first
- Stable and repeatable workflows
- High-risk functionality
- Regression-heavy scenarios
- Data-intensive scenarios
- Scenarios that are expensive to execute manually
The interviewer is usually interested in how you make automation decisions rather than simply the number of scripts you created.
How do you achieve thread safety for parallel execution?
Give each test thread its own WebDriver instance using ThreadLocal.
You should also make sure that test data is independent so that parallel tests don't interfere with each other.
A simple implementation is:
public final class DriverFactory {
private static final ThreadLocal<WebDriver> DRIVER =
new ThreadLocal<>();
public static void init() {
DRIVER.set(new ChromeDriver());
}
public static WebDriver get() {
return DRIVER.get();
}
public static void quit() {
if (DRIVER.get() != null) {
DRIVER.get().quit();
DRIVER.remove();
}
}
}
Call init() in @BeforeMethod and quit() in @AfterMethod.
The important point is that each thread gets its own WebDriver instance. Calling remove() after quitting also prevents stale references when threads are reused.
See Parallel Execution & Grid.
Write code to read the username and password from a properties file.
Use Java's Properties class to load values from a configuration file.
Properties props = new Properties();
try (InputStream in =
new FileInputStream("src/test/resources/config.properties")) {
props.load(in);
}
String username = props.getProperty("username");
String password = props.getProperty("password");
A typical config.properties file might contain:
username=testuser
password=testpassword
In real projects, don't store actual passwords in Git. Use environment variables, Jenkins credentials or another secure secrets-management mechanism.
Selenium
How do you handle a browser authentication popup?
An HTTP Basic Authentication popup is a browser-level authentication mechanism. It is different from a JavaScript alert, so it can't be handled using Selenium's normal alert APIs or located as a web element.
With Selenium 4 on supported Chromium browsers, you can register credentials before navigating:
((HasAuthentication) driver)
.register(UsernameAndPassword.of("admin", "admin"));
driver.get(
"https://the-internet.herokuapp.com/basic_auth"
);
Another simple approach is to include the credentials in the URL:
driver.get(
"https://admin:admin@the-internet.herokuapp.com/basic_auth"
);
The URL approach is simple but isn't supported in every environment and should not be treated as a secure way to manage credentials.
How do you handle random JavaScript alerts?
If an alert appears only sometimes, you don't want the test to fail simply because the alert wasn't displayed.
You can wait briefly for an alert and dismiss it if it appears:
public void dismissAlertIfPresent() {
try {
new WebDriverWait(driver, Duration.ofSeconds(2))
.until(ExpectedConditions.alertIsPresent())
.dismiss();
} catch (TimeoutException e) {
// No alert appeared — continue
}
}
The important idea is to distinguish an optional alert from an alert that is required for the test flow.
What is StaleElementReferenceException?
StaleElementReferenceException occurs when the WebElement reference you previously stored is no longer connected to the current DOM.
This commonly happens when:
- The page is refreshed
- The DOM is re-rendered
- A framework such as React or Angular replaces an element
- A table or component is dynamically updated
- The element is removed and recreated
Instead of holding a WebElement for too long, store the locator and find the element again when you need it.
For example:
By loginButton = By.id("login");
driver.findElement(loginButton).click();
This is generally more resilient than storing a WebElement reference long before the actual interaction.
See StaleElementReferenceException.
API & REST Assured
RequestSpecification vs ResponseSpecification?
A RequestSpecification stores reusable request configuration.
For example:
- Base URI
- Headers
- Authentication
- Content type
- Common request parameters
A ResponseSpecification stores reusable expectations for responses.
For example:
- Expected status code
- Content type
- Common response validations
You can build these specifications once and reuse them with .spec().
Conceptually:
RequestSpecification requestSpec =
new RequestSpecBuilder()
.setBaseUri("https://api.example.com")
.setContentType(ContentType.JSON)
.build();
ResponseSpecification responseSpec =
new ResponseSpecBuilder()
.expectStatusCode(200)
.expectContentType(ContentType.JSON)
.build();
Then reuse them across tests instead of repeating the same configuration.
See REST Assured Framework Design.
500 vs 503?
500 Internal Server Error means the server encountered an unexpected condition while processing the request.
Common causes include:
- Application bugs
- Unhandled exceptions
- Unexpected server-side failures
503 Service Unavailable means the server is temporarily unable to handle the request.
Common situations include:
- Server overload
- Maintenance
- Temporary downtime
- Deployment activity
- An unavailable dependent service
A useful interview answer is:
500 usually indicates an unexpected server-side failure, while 503 indicates that the service is temporarily unavailable.
Have you tested GraphQL APIs?
GraphQL commonly uses a single endpoint, often:
POST /graphql
Instead of having separate REST endpoints for every resource, the request body contains a GraphQL query or mutation describing the data required.
For example:
given()
.contentType(ContentType.JSON)
.body("{\"query\": \"{ user(id: 1) { name email } }\"}")
.when()
.post("/graphql")
.then()
.statusCode(200)
.body("errors", nullValue())
.body("data.user.name", notNullValue());
One important difference with GraphQL is that an HTTP 200 response doesn't necessarily mean the GraphQL operation succeeded.
Therefore, validate both:
- HTTP status
- GraphQL
errors - Expected
data - Required fields
You should also test:
- Query variables
- Mutations
- Authentication and authorization
- Field-level authorization
- Invalid queries
- Missing required fields
- Invalid arguments
- Very deep or expensive queries
If you haven't worked with GraphQL professionally, say so honestly and explain how you would approach testing it.
SQL & Testing Process
Explain GROUP BY with an example.
GROUP BY groups rows with the same values so that aggregate functions such as COUNT(), SUM(), AVG(), MIN() and MAX() can operate on each group.
For example, suppose you want to find customers who have placed more than five orders:
SELECT customer_id,
COUNT(*) AS order_count
FROM orders
GROUP BY customer_id
HAVING COUNT(*) > 5;
Here:
GROUP BY customer_idcreates one group per customer.COUNT(*)counts orders for each customer.HAVING COUNT(*) > 5filters the grouped results.
See SQL Aggregate Functions & GROUP BY.
A developer says "it's not a bug." What do you do?
Don't make the discussion personal.
First:
- Re-check the requirement.
- Review the acceptance criteria.
- Reproduce the issue.
- Collect screenshots, logs, request/response data or other evidence.
- Explain the observed behavior and expected behavior.
- Discuss the issue with the developer calmly.
- If the requirement itself is unclear, involve the BA, product owner or relevant stakeholder.
A strong interview answer is:
"I would first verify the requirement and reproduce the issue. If the behavior differs from the acceptance criteria, I would provide clear evidence and discuss it with the developer. If the requirement is ambiguous, I would involve the BA or product owner so the expected behavior can be confirmed."
See When a Developer Rejects Your Bug.
Java Concepts
StringBuffer vs StringBuilder?
Both StringBuffer and StringBuilder are mutable classes used for modifying strings without creating a new object for every operation.
The main difference is thread safety.
| Feature | StringBuffer | StringBuilder |
|---|---|---|
| Mutable | Yes | Yes |
| Synchronized | Yes | No |
| Thread-safe | Yes | No |
| Performance | Generally slower | Generally faster |
| Typical use | Multi-threaded scenarios requiring synchronization | Single-threaded code |
For most automation code, StringBuilder is the usual choice unless synchronization is specifically required.
How many String objects are created by new String("Java")?
Potentially two objects are involved:
- The
"Java"string literal in the String Pool, if it does not already exist. - The new
Stringobject explicitly created on the heap.
For example:
String s1 = "Java";
String s2 = "Java";
String s3 = new String("Java");
s1 == s2 is true because both reference the same pooled string.
But:
s1 == s3
is false because s3 refers to a separate String object.
For content comparison, always use:
s1.equals(s3)
rather than ==.
finally vs finalize?
finally is a block used with try/catch and is commonly used for cleanup operations.
For example:
try {
// Code
} catch (Exception e) {
// Handle exception
} finally {
// Cleanup
}
finalize() was a method that the garbage collector could potentially invoke before reclaiming an object.
It has been deprecated since Java 9 and should not be used for resource management.
Use try-with-resources for resources such as files, streams and database connections.
What does the protected access modifier mean?
protected members are accessible:
- Within the same package
- In subclasses, including subclasses in other packages through inheritance
For example:
public class BasePage {
protected WebDriver driver;
}
A child page class can access the inherited driver:
public class LoginPage extends BasePage {
public void openLoginPage() {
driver.get("https://example.com/login");
}
}
This is one reason you may see common framework objects such as driver declared as protected in base classes.
Java Coding
Remove duplicate elements from an ArrayList
A LinkedHashSet can remove duplicates while preserving the original insertion order.
List<Integer> unique =
new ArrayList<>(new LinkedHashSet<>(list));
For example:
Input: [3, 1, 3, 2, 1]
Output: [3, 1, 2]
LinkedHashSet is useful here because:
Setremoves duplicates.LinkedHashSetmaintains insertion order.- Converting it back to an
ArrayListgives you a list again.
Remove duplicate characters from a string
One simple approach is to use a HashSet to track characters that have already been encountered.
public static String removeDuplicateChars(String s) {
StringBuilder sb = new StringBuilder();
Set<Character> seen = new HashSet<>();
for (char c : s.toCharArray()) {
if (seen.add(c)) {
sb.append(c);
}
}
return sb.toString();
}
Example:
Input: programming
Output: progamin
The important point is that Set.add() returns false when the value already exists in the set.
More: Java Coding Programs for Interview.
From Real Projects
In interviews for testing and automation roles, I've found the questions come back to real work: the application you tested, how you wrote and reviewed test cases, how you tracked execution and defects (for me, TestRail and Jira), and how your automation was structured (Selenium, Java, TestNG, POM and a business library). Prepare one short, honest example from your own projects for each topic on this page. On Canolog, every department — sales, inventory, finance, service and parts — connects to the others, so a change in one module had to be checked in the flows that depend on it. Expect questions on your own framework as much as on Selenium theory. A closely related topic: Wipro Test Automation Engineer Interview Questions.
📚 Official documentation: ISTQB Glossary of testing terms
FAQs
What does the Coforge automation interview cover?
The interview can cover your project and framework, Selenium, API testing and REST Assured, SQL, Java concepts and Java coding across multiple technical rounds.
How do you handle a browser authentication popup in Selenium?
For supported Chromium browsers with Selenium 4, you can register credentials using HasAuthentication and UsernameAndPassword.
Another approach is passing credentials in the URL, although this approach has limitations and should be used carefully.
How do you achieve thread safety?
Use a ThreadLocal<WebDriver> so every parallel execution thread gets its own WebDriver instance.
Also make sure test data is independent so parallel tests don't modify or consume the same data.
What's the difference between 500 and 503?
500 Internal Server Error indicates an unexpected server-side failure.
503 Service Unavailable indicates that the service is temporarily unable to process requests, commonly because of maintenance, overload or temporary unavailability.