McKinsey & Company Automation Testing Interview Questions & Answers
Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About McKinsey & Company hiring for Automation Testing roles
McKinsey & Company is a global management consulting firm that advises companies, governments and institutions on strategy, operations, technology and organisation. In India it has client service offices as well as large knowledge and capability centres that support consultants worldwide with research, analytics and digital work. It hires business analysts, research analysts, data scientists and software engineers in India.
For Automation Testing roles, this McKinsey & Company practice set focuses most on Cucumber and BDD (6), Selenium WebDriver (6), Core Java for Testers (5), Git, Maven and Jenkins (5). It has 6 easy, 30 medium, 4 hard questions, so you can start easy and work up to the harder ones.
Company type
Consulting
Headquarters
New York, USA
Main India offices
Gurugram, Mumbai, Bengaluru, Chennai
McKinsey & Company Automation Testing interview process
Online problem-solving assessment or game-based test
Case interview round 1
Case interview round 2 with personal experience questions
Final partner round
Typical pattern based on public candidate experiences. Rounds vary by role, team and year.
Solved for McKinsey & CompanyStart 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 quality gate is a rule a build must pass before moving forward, such as all smoke tests passing, code coverage above a threshold, no critical static analysis issues, or no new high-severity vulnerabilities. If the gate fails, the pipeline stops and the change is not deployed. Gates make quality an automatic decision instead of a manual check.
02
How do you extract an auth token with JSON Extractor and use it in later JMeter requests?
Add a JSON Extractor as a child of the login sampler. Set the variable name to token, the JSON path expression to $.access_token, match number 1 and a default like TOKEN_NOT_FOUND so failures are visible. Then add an HTTP Header Manager at Thread Group level with Authorization set to Bearer ${token}. Each thread extracts and uses its own token, because JMeter variables are per thread.
03
Why is JSR223 with Groovy preferred over BeanShell in JMeter?
JSR223 elements with Groovy compile scripts once and cache them, so they run much faster and use less CPU under load. BeanShell is interpreted on every call and becomes a bottleneck at high thread counts. Groovy also supports modern Java syntax and is the default JSR223 language. Enable caching by keeping the cache compiled script option on and passing values through vars or parameters, not by embedding ${} inside the script.
04
Your helper catches Exception and prints the stack trace, and tests pass even when steps fail. What is the issue?
Swallowing exceptions hides failures, so TestNG never sees an error and marks the test passed. Catch only specific exceptions you can handle, add context and rethrow, or let them propagate. If you need logging, log and then throw. Code reviews should flag empty catch blocks and broad catch (Exception e) in test code.
05
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.
06
Write a DataProvider that supplies two sets of login data and a test that uses it.
First remove or disable GUI listeners like View Results Tree and run in non-GUI mode. Save results in CSV format with only needed fields instead of XML with response data. Increase heap through the HEAP environment variable, such as -Xms2g -Xmx4g, within the machine's RAM. Use Groovy instead of BeanShell, avoid huge regex extractions, and if one machine still cannot generate the load, distribute it across several workers.
Check whether drivers are always quit, ThreadLocal values are removed, and static lists or maps keep growing, such as collecting screenshots or response objects. Enable heap dumps with -XX:+HeapDumpOnOutOfMemoryError and analyse with a tool like VisualVM or Eclipse MAT to see which objects hold memory. Fix the leak and tune Surefire's forked JVM memory with argLine if needed.
10
What is the difference between parallel="methods", "classes" and "tests" in testng.xml?
methods runs each @Test method in its own thread, giving the most parallelism but requiring fully independent tests and thread-safe drivers. classes runs all methods of one class in the same thread, with different classes in parallel. tests runs each <test> tag in parallel, often used to run different browsers. instances is also available for factory instances. thread-count sets the pool size.
Use multipart: given().multiPart("file", new File("src/test/resources/report.pdf"), "application/pdf").formParam("type", "invoice").when().post("/upload").then().statusCode(200). REST Assured sets the multipart/form-data content type automatically. Verify both the status and the response, such as the returned file id or size, and test edge cases like empty, oversized and wrong-type files.
12
Tell me about a time a BDD conversation clarified a requirement before development started.
Situation: a story said users get a refund if an order is cancelled early. Task: write scenarios with the product owner and developer. Action: while writing examples I asked what early meant and whether shipped orders counted. The three of us found the story had no time limit and no rule for partial shipments, and we wrote four concrete scenarios. Result: the rules were fixed before coding, avoiding a rework that had happened in a previous sprint.
13
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.
14
What is the difference between ThreadLocal and a synchronized block in Java?
A synchronized block lets only one thread at a time run a piece of code that touches shared data, so threads wait for each other. ThreadLocal avoids sharing altogether by giving each thread its own copy of a variable. In parallel test frameworks ThreadLocal<WebDriver> is preferred because each thread needs its own browser, and locking would serialise tests. Always call remove() after quitting to avoid leaks in thread pools.
15
Should every test in a project be written in Cucumber?
No. Cucumber adds a translation layer, so it is worth it for business-facing acceptance tests that stakeholders discuss. Unit tests, low-level API checks, data validations and technical edge cases are faster to write and maintain directly in TestNG or JUnit. A healthy project uses Cucumber for a focused set of key behaviours and plain code tests for everything else.
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.
19
What is the difference between the normal, eager and none page load strategies in Selenium?
Page load strategy decides when navigation commands like get() return. Normal, the default, waits for the full load event including images and stylesheets. Eager returns when the DOM is ready (DOMContentLoaded), which speeds up heavy pages. None returns immediately after the initial response. With eager or none you must rely on explicit waits for the elements you need. Set it through options.setPageLoadStrategy(PageLoadStrategy.EAGER).
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.
22
What is the difference between git merge and git rebase?
Merge combines branches by creating a merge commit, keeping the full history exactly as it happened. Rebase replays your commits on top of another branch, producing a straight, linear history without a merge commit. Rebase is good for tidying a local feature branch before a pull request; never rebase commits that others have already pulled, because it rewrites history.
23
How do you handle dynamic elements whose ids change?
Situation: an API test kept failing intermittently and developers called it a test issue. Task: prove or disprove it. Action: I collected logs from ten failures, showed the same race condition in the order service with request IDs, and reproduced it with a small parallel script. Result: developers fixed a real concurrency bug before it reached customers, and trust in the suite improved.
26
How do you handle a test that is flaky only in headless mode?
Situation: requirements were often misread, causing rework late in sprints. Task: I proposed BDD for one module. Action: I ran short three-amigos sessions, wrote example scenarios with the BA, automated them with Cucumber and showed them in sprint review. Result: rework on that module dropped noticeably over two sprints, and the team adopted the practice for other complex stories.
28
Mobile tests pass on the emulator but fail on a low-end real device. How do you investigate?
Low-end devices are slower, so fixed waits and short timeouts expire before screens render. Replace sleeps with explicit waits and increase timeouts sensibly. Check for vendor-specific pop-ups, battery optimisation dialogs or different keyboards on that brand. Compare screen size and resolution, since coordinate-based taps break. Collect device logs with adb logcat and screen recordings to see what the app was doing. Also check whether the app crashed due to low memory.
29
Why is XPath slow in Appium and what should you use instead?
For every XPath query Appium must fetch the full page source of the app, convert it into an XML document and then evaluate the expression, which can take seconds on large screens and is even slower on iOS. Index-based XPath also breaks when layouts change. Use accessibility id first, then resource-id, Android UiAutomator selectors or iOS predicate strings and class chains, which are evaluated natively on the device and are much faster.
30
What are TestNG and JUnit 5 differences that matter in automation?
TestNG has built-in groups, dependencies, suite XML, DataProvider and flexible parallel options, which suit large Selenium suites. JUnit 5 has a modular platform, tags, parameterized tests, extensions and strong IDE and tool support, and is the default for Spring and Cucumber's JUnit Platform engine. Both are capable; the choice usually follows team standards and existing frameworks.
31
File upload tests pass locally but fail when they run on a remote Grid. Why?
sendKeys with a file path sends a path that exists on your test machine, but the browser runs on the remote node where that path does not exist. Set a LocalFileDetector on the RemoteWebDriver, using ((RemoteWebDriver) driver).setFileDetector(new LocalFileDetector()), so Selenium zips and transfers the file to the node first. Alternatively mount the test data folder into the node container. Always use absolute paths.
32
What is the scope of a step definition class instance in Cucumber?
Cucumber creates a new instance of every glue class for each scenario. Instance fields therefore reset between scenarios, which keeps scenarios isolated. This is why you should not rely on static variables for state: they survive across scenarios and threads, causing order-dependent failures and clashes in parallel runs. Share state through injected context objects instead.
33
Tell me about a time a CI pipeline you owned broke right before a release.
Situation: the night before release, every UI test failed in Jenkins. Task: find the cause fast and unblock the release. Action: I checked the console and saw a browser and driver version mismatch after an agent update, pinned the browser image version, reran the suite and shared a short note. Result: the release went out on time and we added image version pinning to the pipeline.
Rule, added in Gherkin 6, groups scenarios that illustrate one business rule inside a feature. For example, a Feature: Discounts can have Rule: Orders above 1000 get free delivery, followed by scenarios showing the rule holding and not holding. Each Rule can have its own Background. It makes feature files read like a specification of rules with examples, which helps business stakeholders see exactly what each scenario proves.
35
What are Cucumber Expressions and how do they differ from regular expressions?
Cucumber Expressions are the default, simpler way to match steps, using parameter types like {int}, {string}, {word} and {float}. For example "I add {int} items" captures a number and converts it to an Integer automatically. Regular expressions are still supported and offer more control, but are harder to read. Teams usually prefer Cucumber Expressions and define custom parameter types for domain values.
36
What is the difference between git fetch and git pull?
git fetch downloads new commits and branches from the remote but does not change your working files; you can inspect them with git log origin/main. git pull is fetch followed by merge (or rebase if configured) into your current branch. Fetch is safer when you want to review changes before integrating them.
37
How do you pass thread count and duration to a JMeter test from the command line?
// In the Thread Group fields use property functions with defaults
Number of Threads: ${__P(users,10)}
Ramp-up period: ${__P(rampup,30)}
Duration (seconds): ${__P(duration,300)}
// Then override them when running
jmeter -n -t load.jmx -l out.jtl -Jusers=200 -Jrampup=120 -Jduration=1800
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.
git cherry-pick <commit> applies the changes of one specific commit onto your current branch, creating a new commit. It is useful when a fix on one branch, such as a locator fix on develop, is urgently needed on a release branch without merging everything else. Overuse creates duplicate commits and confusing history, so prefer normal merges when possible.
Tips to crack the McKinsey & Company Automation Testing interview
Practise structured case interviews out loud, focusing on breaking problems into clear parts and doing quick mental arithmetic accurately.
Prepare detailed personal stories on leadership, impact and handling conflict, since McKinsey asks probing follow-up questions on each story.
For analytics roles, revise SQL, Python and statistics along with case skills, because both are often tested together.
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; McKinsey & Company interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the McKinsey & Company Automation Testing interview?
Candidates usually go through 4 stages: Online problem-solving assessment or game-based test; Case interview round 1; Case interview round 2 with personal experience questions; Final partner 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 McKinsey & Company Automation Testing interview?
This practice set leans on Cucumber and BDD (6), Selenium WebDriver (6), Core Java for Testers (5), Git, Maven and Jenkins (5). Revise those first, then practise explaining one or two of your own projects end to end, because most McKinsey & Company interviewers ask you to walk through real work.
Are these the exact questions asked at McKinsey & Company?
No. These are curated practice questions that match the skills and difficulty usually tested in consulting interviews like McKinsey & Company's. They are not a leaked or verified list of past questions.
Where does McKinsey & Company hire Automation Testing professionals in India?
McKinsey & Company has large teams in Gurugram, Mumbai, Bengaluru, Chennai. Openings and locations change often, so check the McKinsey & Company careers page and filter by city and experience.
Automation Testing questions for similar companies