Interview Prep
Testing & QA Tools Interview Questions
Unit, end-to-end, API and performance testing tools — the ones interviewers actually name and expect you to have used.
20 of 20 Testing & QA Tools questions shown. Answers are hidden by default — try each one before revealing it.
1.You write this Jest test for a function that fetches a user by id: test("fetches the right user", () => { fetchUser(1).then((user) => { expect(user.name).toBe("Alice"); }); }); fetchUser(1) actually resolves with { name: "Bob" }, so the assertion is false — but the test suite reports this test as passing. Why?
Mediumjestasyncpromisesunit-testing
2.Cypress runs your test code inside the same browser as the application under test, driving it directly through its own architecture, while Selenium sits outside the browser and drives it remotely through the WebDriver protocol. Which of the following is a direct, practical consequence of Cypress's architecture?
Mediumcypressseleniumtest-architecturee2e-testing
3.A pytest test module contains this fixture: @pytest.fixture(scope="module") def db_connection(): conn = create_connection() yield conn conn.close() Five test functions in that same module all take db_connection as an argument. How many times does create_connection() run, and when does conn.close() run?
Mediumpytestfixturestest-setuppython
4.A team wants to run its Postman collection of API tests automatically on every pull request, inside a CI pipeline that has no GUI. What is the standard way to do this?
Easypostmannewmanci-cdapi-testing
5.RestAssured tests are commonly written with the given().when().then() syntax, e.g. given().header(...).body(payload).when().post("/users").then().statusCode(201).body("id", notNullValue()). What is the main reason this fluent, Gherkin-style chain is used instead of building the request and assertions as separate, ordinary Java statements?
Mediumrestassuredjavaapi-testingbdd
6.In a JMeter Thread Group, you set Number of Threads (users) to 100 and Ramp-Up Period to 50 seconds, with the default loop count. What does JMeter actually do with these two numbers?
Mediumjmeterperformance-testingload-testing
7.The classic testing pyramid is drawn with a wide base of unit tests, a narrower band of integration tests, and a small tip of end-to-end (E2E) tests. Why that shape, rather than an even split across the three?
Easytesting-pyramidunit-testingintegration-testinge2e-testingtest-strategy
8.A function sendWelcomeEmail(user) calls an EmailClient dependency. In a unit test, EmailClient is replaced with a test double that returns a hardcoded 'queued' response so sendWelcomeEmail can keep running, and the test never checks whether or how the double was called — it only asserts on sendWelcomeEmail's own return value afterward. Which kind of test double is being used here?
Mediumtest-doublesmockingstubbingunit-testing
9.A test, 'processes queue in order', passes every time it's run alone or as part of its own file, but fails intermittently — roughly 1 run in 15 — when the full suite runs with multiple tests executing in parallel across worker processes. What's the most likely cause to investigate first?
Mediumflaky-teststest-isolationci-cdtest-reliability
10.A module has 100% line coverage from its unit tests — every line executes at least once across the test run. What does that actually guarantee?
Easytest-coveragetesting-metricsunit-testing
11.How would you approach this decision, and which tool would you lean toward given these requirements?
HardA team is starting a new web project: a React single-page app calling a REST API, with a login flow that redirects through a third-party SSO provider on a different domain before returning to the app. They also want to run the suite across Chromium, Firefox, and WebKit in CI, and eventually add basic mobile-web coverage. They're deciding between Cypress and Playwright for end-to-end testing.
cypressplaywrighttool-selectione2e-testing
12.In the context of unit testing — say with Jest, or Mocha paired with Chai and Sinon — explain the difference between a mock, a stub, and a spy. When would you reach for each?
Mediumjestmochachaisinontest-doublesmocking
13.What typically causes flaky tests in an automated UI test suite — for example, one built with Selenium or Cypress — and how would you go about fixing flakiness without just wrapping everything in retries?
Hardseleniumcypressjunittestngflaky-teststest-reliability
14.Postman, Insomnia, and RestAssured can all be used to test a REST API, but they fit different points in a team's workflow. Compare them and explain when you'd reach for each.
Mediumpostmaninsomniarestassuredapi-testingtooling
15.JMeter and k6 are both used for performance and load testing, but they're built very differently. Compare them: how are tests authored, how do they scale, and when would you pick one over the other?
Mediumjmeterk6performance-testingload-testingci-cd
16.You're asked to design a load test plan for an e-commerce checkout API before a big sale event. Walk through how you'd approach it: what you'd define up front, what scenarios you'd script, and how you'd decide pass/fail. (Assume the checkout flow is a sequence of REST calls: add-to-cart, apply-coupon, create-order, and charge-payment, backed by a database and a third-party payment gateway.)
Hardload-testingperformance-testingjmeterk6test-planning
17.Compare unit, integration, and end-to-end (E2E) tests: what does each one actually verify, what's a concrete example of each for a typical web application's checkout flow, and what kind of bug would each type catch that the others would miss?
Mediumtesting-pyramidunit-testingintegration-testinge2e-testingtest-strategy
18.Explain the difference between a mock, a stub, and a fake as types of test doubles. Give a concrete example of when you'd reach for each.
Mediumtest-doublesmockingstubbingunit-testing
19.What makes a test 'flaky,' and what are the most common root causes? Walk through concrete strategies for actually fixing a flaky test rather than just re-running it until it passes.
Mediumflaky-teststest-reliabilityci-cdtest-isolation
20.You're setting up automated testing in a CI/CD pipeline for a web application that has unit, integration, and E2E test suites. How would you structure the pipeline's stages, and what trade-offs would you make between fast feedback and thorough coverage?
HardAssume the app has a reasonably large unit test suite, a smaller integration suite that needs a real test database, and a handful of E2E scenarios that need a deployed or staging-like environment.
ci-cdtest-strategytesting-pyramidflaky-tests