Skip to content

Virtusa Automation Testing Interview Questions & Answers

Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.

About Virtusa hiring for Automation Testing roles

Virtusa is a digital engineering and IT services company providing application development, testing, cloud and data services. It has a strong client base in banking, financial services, healthcare and telecom. Its India centres in Hyderabad, Chennai and Bengaluru hire for software engineers, test engineers and data professionals.

For Automation Testing roles, this Virtusa practice set focuses most on Selenium WebDriver (8), TestNG Framework (5), REST Assured (5), Core Java for Testers (4). It has 19 easy, 19 medium, 2 hard questions, so you can start easy and work up to the harder ones.

Company type
IT services
Headquarters
Southborough, Massachusetts, USA
Main India offices
Hyderabad, Chennai, Bengaluru

Virtusa Automation Testing interview process

  1. Online assessment (aptitude + reasoning)
  2. Coding test
  3. Technical interview
  4. HR round

Typical pattern based on public candidate experiences. Rounds vary by role, team and year.

Solved for VirtusaStart 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.
3 questions free Unlock the rest in seconds
01

A teammate compares two strings with == and the test sometimes passes and sometimes fails. Explain.

Save to ▾
Show answer
== 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.
02

How do you share state between step definition classes in Cucumber Java?

Save to ▾
Show answer
Use dependency injection. With cucumber-picocontainer (or Spring/Guice), create a context class such as TestContext holding the driver, page objects and scenario data, and add it as a constructor parameter in every step class. Cucumber creates one instance per scenario and injects the same object everywhere, so state is shared within a scenario but never leaks between scenarios. Avoid static fields because they break parallel runs.
03

How do you handle a browser basic authentication pop-up in Selenium?

Save to ▾
Show answer
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.
04

What is the timeOut attribute in TestNG?

Save to ▾
Show answer
@Test(timeOut = 5000) fails the test if it runs longer than 5000 milliseconds. It can also be set at suite or test level in testng.xml. It protects pipelines from hanging tests, for example a stuck network call. It is not a performance test; use reasonable limits so slow but correct environments do not cause false failures.
05

What is Postman and how do you automate with it?

Save to ▾
Show answer
An API client. Add tests in JavaScript, use environments and collections, and run them with Newman in a CI pipeline.
06

How do you avoid page object classes becoming too large?

Save to ▾
Show answer
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.
07

Describe a time you received critical feedback on your test code.

Save to ▾
Show answer
Situation: in my first code review, a senior said my tests were hard to read and used Thread.sleep everywhere. Task: improve without getting defensive. Action: I asked for examples, replaced sleeps with explicit waits, extracted helpers and followed the team's naming conventions. Result: my next pull requests were approved faster, and I later used the same checklist to review a junior's code.
08

How do you group tests?

Save to ▾
Show answer
Tag tests with groups = {"smoke","regression"} and include or exclude them in testng.xml to run chosen sets.
09

How do you increase the number of Chrome nodes with Docker Compose?

Save to ▾
Show answer
Use the scale option: docker compose up -d --scale chrome=4 starts four Chrome node containers from the same service definition, and each registers with the hub. Do not fix container names or host ports on a scaled service, or the extra containers will clash. Check the Grid UI on port 4444 to confirm the slots. Make sure the host has enough CPU and memory, roughly one CPU core and 1 to 2 GB per browser.
10

Write Selenium code to verify that all links on a page are not broken.

Save to ▾
Show answer
List<WebElement> links = driver.findElements(By.tagName("a")); for (WebElement link : links) { String url = link.getAttribute("href"); if (url == null || !url.startsWith("http")) continue; HttpURLConnection con = (HttpURLConnection) new URL(url).openConnection(); con.setRequestMethod("HEAD"); int code = con.getResponseCode(); if (code >= 400) System.out.println("Broken: " + url + " " + code); }
11

How do you extract a value from one response and use it in the next request?

Save to ▾
Show answer
String token = given().body(creds).when().post("/login") .then().statusCode(200) .extract().path("token"); given() .header("Authorization", "Bearer " + token) .when() .get("/orders") .then() .statusCode(200);
12

How do you make WebDriver thread-safe for parallel runs?

Save to ▾
Show answer
Store each driver in a ThreadLocal so every thread gets its own instance and tests do not interfere.
13

How do you upload a file with REST Assured?

Save to ▾
Show answer
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.
14

What do HTTP status codes 200, 201, 400, 401, 403, 404 and 500 mean?

Save to ▾
Show answer
200 OK, 201 Created, 400 bad request, 401 unauthenticated, 403 forbidden, 404 not found and 500 server error.
15

What are filters in REST Assured?

Save to ▾
Show answer
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.
16

What is API testing and why is it done before UI testing?

Save to ▾
Show answer
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.
17

How do you test negative scenarios for an API?

Save to ▾
Show answer
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.
18

What are the main elements of a JMeter test plan?

Save to ▾
Show answer
A test plan contains Thread Groups that simulate users, Samplers such as HTTP Request that send requests, Config Elements like HTTP Request Defaults, CSV Data Set Config and Header Manager, Logic Controllers that control flow, Timers that add think time, Pre and Post Processors that prepare data or extract values, Assertions that validate responses, and Listeners that collect results. Elements apply according to their scope in the tree.
19

Business stakeholders never read your feature files. Is BDD still worth it?

Save to ▾
Show answer
Partly. Readable scenarios still help testers and developers, but if nobody discusses examples before coding, Cucumber is only an extra layer over normal tests. I would first try to restart three-amigos sessions for complex stories. If the business truly will not engage, I would keep Gherkin only for key business flows and write lower-level tests in plain TestNG to reduce maintenance.
20

How do you scroll a page in Selenium?

Save to ▾
Show answer
Use JavascriptExecutor with window.scrollTo or scrollIntoView, or the Actions class scroll methods in Selenium 4.
21

Write Java code to start an Android Appium session using UiAutomator2Options.

Save to ▾
Show answer
UiAutomator2Options options = new UiAutomator2Options() .setPlatformName("Android") .setAutomationName("UiAutomator2") .setDeviceName("Pixel_7_API_34") .setApp(System.getProperty("user.dir") + "/apps/shop.apk") .setAutoGrantPermissions(true) .setNewCommandTimeout(Duration.ofSeconds(120)); AndroidDriver driver = new AndroidDriver( new URL("http://127.0.0.1:4723"), options); driver.manage().timeouts().implicitlyWait(Duration.ZERO); // use explicit waits in tests driver.quit();
22

What is TestNG and why is it used with Selenium?

Save to ▾
Show answer
A test framework offering annotations, grouping, prioritisation, parallel runs, data providers and reports, which structure and scale Selenium tests.
23

How do you handle a website that uses CAPTCHA?

Save to ▾
Show answer
Do not automate it; ask for a test environment where CAPTCHA is disabled or use test keys, or a bypass token agreed with developers.
24

Write a simple page object class for a login page.

Save to ▾
Show answer
public class LoginPage { private final WebDriver driver; private final By user = By.id("username"); private final By pass = By.id("password"); private final By submit = By.cssSelector("button[type='submit']"); public LoginPage(WebDriver driver) { this.driver = driver; } public HomePage loginAs(String u, String p) { driver.findElement(user).sendKeys(u); driver.findElement(pass).sendKeys(p); driver.findElement(submit).click(); return new HomePage(driver); } }
25

What is the purpose of testng.xml?

Save to ▾
Show answer
A configuration file to define suites, tests, classes, groups, parameters and parallel execution settings.
26

What is a step definition in Cucumber?

Save to ▾
Show answer
A step definition is a Java method annotated with @Given, @When or @Then whose expression matches a Gherkin step. When Cucumber runs a feature, it finds the matching method and executes it, passing captured parameters as arguments. Keep step definitions thin: they should call page objects or API helpers rather than contain Selenium code directly, so the same steps stay reusable across many features.
27

How do you send form parameters and headers in REST Assured?

Save to ▾
Show answer
Use formParam("username", "asha") and formParam("password", "pass") for application/x-www-form-urlencoded bodies; REST Assured sets the content type for you. Add headers with header("X-Client", "web") or headers(map) for many at once. Cookies use cookie(name, value). Keep common headers in a RequestSpecification so individual tests only add what is specific to them.
28

What are relative locators in Selenium 4?

Save to ▾
Show answer
Locators such as above, below, toLeftOf and near that find elements by their position relative to another element.
29

How do you handle environment-specific configuration?

Save to ▾
Show answer
Keep URLs and credentials in per-environment config files or variables, choose with a command-line parameter and never hard-code secrets.
30

How do you store passwords and tokens safely in Jenkins?

Save to ▾
Show answer
Use the Jenkins Credentials store and bind them in the pipeline with withCredentials or the credentials() helper in environment blocks. Jenkins masks the values in console logs. Never hard-code secrets in the Jenkinsfile, pom.xml or properties files committed to Git. For larger setups, integrate a vault service and give each job only the credentials it needs.
31

How do you run tests in parallel?

Save to ▾
Show answer
Use TestNG parallel="methods | classes | tests" with thread-count, keep WebDriver in a ThreadLocal, and use Selenium Grid or a cloud grid for multiple browsers.
32

How do you pass thread count and duration to a JMeter test from the command line?

Save to ▾
Show answer
// 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
33

findElement vs findElements?

Save to ▾
Show answer
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.
34

Write the command to run a JMeter test in non-GUI mode and generate the HTML report.

Save to ▾
Show answer
# -n non-GUI, -t test plan, -l results file, -e -o HTML dashboard folder jmeter -n -t tests/checkout.jmx \ -l results/checkout.jtl \ -e -o results/html-report \ -Jusers=100 -Jrampup=60 -Jduration=600 # generate a report later from an existing JTL jmeter -g results/checkout.jtl -o results/html-report-2
35

What is parameterization in JMeter and how does CSV Data Set Config work?

Save to ▾
Show answer
Parameterization replaces hard-coded inputs with varied test data so users do not all log in as the same account or search the same item, which would give unrealistic cache hits. CSV Data Set Config reads a CSV file line by line and stores columns into variables like ${username} and ${password}. You set the file path, variable names, delimiter, whether to recycle at end of file and the sharing mode across threads.
36

How do you handle dropdowns in Selenium?

Save to ▾
Show answer
Use the Select class with selectByVisibleText, selectByValue or selectByIndex; for custom dropdowns click and choose from the list of elements.
37

What are the different types of waits in Selenium?

Save to ▾
Show answer
Implicit, explicit (WebDriverWait with ExpectedConditions) and fluent waits; avoid mixing implicit and explicit waits and never rely on Thread.sleep.
38

ArrayList vs HashMap — how do you use them in a framework?

Save to ▾
Show answer
ArrayList stores an ordered list (e.g. all product names on a page). HashMap stores key–value pairs (e.g. test data or config properties).
39

How do you run only selected scenarios using tags in Cucumber?

Save to ▾
Show answer
Add tags like @smoke or @regression above a Feature or Scenario, then filter with a tag expression. In the runner use @ConfigurationParameter(key = FILTER_TAGS_PROPERTY_NAME, value = "@smoke and not @wip") with the JUnit Platform engine, or pass -Dcucumber.filter.tags="@smoke" from Maven. Tag expressions support and, or, not and brackets, so CI can run smoke on every commit and regression nightly.
40

What are exceptions and how do you handle them?

Save to ▾
Show answer
Runtime events that disrupt flow. Use try-catch-finally, throw, throws, and custom exceptions; checked exceptions must be handled while unchecked ones need not be.

Tips to crack the Virtusa Automation Testing interview

  • Revise banking and healthcare domain basics, which are important industries in Virtusa's client portfolio.
  • Practise coding questions and SQL queries for both the online test and technical interview.
  • Learn about its engineering-first positioning and be ready to describe how you approach learning new tools.
  • 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; Virtusa interviewers usually ask follow-ups on your first answer.

Frequently asked questions

How many rounds are there in the Virtusa 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 Virtusa Automation Testing interview?

This practice set leans on Selenium WebDriver (8), TestNG Framework (5), REST Assured (5), Core Java for Testers (4). Revise those first, then practise explaining one or two of your own projects end to end, because most Virtusa interviewers ask you to walk through real work.

Are these the exact questions asked at Virtusa?

No. These are curated practice questions that match the skills and difficulty usually tested in it services interviews like Virtusa's. They are not a leaked or verified list of past questions.

Where does Virtusa hire Automation Testing professionals in India?

Virtusa has large teams in Hyderabad, Chennai, Bengaluru. Openings and locations change often, so check the Virtusa careers page and filter by city and experience.

Automation Testing questions for similar companies