Cognizant
10+ Tesco Interview Questions and Answers
Q1. What actions would you take if there is a mismatch between user stories and application functionality?
I would analyze the user stories and application functionality to identify the root cause of the mismatch and work towards resolving it.
Review the user stories and application functionality to understand the discrepancies
Communicate with stakeholders to clarify requirements and expectations
Update test cases and automation scripts to align with the corrected user stories
Collaborate with developers to address any underlying issues causing the mismatch
Q2. What approach can be used to count the number of URLs in an HTML page using Selenium and open the URL that contains your name?
To count URLs in an HTML page using Selenium and open the URL containing your name, you can use a combination of Selenium WebDriver methods and regular expressions.
Use Selenium WebDriver to navigate to the HTML page and retrieve its source code
Use regular expressions to identify and count the URLs in the source code
Iterate through the list of URLs to find the one containing your name
Use Selenium WebDriver to open the URL containing your name
Q3. How can you separate letters and digits from a string in Java? Please provide the Java code for this task.
Use regular expressions to separate letters and digits from a string in Java.
Use the String class's split() method with a regular expression to separate letters and digits.
Create a regular expression pattern that matches either letters or digits.
Store the separated letters and digits in separate arrays.
Q4. Can you provide a specific scenario from your previous project, and detail the feature file step definitions while demonstrating how to run the scenario with different sets of data?
Demonstrating feature file step definitions with different sets of data in a previous project scenario
Create a feature file with a scenario outline that includes placeholders for different sets of data
Write step definitions that use the placeholders to run the scenario with different data sets
Use data tables or examples in the feature file to provide the different sets of data
Run the scenario with different data sets to ensure the automation test is working correctly
Q5. What are the different types of assertions, and what is the syntax for a hard assertion in TestNG?
Different types of assertions and syntax for hard assertion in TestNG
Types of assertions: Hard assertions and Soft assertions
Syntax for hard assertion in TestNG: Assert.assertEquals(expected, actual)
Q6. What is the difference between List, Set, and Map collections in Java?
List, Set, and Map are different types of collections in Java used to store and manipulate groups of objects.
List is an ordered collection that allows duplicate elements. Example: ArrayList, LinkedList
Set is a collection that does not allow duplicate elements. Example: HashSet, TreeSet
Map is a collection of key-value pairs where each key is unique. Example: HashMap, TreeMap
Q7. What is the syntax for using driver.findElement in Selenium?
The syntax for using driver.findElement in Selenium is driver.findElement(By locator)
Use driver.findElement(By locator) to locate a single element on the web page
Specify the locator strategy (e.g. By.id, By.name, By.xpath) to identify the element
Example: WebElement element = driver.findElement(By.id("username"));
Q8. What types of wait mechanisms are utilized in your project?
Types of wait mechanisms include implicit wait, explicit wait, fluent wait, and thread.sleep.
Implicit wait: Waits for a certain amount of time before throwing a NoSuchElementException.
Explicit wait: Waits for a certain condition to occur before proceeding further.
Fluent wait: Waits for a condition to be true with a specified polling frequency.
Thread.sleep: Pauses the execution for a specified amount of time.
Q9. How do you remove duplicates from an array?
Use a Set data structure to remove duplicates from an array of strings.
Create a Set from the array to automatically remove duplicates
Convert the Set back to an array to get the unique values
Q10. How do you manage frames in Selenium?
Frames in Selenium can be managed using switchTo() method to navigate between frames.
Use driver.switchTo().frame() method to switch to a frame by index, name or WebElement
Use driver.switchTo().defaultContent() method to switch back to the main content
Use driver.switchTo().parentFrame() method to switch to the parent frame
Q11. tell about automation framework
An automation framework is a set of guidelines, rules, and tools that help in creating and executing automated tests.
Automation frameworks provide structure and organization to automated tests
They help in reducing maintenance efforts by promoting reusability of code
Frameworks can be data-driven, keyword-driven, or hybrid in nature
Examples of popular automation frameworks include Selenium, TestNG, and Cucumber
More about working at Cognizant
Interview Process at Tesco
Top Senior Automation Test Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month