Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About Mphasis hiring for Automation Testing roles
Mphasis is an Indian IT services company, majority-owned by Blackstone, providing cloud, application, testing, data and cognitive services. It has a strong presence in banking, financial services and insurance clients. In India it hires for software engineers, test engineers, data analysts and data engineers, often for BFSI-focused projects.
For Automation Testing roles, this Mphasis practice set focuses most on Git, Maven and Jenkins (7), Selenium WebDriver (5), Page Object Model (5), Selenium Grid & Docker (4). It has 20 easy, 20 medium questions, so you can start easy and work up to the harder ones.
Company type
IT services
Headquarters
Bengaluru, India
Main India offices
Bengaluru, Pune, Chennai
Mphasis Automation Testing interview process
Online assessment (aptitude + reasoning)
Coding test
Technical interview
HR round
Typical pattern based on public candidate experiences. Rounds vary by role, team and year.
Solved for MphasisStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
A short summary line under about 60 characters in the imperative mood, like "Add retry for flaky payment test", followed by a blank line and a body explaining why the change was made if not obvious. Reference the ticket ID. Small focused commits with clear messages make reviews faster and help when using git log or git bisect to find when a test broke.
02
How do you record videos of tests running on a Docker Selenium Grid?
Add the selenium/video image as a sidecar container next to each node, sharing the node's display through DISPLAY_CONTAINER_NAME, and mount a folder for the mp4 files. Newer Grid versions also support recording per session by setting the se:recordVideo capability with Dynamic Grid. Name videos with se:name so they match test names. Keep videos only for failed tests or for a few days, because they use a lot of disk space.
findElement returns the first match and throws NoSuchElementException if nothing is found. findElements returns a List (empty if nothing is found) — handy to check whether an element exists.
04
What is the Maven Surefire plugin and how do you configure it for TestNG?
Surefire runs tests during the test phase. For TestNG, configure suiteXmlFiles with the path to testng.xml, so mvn test runs that suite. You can pass system properties, set parallel and threadCount, and control reports. Make the suite file a property like ${suiteXml} so CI can choose smoke.xml or regression.xml with -DsuiteXml=smoke.xml.
05
Write an XPath for a button with the text "Login".
Capabilities are key-value settings sent when creating a session that tell Appium what to automate. Essential ones are platformName, appium:automationName (UiAutomator2 or XCUITest), appium:deviceName or appium:udid, and either appium:app (path to the apk or ipa) or appPackage and appActivity for an installed Android app. In Appium 2 non-standard capabilities need the appium: prefix. In Java you usually set them through UiAutomator2Options or XCUITestOptions.
07
A teammate compares two strings with == and the test sometimes passes and sometimes fails. Explain.
== compares object references, not content. String literals are interned, so two literals with the same text may share a reference and == returns true, but strings read from the UI or built at runtime are new objects, so == returns false even with the same text. Use equals() or equalsIgnoreCase() for content, and Objects.equals() to be null-safe.
08
How do you validate a response against a JSON schema in REST Assured?
Add the json-schema-validator dependency, place the schema file in src/test/resources, and assert with then().body(matchesJsonSchemaInClasspath("user-schema.json")). Schema validation checks field types, required fields and structure, so it catches contract changes that value checks might miss. It complements, not replaces, assertions on business values like status or totals.
09
A test configuration value has to be the same for the whole run and accessed from many classes. How do you implement it?
Create a ConfigReader that loads properties once, using a singleton or a static holder initialised lazily in a thread-safe way, and exposes typed getters like getInt("timeout"). Let system properties and environment variables override file values so CI can change them. Keep it read-only after loading so parallel threads cannot change settings mid-run.
10
What locator strategy do you follow inside page objects?
Prefer stable attributes in this order: dedicated test attributes like data-testid, id, name, then short CSS selectors, and XPath only when text or complex relationships are needed. Avoid absolute XPaths and index-based locators. Keep locators as private final By fields at the top of the class with clear names, so updates are quick and readable.
11
What is API testing and why is it done before UI testing?
API testing checks the business logic layer directly by sending requests and validating responses, status codes, data and errors. It is faster, more stable and cheaper to maintain than UI tests, and it can start as soon as endpoints exist, before the UI is ready. Most functional rules should be covered at API level, leaving UI tests for key user journeys.
12
Explain the given-when-then structure in REST Assured.
given() sets up the request: headers, params, body, auth. when() performs the HTTP call such as get(), post(), put() or delete(). then() validates the response: status code, headers, body using Hamcrest matchers, and response time. You can call extract() after then() to pull values for later steps. The fluent structure reads like a test specification and keeps setup, action and checks clearly separate.
The GUI is meant for building and debugging scripts. During a run it consumes significant memory and CPU to render the tree and listeners, which limits how many threads one machine can generate and can distort response times. Non-GUI mode, started with jmeter -n, uses far fewer resources, is scriptable in CI and writes results to a file. The JMeter GUI itself shows a warning recommending this.
16
What are Java collections and which ones do testers use most?
ArrayList and LinkedList for lists, HashSet for unique values, HashMap for key-value test data, and Iterator for traversing them, for example collecting web elements in a list.
Appium Inspector is a desktop or web tool that connects to an Appium server with your capabilities and shows a live screenshot of the app with its element tree. Clicking an element shows its attributes such as accessibility id, resource-id, text and bounds, and suggests locators. You can also try taps and swipes interactively. Testers use it to find stable locators and to check whether an element is really present before writing code.
The default lifecycle has phases in order: validate, compile, test, package, verify, install and deploy. Running a phase runs all earlier phases too, so mvn test compiles and then runs unit tests through Surefire. mvn verify also runs integration tests with Failsafe. There are also clean and site lifecycles. Automation suites usually run with mvn clean test or mvn clean verify.
19
Tell me about a time you set up test infrastructure that other teams started using.
Situation: three product teams each kept their own unstable Grid VMs. Task: provide one reliable shared Grid. Action: I set up a Docker-based Grid with pinned images, health checks, video for failures and a short onboarding guide, then ran a pilot with one team and fixed their issues before opening it up. Result: all three teams moved within a quarter, VM costs dropped and Grid-related failures fell sharply.
20
How do you handle a browser basic authentication pop-up in Selenium?
The basic auth dialog is not part of the page, so findElement cannot reach it. The simplest way is putting credentials in the URL, like https://user:pass@site.test, which works in many browsers. In Selenium 4 with Chromium you can register credentials through the HasAuthentication interface: ((HasAuthentication) driver).register(UsernameAndPassword.of("user", "pass")). Keep the credentials in environment variables or a secret store, never in code.
21
What do number of threads, ramp-up period and loop count mean in a JMeter Thread Group?
Number of threads is how many virtual users run in parallel. Ramp-up period is the time JMeter takes to start all of them, so 100 threads with a 50-second ramp-up starts two users per second. Loop count is how many times each user repeats the samplers, or you can set a duration instead. A gradual ramp-up avoids an unrealistic burst at the start and shows where response times begin to degrade.
22
Write a REST Assured test using RequestSpecBuilder and ResponseSpecBuilder.
By default Appium clears app data between sessions but keeps the app installed. noReset set to true keeps app data and login state, which speeds up tests but can leak state between them. fullReset set to true uninstalls and reinstalls the app, giving the cleanest state but adding time. A common approach is noReset for fast suites with explicit cleanup in the test, and fullReset only for first-launch or onboarding scenarios.
24
What is the difference between a page object and a utility class in a test framework?
A page object models one screen or component: its locators and the user actions possible there, such as LoginPage.loginAs. A utility class holds generic helpers not tied to any page, such as reading config, generating test data, date formatting or taking screenshots. Mixing them makes page objects bloated and utilities dependent on the UI. Keep page objects in a pages package and helpers in a utils package.
Add the rerun plugin, for example rerun:target/failed.txt, to the main runner. It writes the location of each failed scenario. Create a second runner whose features point to @target/failed.txt and run it after the main run in Maven or Jenkins. Use reruns to separate real failures from flaky ones, but track flaky scenarios and fix them instead of hiding them.
26
How do you handle authentication types in REST Assured?
Basic auth uses auth().preemptive().basic(user, pass). Bearer tokens are set as a header: header("Authorization", "Bearer " + token). OAuth 2.0 can use auth().oauth2(token) after fetching the token from the token endpoint. API keys go in a header or query param. Fetch tokens once per suite or cache them with an expiry check rather than logging in before every test.
27
What is a .gitignore file and what should an automation project ignore?
A .gitignore lists files Git should not track. In a Java automation project ignore target/, test-output/, allure-results/, reports, screenshots, logs, IDE folders like .idea and .vscode, *.iml, OS files like .DS_Store, and local config files holding secrets. Ignoring generated output keeps the repository small and avoids noisy diffs and conflicts.
28
What are appPackage and appActivity in Android automation?
appPackage is the unique application id of an Android app, such as com.example.shop, and appActivity is the activity screen that Appium launches first, such as .MainActivity. Together they let Appium start an app that is already installed without passing the apk path. You can find them with adb shell dumpsys window or by reading the manifest. A wrong activity name is a common reason a session fails to start.
29
How do you make WebDriver thread-safe for parallel runs?
It occurs when one Gherkin step matches two or more step definitions, usually because of broad regular expressions or duplicate methods in different classes within the glue. Fix it by making expressions more specific, anchoring regexes with ^ and $, or removing the duplicate. Keeping step definitions organised by domain and reviewing new steps in pull requests prevents it.
31
What is the difference between @Test(priority) and dependsOnMethods in TestNG?
priority only orders tests; a lower number runs first, and a failed test does not stop the others. dependsOnMethods creates a real dependency: if the parent test fails, dependent tests are skipped. Both make tests order-dependent, which hurts parallel runs and isolation, so use them sparingly. Prefer independent tests with their own setup.
32
What is the difference between a Docker image and a container?
An image is a read-only template that contains an operating system layer, software and configuration, for example selenium/standalone-chrome with Chrome and ChromeDriver installed. A container is a running instance of an image with its own process, network and writable layer. You can start many containers from one image and destroy them after a test run. This is why every run starts from the same clean browser environment.
33
What branching strategy do you use for test automation code?
Most teams use trunk-based development or a light GitHub Flow: short-lived feature branches from main, a pull request with review and a CI run, then merge. Long-lived branches cause painful conflicts. Keep automation code in the same repository as the app when possible so tests change together with features, or tag test versions to match app releases.
34
What is the LoadableComponent pattern in Selenium?
LoadableComponent is a Selenium support class that standardises how a page object ensures it is loaded. You extend it and implement load(), which navigates to the page, and isLoaded(), which throws an Error if the page is not ready. Calling get() checks isLoaded and calls load only if needed, then checks again. It gives a consistent, self-verifying way to open pages and fails fast with a clear message.
35
What is a Jenkins agent and how do labels help run tests?
An agent is a machine or container that runs build steps on behalf of the Jenkins controller. Labels are tags given to agents, such as linux, docker or windows-chrome. In a pipeline, agent { label 'docker' } sends the job to a matching agent. Testers use labels to send UI tests to agents with browsers or Docker installed, and to keep heavy test runs off the controller, which should only coordinate.
Gherkin is the plain-English language Cucumber uses to describe behaviour. Main keywords are Feature, Scenario, Given (precondition), When (action), Then (expected outcome), And/But (continuation), Background (common steps), Scenario Outline with Examples (data-driven), and Rule (groups scenarios under one business rule). Because it is readable by business analysts and testers alike, the feature file becomes living documentation as well as an executable test.
38
What is the difference between git reset --soft, --mixed and --hard?
All three move the current branch to another commit, but treat your changes differently. Soft keeps the changes staged, which is useful to squash recent commits. Mixed, the default, keeps the changes in the working folder but unstages them. Hard throws away staged and working changes completely, so use it carefully. Never reset commits that are already pushed to a shared branch; use git revert there instead.
39
How do you watch a test running inside a Docker Selenium container?
The selenium node and standalone images include a VNC server and noVNC. Expose port 7900 and open http://localhost:7900 in a browser; the default password is secret, or set SE_VNC_NO_PASSWORD to skip it. You can also open the Grid UI on port 4444 and click the session's video icon. This is very useful for debugging tests that fail only inside the container, such as layout or focus problems.
40
A test fails with TimeoutException waiting for an element that is clearly visible on screen. What do you check?
Check whether the element is inside an iframe or shadow DOM, the locator matches a different hidden element first, the page opened in a new tab not yet switched to, or the wait condition is wrong, such as presence versus visibility versus clickable. Use findElements to see how many matches the locator has and verify it in browser DevTools.
Tips to crack the Mphasis Automation Testing interview
Learn BFSI basics such as banking transactions, insurance claims and mortgages, since many Mphasis clients are in this domain.
Revise testing concepts, SQL and one programming language well for technical interviews.
Read about Mphasis's Front2Back transformation approach, which the company uses to describe its service model.
Keep a one-minute story ready for every project on your CV: problem, your part, tools, result.
Practise the hard questions on this page aloud; Mphasis interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the Mphasis Automation Testing interview?
Candidates usually go through 4 stages: Online assessment (aptitude + reasoning); Coding test; Technical interview; HR round. The exact rounds change with the role, team, location and your experience, so confirm the process with the recruiter.
Which topics should I prepare for the Mphasis Automation Testing interview?
This practice set leans on Git, Maven and Jenkins (7), Selenium WebDriver (5), Page Object Model (5), Selenium Grid & Docker (4). Revise those first, then practise explaining one or two of your own projects end to end, because most Mphasis interviewers ask you to walk through real work.
Are these the exact questions asked at Mphasis?
No. These are curated practice questions that match the skills and difficulty usually tested in it services interviews like Mphasis's. They are not a leaked or verified list of past questions.
Where does Mphasis hire Automation Testing professionals in India?
Mphasis has large teams in Bengaluru, Pune, Chennai. Openings and locations change often, so check the Mphasis careers page and filter by city and experience.
Automation Testing questions for similar companies