Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About Affine hiring for Automation Testing roles
Affine is a Bengaluru-based analytics and AI consulting company that helps businesses in gaming, media, retail, consumer goods and technology use data science for decisions. Its teams build predictive models, marketing analytics, pricing solutions and data engineering pipelines. It hires business analysts, data scientists, data engineers and analytics consultants who combine technical skills with business understanding.
For Automation Testing roles, this Affine practice set focuses most on Selenium WebDriver (7), Selenium Grid & Docker (6), TestNG Framework (5), Page Object Model (5). It has 4 easy, 31 medium, 5 hard questions, so you can start easy and work up to the harder ones.
Company type
Analytics
Headquarters
Bengaluru, India
Main India offices
Bengaluru
Affine Automation Testing interview process
Online assessment (aptitude + SQL + statistics)
Technical interview
Case study round
HR round
Typical pattern based on public candidate experiences. Rounds vary by role, team and year.
Solved for AffineStart 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 callback where one system sends an HTTP request to another when an event occurs. Test with a mock receiver or tools such as webhook.site and verify the payload.
05
How do you mock an external API in automation tests?
Use a tool such as WireMock or MockServer to run a stub server that returns predefined responses for given requests. Point the application or tests to the stub with configuration. This lets you test error codes, timeouts and edge cases that are hard to trigger on the real service, and keeps tests stable when the third party is down. Still keep a few tests against the real integration.
06
Your code review shows a test class with 30 copy-pasted lines in every method. How do you refactor it with Java features?
Extract repeated steps into private helper methods or a page object, move common setup into @BeforeMethod, and use a DataProvider when only data differs. If the repeated code differs only in a small action, pass that action as a lambda, such as a Consumer<WebDriver>. Rerun the tests after each small refactor to confirm behaviour is unchanged.
07
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.
08
Tell me about a time you had to explain a technical test failure to a non-technical manager.
Situation: a release was blocked by failing tests and the manager wanted to know if it was safe to ship. Task: explain the risk without jargon. Action: I separated the failures into one real bug, where customers could be charged twice, and three environment issues. I showed the bug with a short screen recording. Result: the manager delayed the release by one day, the bug was fixed and the environment issues were assigned to DevOps.
Compare effort saved by running automated tests repeatedly against the cost of building and maintaining scripts, counting execution time, defects found earlier and release speed.
Filters intercept requests and responses, similar to middleware. They implement the Filter interface and can add headers, refresh tokens, log traffic, or attach request and response details to Allure reports with AllureRestAssured. You add them with given().filter(myFilter) or globally in a RequestSpecification. Filters keep cross-cutting concerns out of individual tests.
Docker Compose runs a fixed number of nodes on one machine, which is simple but limited to that host's CPU and memory. On Kubernetes, typically installed with the Selenium Helm chart, nodes are pods spread across a cluster, and KEDA can scale node pods up based on the queue length and back to zero when idle. It suits large teams with bursty CI demand but needs cluster knowledge and monitoring.
13
How do you run Selenium tests in Docker containers in CI?
Use official Selenium images, either standalone-chrome for simple runs or a Grid with hub and node containers via Docker Compose. The test container or Jenkins agent points RemoteWebDriver to http://selenium-hub:4444. Containers give the same browser version everywhere and are cleaned after each run. Add shm_size for Chrome stability and record videos for failed tests if needed.
14
Write a BasePage helper that clicks an element after waiting for it to be clickable.
Inside a container, localhost means the container itself, not the host machine. On Docker Desktop use host.docker.internal as the host name. On Linux add extra_hosts with host.docker.internal:host-gateway, or use the host's IP. A cleaner option is running the application in the same Compose network and calling it by its service name, such as http://web:8080. Make sure the app listens on 0.0.0.0, not only 127.0.0.1.
16
What is the difference between hard and soft assertions?
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.
Send invalid or missing fields, wrong data types, values beyond limits, invalid IDs, expired or missing tokens, wrong HTTP methods and malformed JSON. Assert the correct status (400, 401, 403, 404, 405, 422) and a clear error body without stack traces. Negative tests often find more defects than happy paths because validation and security checks are frequently incomplete.
Standalone runs every Grid component and a local node in a single process, which suits a laptop or a single container. Hub and node mode runs the router, distributor, queue and session map together as the hub, with separate node processes registering to it, which is the usual team setup. Fully distributed mode runs each component separately, often on Kubernetes, for very large grids that need independent scaling and high availability.
21
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.
22
Write Appium code to scroll to an element by its text using UiScrollable on Android.
// Scrolls the first scrollable container until the text is visible
String selector = "new UiScrollable(new UiSelector().scrollable(true))"
+ ".scrollIntoView(new UiSelector().text(\"Order History\"))";
WebElement item = driver.findElement(AppiumBy.androidUIAutomator(selector));
item.click();
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.
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).
30
How do you check that the Grid is ready before starting the tests in CI?
Poll the Grid status endpoint, http://hub:4444/status, until the JSON field value.ready is true, which means at least one node has registered. In a shell step you can loop with curl and jq, for example until curl -s http://localhost:4444/status | jq -e '.value.ready'; do sleep 2; done, with an overall timeout. In Compose you can add a healthcheck on the hub. Without this, the first tests fail while nodes are still starting.
31
How do you handle a component that appears inside many different pages, like a modal dialog?
Create a ModalComponent class scoped to the modal root element, with methods like title(), confirm() and cancel(). Pages that open modals return the component, such as cartPage.removeItem() returning ConfirmModal. The component waits for itself to appear and disappear. This keeps modal logic in one place and avoids copying locators into every page.
32
Which locator strategies does Appium support and which should you prefer?
Appium supports accessibility id, id (resource-id on Android), class name, XPath, Android UiAutomator selectors, iOS predicate strings and iOS class chains. Prefer accessibility id because it is fast, works across Android and iOS and also improves app accessibility. Next use resource-id or iOS predicates. Use XPath only as a last resort because it walks the whole UI tree and is slow and brittle, especially on iOS.
Situation: a checkout test failed about one run in five and the team started ignoring red builds. Task: fix the root cause, not just rerun it. Action: I added logs and screenshots, found it raced with an async price recalculation, replaced a fixed sleep with a wait on the updated total and asked developers for a loading flag. Result: zero failures in the next sixty runs, and the team trusted red builds again.
35
Your UI tests run noticeably slower on the Grid than on your laptop. How do you find the cause?
Every command now travels over the network, so chatty code with many findElement calls or getText in loops suffers most. Check latency between test runner and Grid, ideally keeping them in the same network or region. Check node resources: overloaded CPU or many sessions per container slow browsers. Video recording and VNC add overhead. Reduce round trips by batching checks, using JavaScript for bulk reads and avoiding implicit waits combined with explicit ones.
36
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.
37
Tell me about a time you led the design of a test framework for a new project.
Situation: a new product had no automation and a three-month release target. Task: I was asked to set up the framework and guide two juniors. Action: I chose Java, TestNG, Selenium with POM and REST Assured, set up Maven, Jenkins and Allure, wrote conventions and reviewed every pull request early on. Result: we had 250 stable tests in CI before release, and the juniors could extend it independently.
38
How do you handle a test that is flaky only in headless mode?
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.
40
How do you avoid page object classes becoming too large?
Split pages into components for repeated or complex areas, keep only user actions as public methods, move generic helpers to BasePage or utilities, and avoid one method per element. If a page has distinct modes like view and edit, use separate classes. Review page classes during code review and refactor when they cross a few hundred lines.
Tips to crack the Affine Automation Testing interview
Practise SQL and Python data manipulation, and be ready to solve a small analysis problem using a sample dataset.
Revise statistics concepts like distributions, sampling and A/B testing, and explain how they guide real business decisions.
Prepare for case questions on topics like customer churn or pricing, structuring your approach before jumping into models.
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; Affine interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the Affine Automation Testing interview?
Candidates usually go through 4 stages: Online assessment (aptitude + SQL + statistics); Technical interview; Case study round; 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 Affine Automation Testing interview?
This practice set leans on Selenium WebDriver (7), Selenium Grid & Docker (6), TestNG Framework (5), Page Object Model (5). Revise those first, then practise explaining one or two of your own projects end to end, because most Affine interviewers ask you to walk through real work.
Are these the exact questions asked at Affine?
No. These are curated practice questions that match the skills and difficulty usually tested in analytics interviews like Affine's. They are not a leaked or verified list of past questions.
Where does Affine hire Automation Testing professionals in India?
Affine has large teams in Bengaluru. Openings and locations change often, so check the Affine careers page and filter by city and experience.
Automation Testing questions for similar companies