
TCS


50+ TCS Automation Test Engineer Interview Questions and Answers
Q1. How to handle scrollbar and mouse activities Jenkins and Github Story Point in Agile Backlogs in Agile Jira workflow explain framework pom.xml wap number reverse program StellException Exception in Selenium dif...
read moreThe question is about handling scrollbar and mouse activities in automation testing.
To handle scrollbar, you can use methods like scrollIntoView(), scrollTo(), or Actions class in Selenium.
To handle mouse activities, you can use Actions class in Selenium to perform actions like click, double click, drag and drop, etc.
Jenkins is a popular continuous integration and delivery tool, while GitHub is a web-based version control system.
Story Point is a unit of measure used in Agile ...read more
Q2. 1) cucumber 2) Defects worked on, tell me about the bugs you found during testing 3) Functional Testing 4) Automation testing tools you worked on how you worked on in detail
Questions related to cucumber, defects found, functional and automation testing tools.
Cucumber is a BDD tool used for testing
Found defects related to UI, functionality, and performance
Functional testing involves testing the application's features and functionality
Worked on automation tools like Selenium, Appium, and TestNG
Used automation tools to create test scripts and execute them
Integrated automation scripts with CI/CD pipeline for continuous testing
Q3. Which java concepts have you used in your selenium script
I have used concepts like OOPs, Exception Handling, Collections, and Multithreading in my Selenium script.
Used OOPs concepts like inheritance and polymorphism to create reusable code
Implemented Exception Handling to handle unexpected errors and exceptions
Used Collections like ArrayList and HashMap to store and retrieve data
Implemented Multithreading to run tests in parallel for faster execution
Used WebDriver interface to interact with web elements and perform actions
Q4. Explain how cucumber is used with Selenium Java
Cucumber is used to write and execute automated acceptance tests in Selenium Java.
Cucumber allows for writing test scenarios in plain English using Gherkin syntax
These scenarios are mapped to step definitions in Java code
Selenium Java is used to interact with the web application being tested
Cucumber and Selenium Java are integrated using a test runner such as JUnit or TestNG
Q5. Which javascript commands have you used in selenium
I have used various javascript commands in Selenium such as executeScript, executeAsyncScript, etc.
executeScript() method is used to execute JavaScript code in the context of the currently selected frame or window.
executeAsyncScript() method is used to execute asynchronous JavaScript code in the context of the currently selected frame or window.
Other commonly used JavaScript commands in Selenium include getElementById(), getElementsByClassName(), etc.
Q6. What are all the exceptions that you know in selenium and define real time exam which situation does exception occur?
Some exceptions in Selenium are NoSuchElementException, TimeoutException, StaleElementReferenceException.
NoSuchElementException occurs when an element is not found in the DOM.
TimeoutException occurs when a command takes longer than the timeout value to complete.
StaleElementReferenceException occurs when a referenced element is no longer attached to the DOM.
Q7. What do you know about TestNG and Cucumber
TestNG is a testing framework for Java while Cucumber is a BDD tool for behavior-driven development.
TestNG is used for unit, functional, and integration testing
Cucumber is used for acceptance testing and supports BDD
TestNG uses annotations to define test methods and groups
Cucumber uses Gherkin syntax to define scenarios and steps
TestNG generates HTML reports while Cucumber generates reports in various formats
TestNG supports parallel testing while Cucumber does not
TestNG can b...read more
Q8. Write piece of selenium code on how to handle sub menu from hamburger button?
To handle sub menu from hamburger button in Selenium, locate the hamburger button, click on it, and then locate and click on the desired sub menu option.
Locate the hamburger button element using appropriate locator strategy
Click on the hamburger button to open the menu
Locate the sub menu option using appropriate locator strategy
Click on the sub menu option to perform the desired action
Q9. What is method overloading and method overriding, write piece of code to explain?
Method overloading is when multiple methods have the same name but different parameters. Method overriding is when a subclass provides a different implementation of a method from its superclass.
Method overloading is achieved by having multiple methods with the same name but different parameters.
Method overriding is achieved by having a subclass provide a different implementation of a method from its superclass.
Method overloading is determined at compile-time based on the numb...read more
Q10. Difference between method overloading and overriding
Method overloading is having multiple methods with the same name but different parameters. Method overriding is having a method in child class with the same name and signature as in parent class.
Method overloading is compile-time polymorphism while method overriding is runtime polymorphism.
Method overloading is achieved within the same class while method overriding is achieved in different classes, usually in a parent-child relationship.
Method overloading is used to provide d...read more
Q11. How do you handle test data privacy and security in your automation tests?
Test data privacy and security is ensured by using anonymized data, encryption, access controls, and secure storage.
Anonymize sensitive data by replacing real values with fake ones
Encrypt test data during transmission and storage
Implement access controls to restrict who can view or modify test data
Store test data securely using encryption and regular backups
Q12. What are test hooks, and how do they impact automation test execution?
Test hooks are methods or functions that allow testers to access internal code for testing purposes.
Test hooks are used to inject test code into the application being tested.
They can be used to monitor and manipulate the behavior of the application during testing.
Test hooks can be implemented using tools like Selenium or TestNG.
They impact automation test execution by providing access to internal components for testing.
Q13. What is Behavior-Driven Development (BDD), and how does it relate to automation testing?
BDD is a software development approach that encourages collaboration between developers, QA, and non-technical stakeholders to define and test system behavior.
BDD focuses on defining the behavior of a system through examples in plain text
It uses a common language (like Gherkin syntax) to describe features and scenarios
Automation testing in BDD involves writing automated tests that validate the behavior described in the scenarios
Tools like Cucumber and SpecFlow are commonly us...read more
Q14. What are some emerging trends in automation testing, and how do you stay updated with them?
Emerging trends in automation testing include AI and machine learning, shift-left testing, and continuous testing.
AI and machine learning are being used to improve test automation by predicting test cases, identifying patterns, and optimizing test execution.
Shift-left testing involves testing early in the development cycle to catch defects sooner and reduce costs.
Continuous testing integrates automated tests throughout the software delivery pipeline to provide immediate feedb...read more
Q15. How do you ensure test data consistency across different test environments?
By using data management tools, version control, data masking techniques, and automated scripts.
Utilize data management tools to create and maintain consistent test data sets across environments.
Implement version control to track changes made to test data and ensure consistency.
Apply data masking techniques to protect sensitive information while maintaining consistency.
Use automated scripts to generate and populate test data in different environments.
Regularly synchronize tes...read more
Q16. Can you explain Continuous Testing and its role in the CI/CD pipeline?
Continuous Testing is the practice of running automated tests throughout the software delivery pipeline to provide immediate feedback on the quality of the code.
Continuous Testing helps in identifying issues early in the development cycle, leading to faster feedback and quicker resolution of defects.
It ensures that the code changes made by developers do not break existing functionality by running automated tests continuously.
Continuous Testing plays a crucial role in the CI/C...read more
Q17. Difference between abstract class and interface
Abstract class is a class with partial implementation while interface is a contract with no implementation.
Abstract class can have both abstract and non-abstract methods while interface can only have abstract methods.
A class can implement multiple interfaces but can only inherit from one abstract class.
Abstract class can have constructors while interface cannot.
Abstract class can have access modifiers while interface methods are public by default.
Q18. Explain different Kinds of Testing.
Different kinds of testing include unit testing, integration testing, system testing, acceptance testing, and regression testing.
Unit testing: testing individual units or components of the software
Integration testing: testing how different units or components work together
System testing: testing the entire system as a whole
Acceptance testing: testing to ensure the software meets the requirements and is ready for release
Regression testing: testing to ensure that changes or upd...read more
Q19. what is the TestNG tool and when we are using this tool to test
TestNG is a testing framework designed for unit testing and integration testing in Java.
TestNG is used for writing and running tests in Java programming language.
It supports annotations like @Test, @BeforeMethod, @AfterMethod for test configuration.
TestNG allows grouping of test cases, prioritizing tests, and parallel execution.
It generates detailed test reports and supports data-driven testing.
TestNG can be integrated with build tools like Maven and Jenkins for continuous in...read more
Q20. Explains Software Testing Life Cycle
Software Testing Life Cycle (STLC) is a process followed to ensure quality in software testing.
STLC involves planning, designing, executing, and reporting phases.
It starts with requirement analysis and ends with post-release testing.
STLC includes test planning, test case development, test execution, and defect reporting.
It ensures that the software meets the specified requirements and is free from defects.
STLC is an iterative process that involves continuous improvement.
Examp...read more
Q21. Write a program to check if a string is a Palindrome.
Program to check if a string is a Palindrome
Create a function that takes a string as input
Remove all non-alphanumeric characters and convert to lowercase
Compare the string with its reverse to check if it's a palindrome
Q22. Explain Different Git commands
Git commands are used for version control. Some common commands are add, commit, push, pull, clone, and branch.
git add
- adds a file to the staging area git commit -m 'message' - commits changes with a message
git push - pushes changes to a remote repository
git pull - pulls changes from a remote repository
git clone
- clones a remote repository to a local directory git branch - lists all branches in the repository
Q23. Write a Java program to find the first duplicate element in an array.
Java program to find the first duplicate element in an array of strings.
Create a HashSet to store unique elements as you iterate through the array.
If an element is already in the HashSet, it is a duplicate and can be returned.
Use a for loop to iterate through the array and check for duplicates.
Q24. Write a Java program to find the largest element in an array.
Java program to find the largest element in an array
Create a method that takes an array of strings as input
Initialize a variable to store the largest element, starting with the first element
Iterate through the array and compare each element with the current largest element
Update the largest element if a larger element is found
Return the largest element
Q25. Explain your experience with Selenium and describe a complex test scenario you automated using it.
I have extensive experience with Selenium, including automating complex test scenarios.
Utilized Selenium WebDriver to automate end-to-end testing of a web application
Implemented data-driven testing using Selenium with Excel or CSV files
Integrated Selenium with TestNG for parallel test execution and reporting
Automated complex scenarios like multi-step user workflows or cross-browser testing
Used Page Object Model design pattern for maintainable and scalable test automation
Q26. write java program to print sum of digits from a given string eg: "abcd23"
Java program to print sum of digits from a given string
Iterate through each character in the string
Check if the character is a digit using Character.isDigit() method
Convert the digit character to integer using Character.getNumericValue() method
Sum up all the digits found in the string
Q27. Java program to print the sum of elements in string array eg: String[] arr = {"1","2","3"}
Java program to print the sum of elements in a string array.
Convert each element in the string array to an integer using Integer.parseInt()
Sum up all the integers to get the total sum
Q28. Difference between soft and hard assert
Soft assert allows the test to continue even if an assertion fails, while hard assert stops the test immediately.
Soft assert is used when we want to check multiple assertions in a single test case.
Hard assert is used when we want to stop the test execution immediately after the first assertion failure.
Soft assert is also known as verification.
Hard assert is also known as assertion.
Example of soft assert: Assert.assertTrue(condition1); Assert.assertTrue(condition2);
Example of ...read more
Q29. Explain where you have used OOPs concept in framework
OOPs concepts are used in the framework for better code organization, reusability, and maintainability.
Encapsulation: Used to hide the internal details of classes and provide access through methods.
Inheritance: Used to create a hierarchy of classes, allowing the reuse of code and promoting code extensibility.
Polymorphism: Used to define multiple methods with the same name but different implementations, improving code flexibility.
Abstraction: Used to define abstract classes an...read more
Q30. Explain oops concepts used in your framework with example?
OOPs concepts used in the framework include inheritance, polymorphism, encapsulation, and abstraction.
Inheritance is used to create a parent-child relationship between classes. For example, a base class 'Page' can be inherited by 'HomePage' and 'LoginPage' classes.
Polymorphism allows objects of different classes to be treated as objects of a common superclass. For instance, a 'click' method can be implemented differently in 'Button' and 'Link' classes.
Encapsulation involves b...read more
Q31. What is collection in java
Collection in Java is a framework that provides an architecture to store and manipulate a group of objects.
Collection is an interface that extends Iterable interface
It is used to represent a group of individual objects as a single entity
Examples of collections are List, Set, Queue, etc.
Collections framework provides algorithms to manipulate collections
Collections can store objects of any type, including user-defined classes
Q32. Explain Object-Oriented Programming (OOP) concepts with examples.
OOP is a programming paradigm based on the concept of objects, which can contain data in the form of fields and code in the form of procedures.
OOP focuses on creating objects that interact with each other to solve a problem.
Encapsulation: Objects can hide their internal state and require interaction through defined interfaces. Example: Class Car with private variables like speed and methods like accelerate.
Inheritance: Objects can inherit attributes and behaviors from parent ...read more
Q33. Write a program to swap two numbers without using temp.
Swapping two numbers without using a temporary variable in a program.
Use bitwise XOR operation to swap two numbers without using a temporary variable.
Example: int a = 5, b = 10; a = a ^ b; b = a ^ b; a = a ^ b; // Now a = 10, b = 5
Q34. Briefly explain about different types of testing techniques.
Different types of testing techniques include black box testing, white box testing, unit testing, integration testing, system testing, regression testing, and performance testing.
Black box testing focuses on the functionality of the software without looking at its internal code.
White box testing involves testing the internal code structure, paths, and logic.
Unit testing involves testing individual units or components of the software.
Integration testing checks if different mod...read more
Q35. When we are using the automation testing
Automation testing is the use of software to execute tests and compare actual outcomes with expected outcomes.
Automation testing helps in reducing human errors and increasing test coverage.
It is useful for repetitive test cases, regression testing, and load testing.
Tools like Selenium, Appium, and JUnit are commonly used for automation testing.
Automation testing can be used for web applications, mobile applications, and APIs.
Q36. Describe oops concept
OOPs is a programming paradigm based on the concept of objects that interact with each other to perform tasks.
OOPs stands for Object-Oriented Programming System
It focuses on creating reusable code and reducing complexity
It includes concepts like inheritance, encapsulation, polymorphism, and abstraction
Inheritance allows a class to inherit properties and methods from another class
Encapsulation is the process of hiding data and methods within a class
Polymorphism allows objects ...read more
Q37. Method to read and write to Excel?
To read and write to Excel, we can use libraries like Apache POI or Openpyxl.
Use Apache POI library in Java to read and write Excel files.
Use Openpyxl library in Python to read and write Excel files.
For reading, open the Excel file, select the sheet, and iterate through rows and columns to retrieve data.
For writing, create a new Excel file or open an existing one, select the sheet, and write data to specific cells.
Q38. Bug life cycle and how you report to dev
Bug life cycle and reporting process to developers
Bug life cycle includes stages like identification, reporting, analysis, fixing, retesting, and closure
To report a bug to developers, use a bug tracking tool or system
Provide detailed information about the bug, including steps to reproduce, expected and actual results, and any relevant screenshots or logs
Assign the bug to the appropriate developer and prioritize it based on severity and impact
Communicate with the developer to ...read more
Q39. What is Expected CTC?
The expected CTC (Cost to Company) is the salary package that the candidate anticipates or desires for the Automation Test Engineer role.
The expected CTC is the total compensation package including salary, bonuses, benefits, and any other perks.
It is important to research the industry standards and salary ranges for Automation Test Engineers in order to provide a realistic and competitive expected CTC.
Consider factors such as experience, skills, location, and company size whe...read more
Q40. Difference between find element and elements
find element is used to locate a single element on a web page, while elements is used to locate multiple elements.
find element is used with a locator to find a single element on a web page
elements is used to find multiple elements that match the locator
find element returns a single WebElement object, while elements returns a list of WebElement objects
Q41. What is abstract class
Abstract class is a class that cannot be instantiated and may contain abstract methods.
Cannot be instantiated directly
May contain abstract methods that must be implemented by subclasses
Can have both abstract and non-abstract methods
Used for defining a common interface for subclasses
Q42. Code to reverse a string?
Code to reverse a string
Use a loop to iterate through the characters of the string
Initialize an empty string to store the reversed string
Start from the last character and append each character to the new string
Return the reversed string
Q43. What is 'This' in java
In Java, 'this' is a keyword that refers to the current object within a method or constructor.
Used to differentiate between instance variables and local variables with the same name
Can be used to invoke current class constructor
Can be passed as an argument in a method call
Q44. Absolute and relative xpath difference
Absolute xpath starts from the root node, while relative xpath starts from any node in the DOM.
Absolute xpath starts with a single forward slash (/) and is more brittle as any changes in the DOM structure can break the xpath.
Relative xpath starts with a double forward slash (//) and is more flexible as it can start from any node in the DOM.
Absolute xpath is longer and less readable compared to relative xpath.
Example: Absolute xpath - /html/body/div[1]/form/input[1], Relative ...read more
Q45. what is BDD framework
BDD framework stands for Behavior Driven Development framework, used for writing test cases in plain language.
BDD framework focuses on the behavior of the system from the end user's perspective.
It uses natural language constructs to describe the behavior of the system.
Tools like Cucumber, SpecFlow, and JBehave are commonly used for implementing BDD frameworks.
BDD frameworks help in improving collaboration between developers, testers, and business stakeholders.
Q46. What is Interface
An interface in programming defines a contract for classes to implement, specifying methods and properties that must be included.
Interfaces in programming are used to define a set of methods that a class must implement.
They provide a way to achieve abstraction and multiple inheritance in languages that do not support it.
Interfaces are like blueprints for classes, ensuring consistency and standardization in code.
Example: In Java, an interface can be used to define methods that...read more
Q47. Code for palindrome?
A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward.
Convert the input string to lowercase
Remove any non-alphanumeric characters from the string
Reverse the string
Compare the reversed string with the original string
Q48. java program on arrays
Java program on arrays to manipulate array of strings
Declare an array of strings
Initialize the array with values
Access and manipulate elements in the array
Q49. How hash map works
Hash map is a data structure that stores key-value pairs and allows for fast retrieval of values based on keys.
Hash map uses a hash function to map keys to indexes in an array.
Collisions can occur when multiple keys hash to the same index, which can be resolved using techniques like chaining or open addressing.
Hash maps have O(1) average time complexity for insertion, deletion, and lookup operations.
Q50. explain polymorphism
Polymorphism is the ability of a single function or method to operate on different types of data.
Polymorphism allows objects of different classes to be treated as objects of a common superclass.
There are two types of polymorphism: compile-time (method overloading) and runtime (method overriding).
Example of compile-time polymorphism: function overloading in Java.
Example of runtime polymorphism: method overriding in Java.
Q51. Types of Locators
Locators are used in automation testing to identify web elements on a webpage. Common types include ID, class name, name, xpath, and CSS selector.
ID: Unique identifier for an element
Class name: Name of the class attribute of an element
Name: Name attribute of an element
XPath: Path of the element in the HTML structure
CSS selector: Selector based on CSS attributes
Q52. Different exceptions
Different exceptions in automation testing
Common exceptions include NoSuchElementException, TimeoutException, StaleElementReferenceException
Handle exceptions using try-catch blocks to gracefully handle errors
Custom exceptions can be created for specific scenarios
Exceptions can be logged for debugging purposes
Q53. Explain Oops concept
Oops concept stands for Object-Oriented Programming. It is a programming paradigm based on the concept of objects.
Oops concept involves the use of classes and objects.
It focuses on encapsulation, inheritance, polymorphism, and abstraction.
Encapsulation is the bundling of data with the methods that operate on that data.
Inheritance allows a class to inherit properties and behavior from another class.
Polymorphism allows objects to be treated as instances of their parent class.
Ab...read more
Q54. Streams in java
Streams in Java provide a way to process collections of objects in a functional style.
Streams are sequences of elements supporting sequential and parallel aggregate operations.
They can be created from various sources like collections, arrays, or I/O resources.
Common operations on streams include map, filter, reduce, and collect.
Streams are lazy, meaning intermediate operations are only executed when a terminal operation is invoked.
They promote functional programming paradigms...read more
Q55. write a java program
A Java program to sort an array of strings alphabetically
Create an array of strings
Use Arrays.sort() method to sort the array
Print the sorted array
Q56. write a SQL Query
SQL query to retrieve employee names and their salaries from a table
Use SELECT statement to retrieve data
Specify the columns you want to retrieve (employee names and salaries)
Specify the table name from which you want to retrieve data
More about working at TCS







Top HR Questions asked in TCS Automation Test Engineer
Interview Process at TCS Automation Test Engineer

Top Automation Test Engineer Interview Questions from Similar Companies






Reviews
Interviews
Salaries
Users/Month