Rahul SA QA Interview Q a Day2
Rahul SA QA Interview Q a Day2
Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana Shabana Khan
AR, USA Walmart 2_W 1 Difference between Abstration and interface Abstract class and interface both are used to Abstraction: Abstract class: The interface will have only abstract methods in 1.Using abstract we cant achieve multiple Abstraction: It is about showing the necessary Abstraction:It is nothing but which hides the Abstract class and interface both are used to An interface is basically a description which Abstract class can have instance methods Abstract vs Intereface Abstract class Abstraction is a process of hiding the
achieve abstraction where we can declare the It is used to hide the implementation details and ================= which it can extend another interface. while inheritance but using interface we can achieve details to the user without showing the implementation of internal logic and showing achieve abstraction in which Abstract class can defines the behavior of an implementing class. (Implementation) while Interface strictly allows a> if we want to implement partially then we can 1)An abstract class can have method body (non- implementation details from the user, only the
abstract methods. ... Interface can have only display only essential features such as (1) Abstract class can have both abstract and abstract class and have both abstract and non multiple inheritance complexity (like how it works) related to specific only functionalities to the user called an have abstract and non-abstract method where Methods of Java interface are implicitly abstract. only non implemented methods. go for abstract class . abstract methods). functionality will be provided to the user. In other
abstract methods. Since Java 8, it can have properties and methods of the object. non-abstract methods Abstract methods, can extend another Java 2.An abstract class can be defined and it can scenario. abstraction. as Interface can have only abstract methods. The implementing class ensures that it will have if we don't know anything about implementation 2)An abstract class can have instance variables. words, the user will have the information on what
default and static methods also. 2) Abstract An abstract class can extend only one class or (2) Abstract class doesn't support multiple class or multiple interfaces contain access modifiers fo the subs,functions, To achieve above we use Abstract class and Interface It is blue print of class by using Abstract Class can have an access modifier but these methods that can be used on it. just we have requirements then we go for 3)An abstract class can have constructor. the object does instead of how it does it.
class doesn't support multiple one abstract class at a time. inheritance properties but interface member cant be defined Interface. interface we can achieve 100% abstraction it The interface does not have access modifiers, so Variables declared in an interface are by default interface 4)An abstract class can have static methods. Interface: An Interface can only declare
inheritance. Interface supports multiple An abstract class can extend another concrete (3) Abstract class can have final,non-final,static using the keyword static,virtual,abstract or Below are the differences between these: accepts only abstract methods in it Everything defined inside the interface is final. Interface classes are public by default. b> Abstract class can have both abstract 5)You can extends one abstract class. constants and instance methods, but cannot
inheritance. (regular) class or abstract class. and non-static variables sealed and interface can not use any access a) Abstract class can have abstract and non- assumed as 'public'. An abstract class is base for different sub- methods and concrete methods where as in Interface implement default behavior and all methods are
An abstract class can have both abstract and (4) Abstract class can provide the modifier i.e, public,private,protected,internal etc. abstract methods. Multiple inheritance concept is achieved through classes that share a common behavior and thus interface all the methods are default public and Interface have only abstract methods. implicitly abstract. An interface has all public
concrete methods implementation of interface because within an interface by default Interface can have only abstract methods. Since Interface so An interface can inherit multiple does't need to be created multiple times. Also abstract. An interface cannot have instance variables. members and no implementation.
(5) The Abstract keyword is used to declare everything is public. Java 8, it can have default and static methods interfaces but cannot inherit a class but An sub-classes can override the predefined c> The variables present in Abstract class need Interface cannot have constructor. In short, Interface will have methods but no body.
Interface: Abstract class 3.A class may inherit only one abstract class but also. abstract class can inherit a class and multiple behavior as long as it is not define as private or not be public, static and final where as in Interface cannot have static methods.
An interface can extend any number of (6) An Abstract class can extend another java In interface, A class may inherit several b) Abstract class doesn't support multiple interfaces. final. An abstract class may contain non final interface all the variables by default public, You can implement multiple interfaces.
interfaces at a time. class and implement multiple java interfaces interfaces inheritance. variables. Abstract class can be public, private static and final.
An interface can only extend another interface. (7) An abstract class can be extended using the Interface supports multiple inheritance. and protected d> Abstract class can extend class where as in
An interface can have only abstract methods keyword extends c) Abstract class can have final, non-final, static interface we can implement the class but not
and non-static variables. Interface has only extend.
Interface: static and final variables. e> we can declare constructor inside Abstract
============== d) Abstract class can provide the implementation class where in interface we cannot declare
(1) Interface can have only abstract methods. of interface. Interface can't provide the constructor
Since java 8 it can have default and static implementation of abstract class.
methods also e) The abstract keyword is used to declare
(2) Interface support multiple inheritance abstract class.
(3) Interface can have only final and static The interface keyword is used to declare
variables interface.
(4) Interface can't provide the implementation of f) An abstract class can extend another Java
abstract class class and implement multiple Java interfaces.
(5) The Interface keyword is used to declare An interface can extend another Java interface
Interface only.
(6) An interface can extend another java interface g) An abstract class can be extended using
only keyword "extends".
(7) An interface class can be implemented using An interface can be implemented using keyword
the keyword implements "implements".
h) A Java abstract class can have class members
like private, protected, etc. Members of a Java
interface are public by default.
AR, USA Walmart 2_W 2 What is encapsulation Encapsulation in Java is a process of wrapping Encapsulation The Process of grouping Data members and Encapsulation is hiding the actual Encapsulation in Java is a process of wrapping Encapsulation: This concept used to achieve Encapsulation:It is an concept of binding ,here The process of wrapping code and data together Encapsulation is a OOP concept and is a form of Wrapping of data/variables and methods into a Encapsulation allows us to protect the data What is encapsulation - Wrapping methods or It is Abstraction plus the data hiding. It can be
code and data together into a single unit, for It is used to bind data members and member related methods can be referred as implementation of a class, means variables, code and data together into a single unit.By data hiding by making that data private and in class is also an encapsulation which binds into a single unit is known as encapsulation data hiding. Encapsulation wraps the data single unit.(Known as Data Hiding also) because stored in a class from system-wide access. The data as a single unit. example- we can use get() achieved by declaring class variable as private
example, a capsule which is mixed of several functions into a single unit to prevent outsiders encapsulation methods, and all data in class is hiding by providing only a setter or getter method, we can order to use that private data we can use public methods and variables in it and encapsulation is variables and the methods together in a single implementation is hidden for the users. main advantage of encapsulation is it restricts and set() methods and make them public. these and provide public setter, getter methods for
medicines to access it directly. --> If any component allows Data hiding and another class can be accessed by only any make the class read-only or write-only. In other getter and setter method. the key to security it can be implemented by unit. It makes the variables of a class hidden from direct access to data members if the class. we can be used to either access variable or set modifying and viewing variable values to get
We can create a fully encapsulated class in Java Eg: Declaring all the variables in the class as abstraction can be termed as an encapsulated method which they are declared. gives data words, you can skip the getter or setter methods. Thus our actual data is hiding whatever user will using private access modifier other classes and if any class want to access can implement encapsulation in java by keeping values for the variables control over data.
by making all the data members of the class private and using C# Properties in the class to component hiding and Re-usability. It provides user the control over the data. You do to that private data can never by known by these variables they need to do it from the the class variables private and providing public
private. Now we can use setter and getter set and get the values of variables. --> Encapsulation = Data hiding + Abstraction can write the logic not to store the negative others. methods of their current class. getter and setter methods to each of them.
methods to set and get the data in it.By providing Example: numbers in the setter methods.It is a way to To achieve encapsulation we need to make sure the best way that we used encapsulation in our
only a setter or getter method, you can make the class Student achieve data hiding in Java because other class two important things -- private and public project is making all the webelements in each
class read-only or write-only.It is a way to { will not be able to access the data through the -- need to define variables in the class as private page class as private and created public getter
achieve data hiding in Java because other class private int age; private data members. -- we need provide public methods for view, methods to each webelement in order to access
will not be able to access the data through the private int roll no; The encapsulate class is easy to test. So, it is modify privately defined variables- for eg get them outside the class.
private data members. private float marks; better for unit testing. and set
public void read()
{
}
public void write()
{
}
}
AR, USA Walmart 2_W 3 Explain about synchronization in selenium Synchronization meaning: when two or more Synchronization: When we are testing our application. Selenium Synchronization in selenium means nothing but Synchronization in Selenium Webdriver: Synchronization in Selenium: This concept Synchronization:Generally when we work with Normally Synchronization is a mechanism which Synchronization in selenium is an crucial Synchronization is basically the waits involved in Synchronization is a mechanism which involves Synchronisation is nothing but when elements Synchronization can be achieved through waits
components involved to perform any action, we It is a mechanism which involves more than one webdriver may be faster when compared to our managing wait between the application which Synchronization is a mechanism which involves comes into picture when we have two or more real time project all the elements may not load at involves two or more components working component for making the scripts running on an codes. It may be implicit,explicit, thread.sleep, two or more components working parallel with on the web page are in sync with the WebDriver. in Selenium. There are two different types of
expect these components to work together with component to work parallel with each other web application as it takes some time to load our you are testing and selenium tool to avoid two or more components working parallel with components need to be work in synchronized the same time in the application in that scenario parallel with each other. Usually we have our AUT application/website successful. It's basically a fluent wait. We shouldn't use thread.sleep more each other and it is one of the common issue It avoids exceptions like timeoutexception we use synchronizations.
the same pace. The co-ordination between these page exceptions like elementnotfoundexception .etc... each other. Usually, in test automation, there will order. we will get Synchronization problems in order to and tool to work on that AUT. sync between the Application under testing and as it haults the execution. that we face in our automation. why do we face impliciWait() or explicitWait() methods. a) Unconditional: It is used to specify timeout
components to run paralelly is Synchronization can be classified into two or for webelements to be present in our webpage in order to handle that we are using be two components such as application under While go for Automation testing, we have 2 solve this problems we will use following Both of them have seperate speeds .For example, selenium (the testing tool). Both these two this issue is as we know in test automation, there value only. Ex: Thread.Sleep();
called Synchronization categories: At that time Selenium will throw the exception unconditional and conditional waits like - test and the test automation tool. components:- The Application (to be tested) and methods on selenium If I want to navigate to some url and click on different things have their own speed and thus are two main components that we deal with b) Conditional : It is used on condition along with
It is a mechanism which involves more than one Unconditional Synchronization: "ELEMENTNOTVISIBLEEXCEPTION" Implicit wait- wait until the specified time for the Automation tool (selenium, QTP etc.). A user implicit wait some element and try to enter text.at this points there is always a chance of miss match to occur. application under test and the test automation timeout value. Ex: Implicit Wait, Explicit Wait and
components to work parallel with Each other. We will make the tool to wait until certain amount So to match the speed of the application or in every step in the test script before you throw the Unconditional Synchronization: Only the timeout should ensure while running the test script, both explicit wait the selenium commands what ever I pass may be For eg - selenium webdriver may be faster and tool which will have their own specified speeds. Fluent Wait.
Generally in Test Automation, we have two of time and then proceed further. some case, to wait for specific condition at some error. value to be specified.It will wait till certain time the application and the script run with same fluent wait faster than the application loading time which has reached a certain step where web element while writing the test scripts we should be written Implicit Wait: It is a global wait i.e.,when we define
components Eg: Wait() and Thread.Sleep(); point of time , we use synchronization in driver.manage.TimeOuts.implicitwait(6,Timeunit. before proceeding. Wait(),Thread.Sleep(); speed so that we can avoid "Element not found" results in an exception. needs to be clicked. But the application under in a way such that both these components will the implicit wait, it will set for the life of the
1. Application Under Test selenium, which helps to SECONDS); The main advantage of this method is that it will exception. So we always should synchronise the test (a website may be) is slow and its page is work with same speed. In order to achieve this we WebDriver object instance.
2. Test Automation Tool. Conditional Synchronization: bring the AUT and selenium Speed in sync Explicitwait - wait until the specified time for a come for help when we interact with a third party Thus we use the concept of below waits with 2 application with our tool.Normally we can go for still loading up where that element is present. In need to implement waits concept in our Syntax: driver.manage().timeouts().implicitlyWait
We specify a condition along with timeout value, specified test step before throwing an exception. system such as an interface. Here, it is not categories: Thread.sleep() which is not encouraged because this case the script will fail. automation scripts. (10, TimeUnit.SECONDS);
Both these components will have their own so that tool waits to check for the condition and Synchronization in Selenium: Good use when page loads dynamically possible to write condition or check for a a) Unconditional: Thread.sleep() it increases execution time unnecessarly even Hence to overcome this situation, Explicit Wait: To define a wait statement for
speed. We should write our scripts in such a way then come out if nothing happens. ======================= WebDriverWait wait = new WebDriverWait(driver, condition. In such cases, the application can be b) Conditional: Implicit, Explicit, Fluent wait. though it doesnt need for application. synchronization is required between selenium certain condition to be satisfied until the
that both the components should move with Implicit Wait: An implicit wait is to tell WebDriver 1) Implicit wait 10); made to wait for a specific period using this type There are 3 ways to achieve this, 1.Implicit wait 2. and the AUT. It can be achieved using wait func specified timeout period.
same and desired speed, so that we will not to poll the DOM for a certain amount of time when 2) Explicit wait wait.until(ExpectedConditions. of synchronization. The major disadvantage is Explicit wait and 3.Fluent wait in selenium and also sleep(). But we should Syntax: WebDriverWait wait = new WebDriverWait
encounter "Element Not Found" errors which will trying to find an element or elements if they are 3) Thread.sleep() visibilityOfElementLocated("locator"))) that at some times, the tool will be made to wait Implicit wait :This can be used while trying to find prefer waits -- Implicit or Explicit waits. (driver, 10);
consume time again in debugging. not immediately available 4) Fluent wait fluent wait - the maximum time to wait for test unnecessarily even when the application is out an element or elements and when they are wait.until(ExpectedConditions.
Explicit Wait: We need to define a wait statement step with polling time to ignore the exception ready. not readily available. The implicit wait will tell the visibilityOfElementLocated(By.id("Name")));
Synchronization can be classified into two for certain condition to be satisfied until the 1) Implicit wait: during that period. webdriver to poll the DOM for a certain period of Fluent Wait: To define the maximum amount of
categories: specified timeout period. If the Webdriver finds ================= Conditional Synchronization time. However, this will not work for all commands time to wait for a condition, as well as the
the element within the timeout period the code Implicit wait will wait for the specified time before In this case, a condition also will be specified but only for “Find Element” and “Find Elements” frequency with which to check for the condition.
1. Unconditional will get executed. throwing the exception along with the timeout value. The tool will wait to statements. Syntax: Wait<WebDriver> wait = new
2. Conditional Synchronization Fluent Wait: Using FluentWait we can define the check the condition and will come out if nothing driver.manage.TimeOuts.implicitwait(6,Timeunit. FluentWait<WebDriver>(driver)
maximum amount of time to wait for a condition, Syntax: driver.manage().timeouts().implicitlyWait happens. However, it is important to set a timeout SECONDS); //Wait for the condition
Unconditional : as well as the frequency with which to check for (30, TimeUnit.SECONDS); value also in conditional synchronization so that Explicit wait : Here, in this case, a wait statement .withTimeout(20, TimeUnit.SECONDS)
In this we just specify timeout value only. We will the condition. the tool will proceed even if the condition is not for certain conditions will be defined which // which to check for the condition with interval
make the tool to wait until certain amount of time 1. Implicit wait is a single line of code and can be met. There two different types of conditional should be satisfied within the specified timeout of 3 seconds.
and then proceed further. declared globally which is applied to all the statements in selenium webdriver and they are period. The code will be executed if the element .pollingEvery(3, TimeUnit.SECONDS)
webelements an implicit wait and explicit wait. is found within the specified time. //Which will ignore the
Examples: Wait() and Thread.Sleep(); 2. It is a Dynamic wait and it won't wait for the WebDriverWait wait = new WebDriverWait(driver, NoSuchElementException
specified time if the element found early and Implicit Wait 10); .ignoring(NoSuchElementException.class);
The main disadvantage for the above statements continues to the next line for execution This can be used while trying to find out an wait.until(ExpectedConditions.
are, there is a chance of unnecessary waiting 3. It will be applied till the end of driver life element or elements and when they are not visibilityOfElementLocated(By.xpath("some
time even though the application is ready. readily available. The implicit wait will tell the locator"));
2) Explicit wait: webdriver to poll the DOM for a certain period of Fluent Wait:This is used to define maximum
The advantages are like in a situation where we ================== time. However, this will not work for all commands amount of time to wait for a condition and also to
interact for third party systems like interfaces, it Explicit wait mechanism targets only specific but only for “Find Element” and “Find Elements” increase the frequency with which the conditions
is not possible to write a condition or check for a element. We can tell to wait till the condition statements. are checked.
condition. Here in this situations, we have to satisfy, Once the condition satisfied, The tool Wait wait = new FluentWait<WebDriver>(driver)
make the application to wait for certain amount proceed with the Syntax .withTimeout(50, TimeUnit.SECONDS)
of time by specifying the timeout value. next step driver.manage.TimeOuts.implicitwait(6,Timeunit. .pollingevery(3, TimeUnit.SECONDS)
This can be done with WebDriverWait in SECONDS); .ignoring(NoSuchElementException.class);
Conditional Synchronization: conjunction with ExpectedConditions class Explicit Wait
Here, in this case, a wait statement for certain
We specify a condition along with timeout value, Example: conditions will be defined which should be
so that tool waits to check for the condition and ======== satisfied within the specified timeout period. The
then come out if nothing happens. //define webdriver wait statement with time code will be executed if the element is found
specified within the specified time.
It is very important to set the timeout value in WebDriverWait wait = new WebDriverWait(driver,
conditional synchronization, because the tool 10);
should proceed further instead of making the
tool to wait for a particular condition to satisfy. //apply the wait for specific element. Below
statement will wait for element to be present till
10 sec as specified by above
wait.until(ExpectedConditions.
presenceOfAllElementsLocatedBy((By.xpath("//a
[@class='ico-register']"))));
3) Thread.sleep():
====================
One of the way to achieve synchronization,
implement wait is by calling Thread.sleep()
function however, it is not recommended
because this
is not very stable and unreliable. The time has to
be specified in milliseconds.
Halts execution for particular time
Syntax: Thread.sleep(3000)
4) Fluent Wait:
===================
In Fluent Wait we define a Maximum amount of
time to wait for a condition. Also, we will be
defining a Polling frequency time while declaring
the Fluent Wait.Fluent Wait will be polling the web
pages every Polling frequency time to verify the
given condition.
Example:
=========
Wait<WebDriver> wait = new
FluentWait<WebDriver>(driver)
.withTimeout(30, TimeUnit.SECONDS)
.pollingEvery(1, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);
AR, USA Walmart 2_W 9 Explain about Page object model and advantages Page Object Model as a design pattern used to Page object model: 1. Page object Model(POM) is a Selenium design PageObjectModel (POM) is a design which creates Page Object model is an object design pattern in It is a design pattern where we kept our web Page Object Model:The name itself specifies we Page Object Model (POM) is a design pattern, Page object is a strategy or a design to maintain Basically maintaining of all the objects of the Page object model is a design pattern which is 1. Create a package and all class corresponding The chief problem with script maintenance is that
build an object repository for the web elements Page Object Model in Selenium is a design pattern. We can see it as a repository where we object repository's for each web page elements Selenium, where web pages are represented as elements and logic of a page separately. This work on pages on these pages are pure java popularly used in test automation .Under this a object repository for all the Web UI elements. It particular page in one java file is Page Object used in our framework to store all the to each page if 10 different scripts are using the same page
available in the application under test. Few pattern that is extensively used by the Selenium store all the webelements. This has become very in the application. advantages are -reduce code classes, and the various elements on the page helps user to interact easily and clear classes model, for each web page in the application, helps in reducing the code duplication and Model. Advantage: Easy to maintain, Easy weblements. 2. Create a package and all test classes element, with any change in that element, you
others refer to it as a framework for Selenium community for automation tests. The basic popular duplication and code reusability. are defined as variables on the class. All understanding of the script. Advantages:Easy to maintain there should be a corresponding Page Class. improve the overall maintenance of the code. readability of scripts, reduce duplicity, Re- •In this model, we create a separate class for 3. Create a package for resources to add . need to change all 10 scripts. This is time
automation for the given application under test. design principle that the Page Object Model in in industry these days because it is very easy to possible user interactions can then be Advantages: Code is more readable format This Page class will identify the WebElements of The main structure of of page object model is to usability of code, Reliability. each web page present in the application and properties file, base class, utilities file etc consuming and error prone.
However, what I have understood about the term Selenium follows is that a central object manage, reusability of code and eliminates implemented as methods on the class Code maintenance Re usability that web page and also contains Page methods define all webelements of a single page of a that class holds all the functionality and Advantages: A better approach to script maintenance is to
Page Object Model is: repository should be created for controls on a duplication of code Reusability which perform operations on those website/web application in single class, along members of that webpage. 1. Structured create a separate class file which would find web
web page. Hence, each web page will be 2. The keybenifits is if UI changes in the future, Test cases become short and optimized. WebElements. with methods which perform certain thing on The main advantage of using POM is it reduce the 2. Clear understanding of Test Classes and base elements , fill them or verify them. This class can
#1) It is a design pattern where you have a represented by a separate class. Then we can update webelements to page This concept makes our code cleaner and easy those elements. code duplication and improves test case classes and Logic be reused in all the scripts using that element. In
separate Java class file corresponding to each Advantages: classes in POM or object repository accordingly to understand.We can reuse the page class if The main advantage of POM is that code maintenance. 3. Easily reusable and can be maintained easily future if there is change in the web element , we
screen or page in the application. The class file • Better Maintenance – With separate page required in different test cases which means we becomes more optimized and less in size For example: if developer did some changes in need to make change in just 1 class file and not
could include the object repository of the UI objects (or page classes) for different web pages, don’t need to write code for identifying the web because we now have the reusable methods in one of the application page like a new 10 different scripts.
elements as well as methods. functionality or web locator changes will have a elements and methods to interact with them for our POM classes. webelement is added or an old webelement This approach is called Page Object Model(POM)
less impact on the change in test scripts. This every test case. If we give proper names to methods as per their locator value got changed in the DOM, in this Advantages: a)Easy to understand and cleaner
#2) In case there are humongous web elements makes the code cleaner and more maintainable usage, it can be easily mapped and used. case we can do changes to that particular page code
on a page, the object repository class for a page as Selenium test automation implementation is Code is much cleaner and easy to understand. related class instead of doing changes in all the b) Easy of script maintenance
can be separated from the class that includes spread across separate page classes. classes where ever we used this webelement. c) we can use the same object repository for a
methods for the corresponding page. • Minimal Changes Due to UI Updates – The effect different purpose with different tools. For
of changes in the web locators will only be example, we can integrate POM with TestNG/JUnit
Example: If the Register Account page has many limited to the page classes, created for for functional testing
input fields then there could be a class automated browser testing of those web pages. d) Methods get more realistic names which can
RegisterAccountObjects.java that forms the This reduces the overall effort spent in changing be easily mapped with the operation happening
object repository for the UI elements on the test scripts due to frequent UI updates. in UI.
register accounts page. • Reusability – The page object methods defined
in different page classes can be reused across
A separate class file RegisterAccount.java Selenium test automation scripts. This, in turn,
extending or inheriting RegisterAccountObjects results in a reduction of code size as there is the
that includes all the methods performing increased usage of reusability.
different actions on the page could be created.
3. Data hiding:
============
Our internal data should not go out directly. So
we use the concept of data hiding
private access modifier should be used to
declare the data
Ex:
Class Account
{
private double balance; //Data hiding
public double getbalance()
{
Implementation
}
}
--> For Data Security
--> Highly recommended modifier for variables is
private
4. Abstraction:
=============
Hiding internal implementation and highlight the
set of services providing
-->For security
-->Abstraction can be implemented using
interface concept
5. Encapsulation:
===============
Example:
========
class Student
{
private int age;
private int roll no;
private float marks;
public void read()
{
}
public void write()
{
}
}
6. Inheritance:
=============
--> It is one of the oops concept where the child
class acquires the properties of parent class (or)
super class
--> extends keyword is used to inherit the
properties of class
1. Single inheritance
2. Multilevel inheritance
3. Hierarichal inheritance
7. Polymorphism:
================
Ability of an object to take different forms can be
referred as polymorhism
Hyderabad Rishennya software services 3_R 2 What is data Driven testing It is a test automation framework that stores test 2. Runtime
1. Data polymorphism:
driven testing is a scripting technique that Data Driven Testing is a type of approach where DATA DRIVEN TESTING is a test automation Data Driven framework:It is best practise to read Data-driven testing is creation of test scripts Data driven is not supported by Selenium alone. DATA DRIVEN TESTING is a test automation Testing using different sets of data to break the
=======================
data in a table or spreadsheet format. This allows stores test input and expected result in a table for automation we use test date which will be framework that stores test data in a table or the data from external files like excel where test data and/or output values are read We just third party Apache poi Api to perform framework that stores test data in the form of code. example- boundary values
automation engineers to have a single test script orMethod Resolution
spreadsheet, So at runtime
that acheived
a single controlusing
script mostly stored in form of files or excel sheets, spreadsheet format. This allows automation As a Team When we were designing framework from data files instead of using the same hard- data driver testing. We have two jars apache poi- excel files, Text files, xml files, and in the
method
that can execute tests for all the test data in the can overriding
execute in subclasses
all of the tests in the table which is used to input in the application and get engineers to have a single test script that can we thought of that if client requirement was test coded values each time the test runs. ooxml and poi and one class XSSFWorkbook. Just databases.
table. 2. In the simplest form the tester supplies the the actual outputs later will be compared with execute tests for all the test data in the table. with multiple This way, testers can test how the application create object of this class and using some in- • In this framework, input values are read from
inputs from a row in the table and expects the expected outputs to obtain desired results. In this framework, input values are read from data data it was not recommend to use bulk of data handles various inputs effectively. It can be any build methods, we can get the data whatever we data files and are stored into a variable in test
output which occur in the same row. The table files and are stored into a variable in test scripts. into the script directly its better we use DDT into of the Datasources like Excel,DB,CSV Files,json want." scripts.
typically contains values which corresponds to Ddt (Data Driven testing) enables building both our etc" • And it is mainly used when the same test script
boundary or partition input spaces. positive and negative test cases into a single framework. need to be tested with multiple set of data."
test.
In Data-driven test automation framework, input
data can be stored in single or multiple data
sources like xls, XML, csv, and databases.
It allows testing application with multiple sets of
data values during Regression testing"
Bangalore Synechron technologies 4_S 1 Explain about your framework? 1. Language used: Java language : In our Selenium Project we are using
In our Selenium Project we are using Java Not Answered Hybrid framework using POM approach. I have
2. Type of Framework: Behavioral-driven Java language. language. Even though Selenium supports used Selenium+Java+TestNG+TDD+DDD
Framework by using Page Object Model design Type of Framework: we are using Data-drivenmultiple languages, we are using Java language
pattern with page factory Framework by using Page Object Model designis just because most of the automation
3. POM: As per pom, we have maintained a class pattern with Page Factory. developers have knowledge on Selenium with
for every web page. Each webpage has a TestNG: Using TestNG for Assertions, Grouping
Java.
seperate class for functionality and members of and Parallel execution. Type of Framework: In our project, we are using
that webpage. Seperate classes for every Maven: Using Maven for build, execution andData-driven Framework by using Page Object
individual test. dependency purpose. Integrating the TestNG Model design pattern with Page Factory.
4. Packages: We have seperate packages for test dependency in POM.xml file and running this POM.
POM: As per the Page Object Model, we have
case, test data, utilities xml file using Jenkins. maintained a class for every web page. Each web
5. Test Base class: It will deal with all the Version Control Tool: We use Git as a repository
page has a separate class and that class holds
common functions used by all the pages. This to store our test scripts. the functionality and members of that web page.
class is responsible for loading the Jenkins: By using Jenkins CI (Continuous Separate classes for every individual test.
configurations from properties file, initializing the Integration) Tool, we execute test cases on daily
We have separate packages for Pages and Tests.
Webdriver, Implicit waits, Extent Reports and also basis and also for nightly execution based on
All the web page related classes come under
to create the object of FileInputStream which is the schedule. Test Result will be sent to the
Pages package and all the tests related classes
responsible for pointing towards the file from peers using Jenkins. come under Tests package.
which the data should be read. Logs : Used Log4j for logging for tets scripts
Home Page and Login Page,we have a separate
6. Utility class: It stores and handles the the Extent Reports: For the reporting purpose, we are
classes to store element locators. For the login
functions which are repetitive (Waits, actions, using Extent Reports. It generates beautiful HTML
test there would be a separate class which calls
capturing screenshots,accessing excels, reports. We use the extent reports for the methods from the Home Page class and
Sending mails etc).This class extends the Test maintaining logs and also to include the Login Page class.
Base class to inherit the properties. screenshots of failed test cases in the Extent
As per the maven project, all the tests are kept in
7. Properties file: The file (config.properties) Report. the ‘src/test/java‘ and remaining files (such as
stores the info that remains static throughout POM : As per the Page Object Model, we haveconfig.properties, element locators (POM
the framework such as browser specific info, maintained a class for every web page. Each web
classes), utility files, test data, etc.,) kept under
application URL, screenshots path etc. page has a separate class and that class holds
‘src/main/java‘.
8.Screenshots: Screenshots will be captured and the functionality and members of that web page.
Test Base class (TestBase.java) deals with all the
stored in a seperate folder and the screenshots Separate classes for every individual test.common functions used by all the pages. This
of a failed test cases will be added in the extent Properties file: (config.properties) stores the
class is responsible for loading the
reports information that remains static throughout the
configurations from properties files, Initializing
9. Test-Data: All the historical test data will be framework such as browser specific information,
the WebDriver, Implicit Waits, Extent Reports and
kept in excel sheet. by using excel, we pass test application URL, screenshots path etc. also to create the object of FileInputStream
data and handle data driven testing. we use which is responsible for pointing towards the file
Apache POI to handle excel sheets from which the data should be read.
10. TestNG: Using TestNG for Assertions, Grouping Utility Class (AKA Functions Class): Utility class
and parallel execution (TestUtil.java) stores and handles the functions
11. BDD framework: we used BDD approach which (The code which is repetitive in nature such as
is in simple text language such that everyone waits, actions, capturing screenshots, accessing
can able to understand what is going on in the excels, sending email etc.,) which can be
project. commonly used across the entire framework. The
12. Maven: Using Maven for build, execution, and reason behind creating utility class is to achieve
dependancy purpose. Integrating the TestNG reusability. This class extends the TestBase
dependency in POM.xml file and running this POM. class to inherit the properties of TestBase in
xml file using jenkins TestUtil.
13. Version Control Tool: We use git and github as Properties file: This file (config.properties) stores
a repository to store and maintain our test the information that remains static throughout
scripts the framework such as browser specific
14. Jenkins: By using Jenkins CI (Continuous information, application URL, screenshots path
integration) Tool, we execute test cases on daily etc.
basis and for nightly execution based on the All the details which change as per the
schedule. Test Results will be sent to the peers environment and authorization such as URL,
using Jenkins. Login Credentials are kept in the config.
15. Extent Reports: For the reporting purpose, We properties file. Keeping these details in a
are using Extent Reports. It generates beautiful separate file makes easy to maintain.
HTML reports. We use extent Reports for Screenshots will be captured and stored in a
maintaining logs and to include the screenshots separate folder and also the screenshots of a
of failed test cases in the Extent Report. failed test cases will be added in the extent
reports.
All the historical test data will be kept in excel
sheet (controller.xlsx). By using ‘controller.xlsx’,
we pass test data and handle data driven testing.
We use Apache POI to handle excel sheets.
Using TestNG for Assertions, Grouping and
Parallel execution.
Using Maven for build, execution and
dependency purpose. Integrating the TestNG
dependency in POM.xml file and running this POM.
xml file using Jenkins.
We use Git as a repository to store our test
scripts.
By using Jenkins CI (Continuous Integration) Tool,
we execute test cases on daily basis and also for
nightly execution based on the schedule. Test
Result will be sent to the peers using Jenkins.
For the reporting purpose, we are using Extent
Reports. It generates beautiful HTML reports. We
use the extent reports for maintaining logs and
also to include the screenshots of failed test
cases in the Extent Report.
Bangalore Synechron technologies 4_S 2 Have you used POM in your framework? Yes, We have used Page Object Model design yes -As per the Page Object Model, we have As per the Page Object Model, we have Not Answered Yes
pattern with page factory. As per pom, we have maintained a class for every web page. Each web maintained a class for every web page.
maintained a class for every web page. Each page has a separate class and that class holds Each web page has a separate class and that
webpage has a seperate class for functionality the functionality and members of that web page. class holds the functionality and members of
and members of that webpage. Seperate classes Separate classes for every individual test. that web page. Separate classes for every
for every individual test. individual test.
Bangalore Synechron technologies 4_S 3 What is Page Factory? 1. Page Factory in Selenium webdriver is an The PageFactory Class in Selenium is an Selenium Page Factory Pattern is like an Not Answered It is optimized model of POM. It used @FindBy
integrated concept of API. Here we follow again extension of the Page Object design pattern. It is extension to Page Object Model , but Page annotation to find Webelements
the same principles of keeping repository used to initialize the elements of the Page Object Factory is much enhanced model. To start with,
objects or page classes seperate from test or instantiate the Page Objects itself. we just need to import package ‘org.openqa.
cases. selenium.support.PageFactory’
2. POM and page factory are same design Factory class can be used to make using Page
patterns but differs in the way we define the Objects simpler and easier.
locators when you are working with page object We use Page Factory pattern to initialize web
patterns. elements which are defined in Page Objects.
3. Here we use @FindBy annotation to find We should initialize page objects using
elements and to initialize webelements using initElements() method from PageFactory Class as
initelements process. below, Once we call initElements() method, all
elements will get initialized. PageFactory.
initElements() static method takes the driver
instance of the given class and the class type,
and returns a Page Object with its fields fully
initialized.
Bangalore Synechron technologies 4_S 4 Suppose you have 7 pages in your application then to We will write seperate class for every webpage. we can create each class for each page i.e for 7 Not answered Not Answered 1. create class for each of the 7 pages and put
achieve POM what u will do? Each webpage has a seperate class for pages = 7 classes which consist of all web them inside a package
functionality and members of that web page. elements on that page so that we can use that in 2. create another package for all test cases
our test case class. related to them
3. create package for base class and .properties
file
4. create package for Data
5. package is created for reports
Bangalore Synechron technologies 4_S 5 Have you used interface in your framework other then We have used TestNG listeners in selenium to Yes, I have used interface in my project to hide I have used selenium interfaces only in my Not Answered No
selenium interfaces? generate logs or customize the testng reports. the actual implementation. Like I have created an selenium project while initializing any browser
We have implemented ITestListener interface interface for user details and implemented it for using selenium webdriver.
which have below methods the login page class and esignature class to use
OnStart the data.
onTestSuccess
onTestFailure
onTestSkipped
onTestFailedButWithinSuccessPercentage
onFinish
Bangalore Synechron technologies 4_S 6 What are all the selenium interfaces? Webdriver itself is an interface. Webdriver is an interface in selenium which we Alert,Capabilities,ContextAware,HasCapabilities, Not Answered WebDriver
Alert. used to initialize it, other than that WebElement, JavascriptExecutor,OutputType,Rotatable, List
Capabilities. TakesScreenshot, Alert,ITestListener. SearchContext,TakesScreenshot,WebDriver, Set
ContextAware. WebDriver.ImeHandler,WebDriver.Navigation, Map
HasCapabilities. WebDriver.Options,WebDriver.TargetLocator, ITestListener
JavascriptExecutor. WebDriver.Timeout,WebDriver.Window,
OutputType. WebElement,WrapsDriver,WrapsElement
Rotatable.
SearchContext.
Bangalore Synechron technologies 4_S 7 Synchronization in selenium? syntax for implicit wait When we are testing our application. Selenium Synchronization is nothing managing we It is a mechanism which involves more than one Not Answered Synchronisation is nothing but when elements
webdriver may be faster when compared to our between an application under test and selenium. components to work parallel with Each other. on the web page are in sync with the WebDriver.
web application as it takes some time to load our in order to achieve this, we can use both Generally in Test Automation, we have two It avoids exceptions like timeoutexception we use
page conditional and unconditional waits components, impliciWait() or explicitWait() methods.
or for webelements to be present in our webpage Syntax for the implicit wait : 1. Application Under Test driver.manage().timeouts().implicityWait(20,
At that time Selenium will throw the exception -driver.Manage().Timeouts().ImplicitlyWait 2. Test Automation Tool. TimeUnit.SECONDS);
""ELEMENTNOTVISIBLEEXCEPTION"" (TimeSpan.FromSeconds(30)); Both these components will have their own
So to match the speed of the application or in speed. We should write our scripts in such a way
some case, to wait for specific condition at some that both the components should move with
point of time , we use synchronization in same and desired speed, so that we will not
selenium, which helps to bring the AUT and encounter ""Element Not Found"" errors which will
selenium Speed in sync consume time again in debugging.
Synchronization can be effectively handled by
Synchronization in Selenium : implicit and explicit waits. Implicit is application
============================ to all elements in the page.
1) Implicit wait WebDriver driver = new FirefoxDriver();
2) Explicit wait driver.manage().timeouts().implicitlyWait(10,
3) Thread.sleep() TimeUnit.SECONDS);
4) Fluent wait driver.get(""http://www.google.com"");
1) Implicit wait:
=================
Implicit wait will wait for the specified time before
throwing the exception
Syntax: driver.manage().timeouts().implicitlyWait
(30, TimeUnit.SECONDS);
Bangalore Synechron technologies 4_S 16 What is Hashmap ? Can we store objects in hash map and Ans: HashMap is a hash table based The string is a non-primitive data type, because HashMap<Integer, String> hmap = new 16> HashMap is a Map based collection class HashMap is a class in Collections framework. It
how to retrieve them? implementation of Java's Map interface. A map is it refers to string object HashMap<Integer, String>(); available in collection A has unique combination of Keys and values. Yes,
an object that maps keys to values. A map pi. in this we can store the objects in the form key we can store objects in hash map.
cannot contain duplicate keys /*Adding elements to HashMap*/ value pair. we use put(key, value) function to store We can retrieve them by using -
--> In Java HashMap object provides key/value hmap.put(12, ""Chaitanya""); the objects and we use get(object key) function to map1.keySet();
pairs for storing information in memory. You can hmap.put(2, ""Rahul""); retrieve object from hashmap. map1.values();
store any data type combination as long as the hmap.put(7, ""Singh""); we can use syso(map1) to retrive all elements of
keys are unique. hmap.put(49, ""Ajeet""); the hash map.
--> When you want to retrieve the object, you call hmap.put(3, ""Anuj"");
the get() method and again pass the key object.
/* Display content using Iterator*/
Set set = hmap.entrySet();
Iterator iterator = set.iterator();
while(iterator.hasNext()) {
Map.Entry mentry = (Map.Entry)iterator.next();
System.out.print(""key is: ""+ mentry.getKey()
+ "" & Value is: "");
System.out.println(mentry.getValue())
For each key-value to be stored in HashMap, a
hash value is calculated using the key's hash
code.
This hash value is used to calculate the index in
the array for storing Entry object.
Bangalore Synechron technologies 4_S 17 What is Jenkins? Jenkins is an open source automation tool Hash map is part of collections which stores data Jenkins – an open source automation server Not Answered Jenkins is a continuous integration tool. Jenkins
written in Java with plugins built for Continuous in the form of key and values. which enables developers around the world to is centralized across teams, geographical
Integration purpose. Jenkins is used to build and yes we can store objects as keys in hasp map. reliably build, test, and deploy their software. locations and has its own environment.
test your software projects continuously making use get methods to retrieve the data.
it easier for developers and testers to integrate
changes to the project, and making it easier for
users to obtain a fresh build
Bangalore Synechron technologies 4_S 18 What is the use of Pom.xml? A: POM stands for Project Object Model. Jenkins is a free and open-source automation The pom. xml file contains information of project 18> Pom.xml is file which got created when we In a maven project POM.xml builts the
--> It is fundamental unit of work in Maven. server, facilitating continuous integration and and configuration information for the maven to create a maven project. This file contains information environment of our proj by downloading
--> It is an XML file that resides in the base continuous delivery build the project such as dependencies, build about the project and configuration details used by dependencies and plugins.
directory of the project as pom. xml. directory, source directory, test source directory, Maven to build the project. we add all our project
--> The POM contains information about the plugin, goals etc. Maven reads the pom. dependencies in the form of xml tags where we give
project and various configuration detail used by groupid artifact id and version details.
Maven to build the project
--> We can run all our test cases using POM.xml
file
Bangalore Synechron technologies 4_S 19 What is the use of testng.xml? TestNG. xml file is a configuration file that helps XML file that contains information about the TestNG. xml file is a configuration file that helps Not Answered testng.xml is the heart of executing testng test
in organizing our tests. It allows testers to create project and configuration details used by Maven in organizing our tests. It allows testers to create cases. We can drive our test cases, test suites
and handle multiple test classes, define test to build the project. and handle multiple test classes, define test through them on a single or different browser. We
suites and tests. It makes a tester's job easier by suites and tests. It makes a tester's job easier by can also run them in parellel.
controlling the execution of tests by putting all controlling the execution of tests by putting all
the test cases together and run it under one XML the test cases together and run it under one XML
file file.
Bangalore Synechron technologies 4_S 20 Annotation used in page object model? Here we use @FindBy annotation to find elements A: @FindBy is one of the annotation used in the Ans : @FindBy " Not Answered POM - we use .by
and to initialize webelements using initelements page object model" PFM - we use .findBy
process
Bangalore General Electric 5_G 1 Ways to find broken links in selenium (except using first i will find all the links in webpage using
HTTPURL Connection) findelements() method and as we know all the
links start with <a> tag .
then i will fond the total no.of links available in
webpage using size() method.
then iterate the loop, in loop i will perform
control+enter action using keys in selenium.
then we find the window handles using
getWindowHandles() method and iterate the
process to get the text of each link. "
Bangalore General Electric 5_G 2 Why did you choose selenium? Not Answered
Bangalore General Electric 5_G 3 Test scenarios for Amazon search results page Not Answered
Bangalore General Electric 5_G 4 Test scenarios for Screen sharing in an app Not Answered
Bangalore General Electric 5_G 5 How will you test a button which is enabled only for 5 Not Answered
minutes in a day.
LOCATION COMPANY ROW ID Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana Shabana Khan
Bangalore GE Healthcare 6_G 1 How u handle dynamic drop-down list dynamically with a if the dropdown id are changing dynamically time u need to click based on user input further it wil
scenario to time, take u to diff window and then u need to handle d
( entire program they asked to write) driver.findElement(By.id(""id"")).sendkeys alert)
(""UserInput"");
driver.findElement(By.id(""id"")).sendKeys(Keys.
Enter);
String Homepagewindow = driver.
getWindowHandle();
Set<String> winhandles = driver.
getWindowHandles();
for(String handles : winhandles ) {
if(!handles.equals(Homepagewindow)) {
driver.switchTo().window(handles);
Alert alert = driver.switchTo().alert();
alert.accept();
}
Bangalore GE Healthcare 6_G 2 OOPS concept with programs Already provide answer in 3_R OOPS concept with programs - have mentioned
above
Bangalore GE Healthcare 6_G 3 About bug life cycle Journey of bug New-Assigned-Open-Fix-Resolved-Retest-Close
New -> Assigned -> Open -> Fixed -> Retest -> Or Retest-Open
Close Or Open-Not a Bug/deffered
New -> Assigned -> Open -> Fixed -> Retest ->
failed ->Re-assigned ->retest->Close
Bangalore GE Healthcare 6_G 4 Diff annotations in testng Already answered 2_w ->13 " A: @BeforeSuite, @BeforeTest, @BeforeClass
@Test @BeforeMethod @AfterMethod @AfterClass
@AfterTest @AfterSuite @Parameters
@DataProvider
Bangalore Harman 8_H 1 Roles and responsibilities Not Answered Roles and responsibilities
Bangalore Harman 8_H 2 Explain wyat you done in SQL testing Not Answered salesforce workbench, MySQL
Bangalore Harman 8_H 4 Explain What you done in API testing? Not Answered Postman, SF workbench Rest Explorer, Rest
Assured automation
Bangalore Harman 8_H 6 Explain different types of deffect management ? Not Answered JIRA, Quality Center, Trello
Bangalore Harman 8_H 7 Explain Bug cycle During the execution of test cases, if tester find Given the ans above
any defect, he will log that defect in the defect
tracking tool.
PA, USA Highmark 9_H 1 How do we identify the web elements? Using diff locators-ID, Name, CSS, Xpath, LinkText,
ClassName, TagName, PartialLinkText
PA, USA Highmark 9_H 2 How does Selenium work? given the ans in above questions.
PA, USA Highmark 9_H 3 We have a login functionality of banking application. We We need to test following scenario. User logs into
need to test following scenario. User logs into user user account and checks savings account
account and checks balance. How do you automate this test?
savings account balance. How do you automate this test? driver.getURL(""URL"");
driver.findElement(By.(""usernamelocator"")).
sendKeys();
driver.findElement(By.(""passwordlocator"")).
sendKeys();
driver.findElement(By.(""submitbuttonlocator"")).
click();
driver.findElement(By.(""identificationLocator"")).
click();
implicitwait
navigate to the account, assertTrue the expected
value.
PA, USA Highmark 9_H 4 We have login functionality. What do you start to test this Diff permutato and combination of username and
functionality with? (Manual testing question) password.
PA, USA Highmark 9_H 5 What is the difference between functional testing and Functional- new functions introduced in the
regression testing? (Manual testing question) system
Regression- main functionalities of the system
used over and over without any major changes.
PA, USA Highmark 9_H 6 Have you worked with single layer application? No
PA, USA Highmark 9_H 7 Can you tell me about architecture of the application you Salesforce architecture - Cloud based app,
worked? backend, integration with external tools like
jenkins, git, APIs, Eclipse
PA, USA Highmark 9_H 8 What is relative Xpath? How do we build it? Where do you Stated in previous questions.
start it?
Bangalore Thermo Fisher Scientific 10_T 1 How do you perform parallel testing in selenium? We use parallel attribute in testng.xml to acheive We define in Testng.xml file-
parallel testing in TestNG. It also has a <suite name=""TestSuite"" thread-count=""3""
parameter called as thread-count. The parallel parallel=""Test1"" >
can have the following values.
(1) Tests
(2) Classes
(3) Methods
(4) Instances
Ex:
<suite name = ""Deepthi"" parallel=""tests""
thread-count=""5"">
<test name=""Banking"">
<classes>
<class name =""test.day1""/>
</classes>
</test>
</suite>
1. Class:
=======
A class is a blueprint from which objects are
created. It is a collection of data members and
member functions
Ex:
public class Vehicle
{
int doors; //Data members
int speed;
String color;
public void run() //Member functions
{
//Implementation
}
}
2. Object:
========
Object is the instance of a class. Object is
created using new keyword.
Ex:
public class Vehicle
{
int doors; //Data members
int speed;
String color;
public void run() //Member functions
{
//Implementation
}
public static void main (String args[])
{
Vehicle v = new Vehicle();
v.run();
}
}
3. Data hiding:
============
Our internal data should not go out directly. So
we use the concept of data hiding
private access modifier should be used to
declare the data
Ex:
Class Account
{
private double balance; //Data hiding
public double getbalance()
{
Implementation
}
}
--> For Data Security
--> Highly recommended modifier for variables is
private
4. Abstraction:
=============
Hiding internal implementation and highlight the
set of services providing
-->For security
-->Abstraction can be implemented using
interface concept
5. Encapsulation:
===============
Example:
========
class Student
{
private int age;
private int roll no;
private float marks;
public void read()
{
}
public void write()
{
}
}
6. Inheritance:
=============
--> It is one of the oops concept where the child
class acquires the properties of parent class (or)
super class
--> extends keyword is used to inherit the
properties of class
1. Single inheritance
2. Multilevel inheritance
3. Hierarichal inheritance
7. Polymorphism:
================
Ability of an object to take different forms can be
referred as polymorhism
2. Runtime polymorphism:
=======================
Method Resolution at runtime acheived using
Bangalore Thermo Fisher Scientific 10_T 5 Explain overriding and method over loading . method overloading:
Method overriding in subclasses Multiple methods with the same name, having
================= different arguments in the same class
--> Overloading deals with multiple methods in 1. Argument count should be different
the same class with the same name but different 2. Or argument data type should be different
signatures
--> Overloading lets you define a similar Method Overloading
operation in different ways for different data. Same name of methods in different classes
having same data type, same arguments too
Method overriding: creating object of one class and calling the
================ function will override the method of another
--> Overriding deals with two methods, One in the class
parent class and one in a child class that have
the same signature
--> Overriding lets you define a similar operation
in different ways for different object types.
Bangalore Thermo Fisher Scientific 10_T 6 What is difference between constructor and interface ? Constructor : Constructor is the method inside the class that
=========== has same name as that of the class. It gets
Constructor has same name as the class name invoked when object of that class is created.
Constructor is used to initilize the data members Interface consists of only abstract methods. It
and start up tasks can be implemented by other classes.
Constructor is automatically called when an
object is created
There is no return data type in constructor
There is always a default constructor provided
by compiler
Interface:
=========
Interface contains only abstract methods
Access modifiers for methods in interfaces must
be public
Variables defined must be public,static,final
To implement an interface, we use implements
keyword
Bangalore Thermo Fisher Scientific 10_T 7 Why do you need geckodriver ? GeckoDriver is a connecting link to the Firefox For running Selenium with Firefox browser.
browser for your scripts in Selenium. GeckoDriver
is a proxy which helps to communicate with the
Gecko-based browsers (e.g. Firefox)
Bangalore Thermo Fisher Scientific 10_T 8 What is difference between explicit wait and implicit wait ? 1) Implicit wait: wait time out for webdriver till the specified time.
================= It can be overridden instead of 10 can gve 15
Implicit wait will wait for the specified time before seconds. It is global wait
throwing the exception driver().manage().timeouts().implicitlyWait(10,
TimeUnit.SECONDS);
Syntax: driver.manage().timeouts().implicitlyWait
(30, TimeUnit.SECONDS); Explicit wait is for a specific element on the page
Dynamic wait - create object of webdriverwait:
1. Implicit wait is a single line of code and can be WebDrriverWait(driver, 5).until
declared globally which is applied to all the (ExpectedConditions.presenceofElementLocated
webelements (By.id())""
2. It is a Dynamic wait and it won't wait for the
specified time if the element found early and
continues to the next line for execution
3. It will be applied till the end of driver life
2) Explicit wait:
==================
Explicit wait mechanism targets only specific
element. We can tell to wait till the condition
satisfy, Once the condition satisfied, The tool
proceed with the
next step
This can be done with WebDriverWait in
conjunction with ExpectedConditions class
Example:
========
//define webdriver wait statement with time
specified
WebDriverWait wait = new WebDriverWait(driver,
10);
Bangalore Thermo Fisher Scientific 10_T 11 How many suits can be there in testNG , what if I run all the Not Answered there are be multiple suites. will give results for
suits ? all suits.
Bangalore Thermo Fisher Scientific 10_T 12 As lead,how do you define quality of product before Quality of product - no P1/p2 - Blocker issues All bugs closed, no major bugs found, test
release? Insprint automation to ensure all the acceptance coverage is 100%
criteria of stories are met
Bangalore Thermo Fisher Scientific 10_T 13 in testNG, do we have multiple suit in one XML file and what Not Answered yes. we can . mentioned in previous questions.
if I want to run all suits ?
Bangalore Wells Fargo 11_W 1 In a web page there are several Pop-up, but we don't when we can handle dynamic popups using testNG TestNG Listeners
the pop-up will appear, in this case how we will handle the listeners. As we don't know when popup will occur
Pop-up using Selenium WebDriver (Java) during test script execution in this condition first we
write one generic function to handle the popup then
we call this popup in ITestListener implementation
class.
for example: i have a generic function
isAlertPresent(). i create one listener class which
implements the ITestListener Interface. In this
listener class, under toTestStart() function i will call
the isAlertPresent() method. As we know for every
test method execution before, toTestStart() function
is invoked. in this way for each and every test script
it will first check popup is present or not accordingly
it will perform alert actions.
Mumbai Jio 12_J 1 Suppose you are the leam QA and 1 new member join your Being a lead QA, i will first help the new hire get Give tasks that will help her learn the
team and at the same time you have a deadline to meet in familiar with all the team members and let him applications better but nothing on high priority
next 2 or 3 days so how will you involve that new member introduce himself. In case of immediate deadline, tasks. utilize by giving tasks that will help in
in team so that you can utilise him/her to meet deadlines? I will let him/her know the same, the situation we reaching goals like updating various statuses,
are in and make her comfortable about the scope updating excels, reporting, tracking etc
of the immediate need. I will get him/her familiar
with important people who he/she needs to know
in short term. I will define and prioritize a list of
task for the new team member and ask him/her to
contribute and work on them in his/her full
capability.
Take help from the senior folks and team member
in and around her. And never hesitate to
approach anybody including me to resolve or
find solution of any of the task given. And try and
complete the tasks because of the deadline and
regularly update the team with latest status so
that other can pickup those tasks which the new
team member is unable to work on
LOCATION COMPANY ROW ID Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana Shabana Khan
Bangalore Fossil 13_F 1 Java- Write a Java program to print 1234 1234 in two rows. (1) Write a program to print 1234 1234 in two rows? "in order to print the order number from the public void mthod1(){ 1.
Ans: success message for(int i=0;i<2;i++) public class MovingZerosToEnd {
first we need to locate success message {
public class Polymorp { webelement and capture the text from web page System.out.println(""1234""); public static void main(String[]
by using findElement() and getText() methods. } args)
public static void main(String[] args) { then we store the text in a string } {
// TODO Auto-generated method stub now from that string we need to print only order int[] arr= {2,5,0,4,2,7,0,0,1,9,4,0,0,10};
number which means only digits. int[] r=moveZeros(arr);
for(int i=1;i<=4;i++) for this we need to write the below function in our System.out.println(Arrays.toString(r));
{ script }
System.out.print(i); public static int[] moveZeros(int[] a)
} public String extractDigits(String message) { {
System.out.println(); StringBuilder builder = new StringBuilder int index=0;
for(int i=1;i<=4;i++) (message.length()); for(int i=0;i<a.length;i++)
{ for (int i = 0; i < message.length(); i++) { {
System.out.print(i); char c = message.charAt(i); if(a[i]!=0)
} // with the help of isDigit() function we can filter {
the digits from the message a[index++]=a[i];
} if (Character.isDigit(c)) { }
builder.append(c); }
} } while(index<a.length)
} {
return builder.toString(); a[index++]=0;
}
return a;
}
}
2.
public class
PrintingDuplicateCharacters {
}
public static void printDupes(String
s)
{
char[] c=s.toCharArray();
Map<Character,Integer>
map=new LinkedHashMap<>();
for(int i=0;i<c.length;i++)
{
map.put(c[i], map.
getOrDefault(c[i], 0)+1);
}
for(Map.Entry<Character,
Integer> m : map.entrySet())
{
if(m.getValue()>1)
{
System.out.println(m.
getKey()+" --> "+m.getValue());
}
}
}
3.
public class ReverseString {
}
else if(s.charAt(end)==' ')
{
end--;
}
else
{
s=String.valueOf(swap
(s,start,end));
start++;end--;
}
}
return s;
}
private static char[] swap(String s,
int start, int end) {
char[] ch=s.toCharArray();
char temp=ch[start];
ch[start]=ch[end];
ch[end]=temp;
return ch;
Bangalore Fossil 13_F 2 Selenium- In a online shopping application after placing a fetch the dynamic number generated in a
order, a success message will be displayed with a variable and print variable
weborder number. How to fetch and print the Weborder
number from that success message. The success
message can be in any language. (The weborder number
can be displayed anywhere in the success message
depending on the language)
Mi, Canada Canadian Tire Bank 14_C 1 Explain Set and Map in Java. Set: SetInterface->HashSet example, TreeSet and
==== LinkedHashSet
A set is a collection that cannot contain Does not accept Duplicate values
duplicate elements. How ever it makes no No guarantee that elements r stored in
guarantees concerning the order of iteration. sequential order
Below are the classes Implement set interface
1. Hashset HashMap is used for Key and Value set
2. LinkedHashSet HashMap is not synchronized-> if multiple thread
3. TreeSet are running this HashMap simultaneosly, it is not
synchronized
Implementation of Set interface: HashMap allows null values
============================ HashMap values are iterated using iterator ->
public class Hashset iterator interface
{
public static void main(String args[])
{
HashSet<String> hs = new HashSet();
hs.add(""Deepthi"");
hs.add(""Keerthi"");
hs.add(""Spoorthy"");
s.o.pn(hs);
}
}
Methods in iterator interface:
========================
hasNext()
next()
remove()
iterator<String> it = hs.iterator();
while(it.hasNext())
{
s.o.pln((it.next()); //Prints all elements present in
the set
}
Map:
=====
A map is an object that maps keys to values. A
map cannot contain duplicate keys.
Below are the main implementations of Map
interfaces
1. HashMap
2. LinkedHashedMap
3. TreeMap
Mi, Canada Canadian Tire Bank 14_C 3 Explain how BDD works with Cucumber. Cucumber is a tool based on Behavior Driven Feature file having Scenario , given , when then
Development (BDD) framework which is used to statements writen. Corresponding code is
write acceptance tests for the web application. It present in step definition file and we run the
allows automation of functional validation in runner file using JUnit.
easily readable format like plain english to
business analysts, Developers, Testers etc.
Mi, Canada Canadian Tire Bank 14_C 4 How do you set the test data in BDD. Framework built in cucumber: adding a variable or using Examples and
======================== Scenario Outline
When we have multiple test data to pass in a
single step of a feature file, we need to pass
multiple parameters
Feature file:
==========
Feature: Login feature
Scenario outline: Login test
Given: User is on Login page
When title of Login page is Welcome
Then user enters ""<username>"" and
""<password>""
Examples
----------------
|username|password|
|test |test123|
|sample |sample1|
StepDefinition file:
===============
@Then(^user enters \*(.*)\ and \*(*.)
public void user enters (String uname, String
pwd)
{
sysout(uname);
sysout(pwd);
}
The corresponding mapping of the parametrized
then in feature file
Mi, Canada Canadian Tire Bank 14_C 5 How do you manage test execution using TestNG. testng.xml file is used to manage the test testng.xml
execution in testNG.
In testcase:
@Test(groups={""smoke""})
Mi, Canada Canadian Tire Bank 14_C 6 Explain inner join and outer join in SQL. Inner Join: Inner join- table that has join within itself. Gives
========= the resukt from the same table.
This type of join returns those records which Outer join- Gives result from the left table.
have matching values in both tables.
Outer join:
========
An outer join returns a set of records (or rows)
that include what an inner join would return but
also includes other rows for which no
corresponding match is found in the other table.
There are three types of outer joins: Left Outer
Join (or Left Join) Right Outer Join (or Right Join)
Mi, Canada Canadian Tire Bank 14_C 7 Explain implicit and explicit wait. 1) Implicit wait: explained in previous questions.
=================
Implicit wait will wait for the specified time before
throwing the exception
Syntax: driver.manage().timeouts().implicitlyWait
(30, TimeUnit.SECONDS);
2) Explicit wait:
==================
Explicit wait mechanism targets only specific
element. We can tell to wait till the condition
satisfy, Once the condition satisfied, The tool
proceed with the
next step
This can be done with WebDriverWait in
conjunction with ExpectedConditions class
Example:
========
//define webdriver wait statement with time
specified
WebDriverWait wait = new WebDriverWait(driver,
10);
Delhi Pure software 15_P 1 Different types of Waits available in Webdriver Synchronization in Selenium: implicit wait,explicit wait,fluent wait Implicit, Explicit, Fluent wait, thread.sleep the different types of waits available in selenium Different types of Waits available in Webdriver- Implicit wait, Explicit wait and Fluent wait 1. Explicit wait, implicit wait, fluennt wait
======================== Avoid using Thread.sleep() as it haults(slows webdriver are Static, impliit, explicit, fuent waits
1) Implicit wait down) the execution. implicit wait -- it is a global wait which applicable
2) Explicit wait The most effective wait is Fluent wait as it applies to all the webElements
3) Thread.sleep() to specific element and for specific time user can Explicit Wait-- this is wait is applicable to single
4) Fluent wait provide. webElement with ExpectedCondition.
Fluent Wait - it is similar to Explicit wait.In this
1) Implicit wait: along with wait duration, ExpectedCondition we
================= define the frequency.
Implicit wait will wait for the specified time before
throwing the exception
Syntax: driver.manage().timeouts().implicitlyWait
(30, TimeUnit.SECONDS);
2) Explicit wait:
==================
Explicit wait mechanism targets only specific
element. We can tell to wait till the condition
satisfy, Once the condition satisfied, The tool
proceed with the
next step
This can be done with WebDriverWait in
conjunction with ExpectedConditions class
Example:
========
//define webdriver wait statement with time
specified
WebDriverWait wait = new WebDriverWait(driver,
10);
3) Thread.sleep():
====================
One of the way to achieve synchronization,
implement wait is by calling Thread.sleep()
function however, it is not recommended
because this
is not very stable and unreliable. The time has to
be specified in milliseconds.
Halts execution for particular time
Syntax: Thread.sleep(3000)
4) Fluent Wait:
===================
In Fluent Wait we define a Maximum amount of
time to wait for a condition. Also, we will be
defining a Polling frequency time while declaring
the Fluent Wait.Fluent Wait will be polling the web
pages every Polling frequency time to verify the
given condition.
Example:
=========
Wait<WebDriver> wait = new
FluentWait<WebDriver>(driver)
.withTimeout(30, TimeUnit.SECONDS)
.pollingEvery(1, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);
Delhi Pure software 15_P 2 Different types of Navigation Commands driver.navigate.To() driver.naviagte().back()/forward()/refresh()/to(url) Navigation is an interface in selenium to do Different types of Navigation Commands - . Navigate.back, Navigate. Refresh, Navigate. (to 2. driver.manage.navigate.forward/back/to URL, to
navigate().back(): driver.navigate.back() /wait(); navigate back and forth in browser. it has navigate().back , .forward(), .equals(), refresh(), String)., Navigate. (to Url), Navigate. Forward string
=============== driver.navigate.forward() methods to move back, forward as well as to notify(), notifyAll(), to(String arg0), toString(), to
It takes back the user to the previous webpage in refresh a page (URL arg0)
the web browser’s history navigate().to()-- to launch a new web browser
Ex: driver.navigate().back(); window and navigate to the specified URL
navigate().back()-- takes back to the previous
navigate().forward(): webpage with reference to the browser's history
================= navigate().forward()--- to navigate to the next
Navigates to the next web page with reference to webpage with reference to the browser's history
the browser’s history navigate().refresh()-- to refresh the current web
Ex: driver.navigate().forward(); page
navigate().refresh():
==================
This command will refresh the current web page
there by reloading all the web elements.
Ex: driver.navigate().refresh();
navigate().to():
=============
Used to launch a new web browser window and
navigate to the specified URL.
Ex: driver.navigate().to(“https://google.com”);
Delhi Pure software 15_P 3 How to handle frame Frames can't be handled in the normal way. We driver.swichTo.frame(id/name/webElement); driver.switchTo().frame(); IFrame is a web page which is embedded in How to handle frame - driver.switchTo.Frame(); driver. SwitchTo(). frame(int), driver. switchTo(). 3. driver.switchTo().frame
need to tell selenium to go inside the frame and driver.switchTo.defaultContent();//to come out of Actions a = new actions(driver); another web page frame(toString), driver. switch To. frame
handle the webelement the frame a.dragAndDrop(source, target).build().perform(); We can identify the iframes using below methods (webelement)
We can identify if a frame is present in the once frame is done, driver.switchTo(). ---Right click on the element, If you find the
webpage by using the tagname iframe defaultContent(); option like 'This Frame' then it is an iframe.
---Right click on the page and click 'View Page
List<WebElements> iframes = driver.findElements Source' and Search with the 'iframe', if you can
(By.tagName(“iframe”)); find any tag name with the 'iframe' then it is
meaning to say the page consisting an iframe.
We can use below three methods to switch to we can switch over the elements in frames in
frame (String/FrameID/WebElement) three ways
switchTo.frame(int frameNumber) Switch to the frame by index:
switchTo.frame(string frameName) driver.switchTo().frame(index);
switchTo.frame(WebElement frameElement) Switch to the frame by id or Name:
driver.switchTo().frame(id);
switchTo().defaultContent(): Switching back and Switch to the frame by Web Element:
forth between iframes and parent page can be driver.switchTo().frame(WebElement);
achieved using this method once we done certain actions in frame if we want
to come out of frame then we need to use
driver.switchTo().defaultContent();
In case of nested frame we use
driver.switchTo().parentFrame();
LOCATION COMPANY ROW ID Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana Shabana Khan
Delhi Pure software 15_P 4 How to handle Alerts Webdriver provides an API to handle alert By using alert method we can handle alerts in Selenium can't handle by inspecting elements. answered 4th question related to alerts in row id How to handle Alerts - driver.switchTo.Alerts(); driver.switchTo().Alert.dismiss, driver. Switch To. 4. driver.switchTo().alert().accept/dismiss
dialogues. Alerts cannot able to inspect. selenium we have to follow this: driver.switchTo().alert(). 4_S Alert. accept, driver. switchTo. Alert. get Text,
if there is no alert in the screen we will get driver.alert.accept(); accept() --> For OK/Yes/Done/Accepting alerts. driver. switchTo. sendKeys()
'NoSuchAlertException' driver.alert.dismiss(); driver.switchTo().alert().dismiss(); --> For
The alert interface contains a number of API's to No/Cancel Alerts.
execute different actions. driver.switchTo().alert().getText(); --> text present
in alert
Alert alert = driver.switchTo().alert(); driver.switchTo().alert().sendKeys(); --> can write
also.
1) alert().dismiss();:
===============
This method is used when the ‘Cancel’ button is
clicked in the alert box.
2)alert.accept():
==============
This method is used when you click on the ‘OK’
button of the alert.
3) alert.getText():
================
This method is used to capture the alert
message.
4) alert.sendKeys(""Text"");
=================================
This is used when you want to send some data to
alert box.
driver.switchTo().alert().sendKeys(""Text"");
Delhi Pure software 15_P 5 Difference between findelement and findelements 1. findElements method returns the list of all findElement:used to find single element element FindElement provides only one element present findElement() is used to find single webElement findElement- returns first element encountered By using the find Element we get the first 5. find element locates 1 element from the web
matching elements whereas findElement method in webpage in DOM while findElements gives the list of based on locator passed as parameter and if on the webpage matching element from multiple elements.By page where as find elements locates all objects
returns the specified webelement findElements:used to find multiple similar elements present. element is not found it will throws findElements- returns list of all webelements using the findElements we will get the list of from the web page having a same locator."
2. The findElement method throws a elements in web page and can be stored into one FindElement returns NoSuchElement Exception NoSuchElementException present on that page matching elements"
NoSuchElementException exception when the List while FindElements return empty list if no findElements() is used to find the list of similar
element is not available on the page. Whereas, locators match." webElements and if no elements is found it will
the findElements method returns an empty list return a list of 0 elements.
when the element is not available or doesn't exist
on the page
LA, USA Eharmony 16_E 1 As a QA where do you see yourself in next 6 months Well I am really excited by this position in Eharmony. I see myself leading an automation team. I have
In the next 6 months, I would like to be seen as grown as an automation QA in last 6 months learning
someone with deep understanding and expertise of Selenium, Java, TestNG, Cucumber, RestAssured,
the Quality Assurance field. I am also very excited to RestAPI. I want to learn RPA, Pyhton and Cypress
take on the responsibility of the Senior QA and next.
looking forward to immensely contribute to the
company's success in the next few months. Along
with sharing my knowledge and also gaining more
advanced technical skills in this field.
Bangalore Publicis Sapient 17_P 1 How to find broken links in web page using selenium
(including frames).
Bangalore Publicis Sapient 17_P 2 How will you handle dynamic payloads in API.
Bangalore Publicis Sapient 17_P 3 How to download a file using selenium.
Bangalore Publicis Sapient 17_P 4 How will you handle dependencies in Maven at run time.
Bangalore Publicis Sapient 17_P 5 How to fetch coupon code from image file.
Kolkata Cognizant 18_C 1 How do you manage a set of Data Tables in selenium? WebElement htmltable=driver.findElement(By.
xpath("//*[@id='main']/table[1]/tbody"));
List<WebElement> rows=htmltable.findElements
(By.tagName("tr"));
for(int rnum=0;rnum<rows.size();rnum++)
{
List<WebElement> columns=rows.get(rnum).
findElements(By.tagName("th"));
System.out.println("Number of columns:"
+columns.size());
for(int cnum=0;cnum<columns.size();cnum++)
{
System.out.println(columns.get(cnum).getText());
}
}
Step 1: First get the entire HTML table and store
this in a variable ‘htmltable’ of type web element.
Step 2: Get all the rows with tag name ‘tr’ and
store all the elements in a list of web elements.
Now all the elements with tag ‘tr’ are stored in
‘rows’ list.
Chennai Photon interactive 19_P 1 About yourself. 1>1.Hi, I’m xxxxxxxxx About yourself.
2.I have x years of experience in IT industry which
is totally into QA testing
3.I worked in different domains such as Finance,
Health care and Insurance.
4.As part of testing, I was involved in manual and
automation testing and I performed various types
of testing’s like smoke, sanity, regression,
integration, functional and User Acceptance
Testing.
5.As part of the testing ,I was involved in writing
test cases and test scripts.
6.I have good hands on experience working with
selenium and different components of selenium
like IDE, Web driver, Grid and have ability to
integrate maven,selenium,testng with eclipse
7.I have experience in cross browser testing with
different browsers such as chrome, Firefox and IE,
on different platforms and different versions.
8.I worked with various methodologies such as
waterfall/agile methodologies.
9.In Agile, I was involved in various meetings like:
sprint planning, status meetings, scrum
standups, grooming meetings and meetings with
business analysts, project managers, software
developers and QA leads.
I have ability to priorize and schedule multiple
tasks on a day to day basis.
10.I have also performed database transactions
using SQL queries.
11.I have performed parallel testing using
selenium grid and testNG.
12.I used different unit testing frameworks like
Junit and testNG to generate my reports,
13.And Maven as the build dependency tool, GIT
for version control.
14.I have used different bug tracking tools like jira,
Bugzilla and rally to log the defects.
15.I have experience in designing and
implementing the frameworks such as BDD and
TDD using cucumber tool and gherkin language
with java, selenium, maven
and continuous integration tools like Jenkins.
16.And I also have experience working with
Appium for mobile automation testing.
17.I have knowledge in testing different open
source API’s like SOAP, POSTMAN and REST using
Ready API and Rest Assured.
18.And I also had experience in testing AngularJS
applications by using protractor
19.This is pretty much about what I have done in
the past years.
Chennai Photon interactive 19_P 2 About project. Not Answered About project.
Chennai Photon interactive 19_P 3 Source code management tool. 3> source code management tool is a central Source code management tool.->GitHub
repository which is used to maintain automation
code. The commonly used SCM tools are
bitbucket, Github, CVS. In my project we used
Github to maintain our code where we can add ,
commit, push, pull and merge the code.
Chennai Photon interactive 19_P 4 How will you resolve the conflicts. question is not clear Pull requests tab, Resolve cnflicts, decide whos
changes, delete markers, mark as resolved,
commit merge
Chennai Photon interactive 19_P 5 What is static and final in java? 5> static and final are the keywords used in java memory is allocated only once for static variable
The main difference between a static and final or method . It is a class variable or method.
keyword is that static is keyword is used to final -> when applied to a variable or method or
define the class member that can be used class, its value cannot be changed. It will be
independently of any object of that class. Final constant
keyword is used to declare, a constant variable, a
method which can not be overridden and a class
that can not be inherited.
Chennai Photon interactive 19_P 6 How will you prevent tge override method in java 6> In java, we know that child class can override use private or static or final modifier to avoid
the parent class methods. so in order to prevent overridding
the overriding in java , we need to make parent
class methods as static or final. why because
static and final methods can not be override.
Chennai Photon interactive 19_P 7 Explain about collections. Not Answered it is a framrwork of classes and interfaces to
make data manipulation easy
Chennai Photon interactive 19_P 8 Cucumber tags and Annotations 8> In Cucumber we use tags to group the similar used to group certain scenarios and run them
type of scenarios just like groups in testng. we together as tags. @tags
use this tags in .feature file above the scenario
or scenarioOutline.
In Cucumber we use variuos types of annotations
which are predefined text, which holds a specific
meaning. It lets the compiler/interpreter know,
what should be done upon execution.
Given −
It describes the pre-requisite for the test to be
executed.
When −
It defines the trigger point for any test scenario
execution.
Then −
Then holds the expected result for the test to be
executed.
And −
t provides the logical AND condition between any
two statements. AND can be used in conjunction
with GIVEN, WHEN and THEN statement.
But −
It signifies logical OR condition between any two
statements. OR can be used in conjunction with
GIVEN, WHEN and THEN statement
Background −
Background generally has the instruction on
what to setup before each scenario runs.
Chennai Photon interactive 19_P 9 How will you pass values in your project? Not Answered by using .properties file, using @dataProvider or
excel using APache POI
Chennai Photon interactive 19_P 10 What is hooks and explain hooks. Not Answered Hooks are like annotations. @Before, @After,
@BeforeStep , @AfterStep
Chennai Photon interactive 19_P 11 What is background?? 11> Background is a cucumber annotation which If multiple scenarios have same GIVEN
is used in .feature file. statements for a feature, they can be added
Background generally has the instruction on unde Background
what to setup before each scenario runs.
Chennai Photon interactive 19_P 12 How will u run the method again and again in testng? 12> we can use invocationCount helper attribute. @DataProvider annotation in TestNG. You can add
This is a TestNG attribute that defines number of multiple tests in testngSuite and execute. Under
times a test method should be invoked or all tests the classes names should be same
executed before executing any other test inorder to execute same script multiple number
method. If invocationCount = 5, then the test of times
method will be executed 5 times before
executing next test method.
Chennai Photon interactive 19_P 13 How the methods run in the order?? we can use priority helper attribute to run the Using priority near ever @Test method starting
methods in order. If we don’t mention any from 0 to later. 0 being highest.and in xml tag we
priority, testng will execute the @Test methods use <suite name=""suite1"">
based on alphabetical order of their method <test name=""test"" preserve-order=""true"">
names irrespective of their place of
implementation in the code.when we assign the
Priority to each test case then the lower priority
value will be executed first.
Chennai Photon interactive 19_P 14 Parallel tests about class method and tests. Not Answered <suite name=""Parallel test suite"" parallel=""
methods"" thread-count=""2"">
Chennai Photon interactive 19_P 15 What is actions class and the methods in actions?? Not Answered actions class for mouse hover actions. methods-
moveToElement, doubleClick, clickAndHold,
Release, DragAndDrop.
Chennai Photon interactive 19_P 16 What is the difference between build and perform? Not Answered Build-> sequence the number of actions. perform
is used to execute one action
Chennai Photon interactive 19_P 17 Difference between find element and find elements and its Not Answered findElement-> first webelement matching the
return type. locator, retunr type is webelement. FindElements
-> list of all webelements matching the locator.
returns the list of webelements.
Chennai Photon interactive 19_P 18 Explain concepts in collections and relate to ur project. Not Answered collections framework-> arraylist, list, set,
hashmap, hashtable, map
Chennai Photon interactive 19_P 19 Consider u have checkbox and I want to click the checkbox Not Answered explicit wait with try catch block
, how will u find the element is present or not at the same
time should not get any exceptions.(element may or may
not present).
Chennai Photon interactive 19_P 20 Attributes of css selector. Not Answered Attributes of css selector.id, name, width: 150px;
display: block;
margin-bottom: 10px;
background-color: yellow;
Chennai Photon interactive 19_P 21 Program to find the found of special character, numbers, Not Answered class Count
capital letter and small letter in a given string. {
public static void main(String args[])
{
String str = ""#GeeKs01fOr@gEEks07"";
int upper = 0, lower = 0, number = 0, special =
0;
Pune Wipro 21_W 1 Write a program that reads objects from property file in 1>we know that in .properties file we store data in
page object model framework. the form of key value pair. Below is the Program
to read the data in .properties file
Bangalore MResult 23_M 1 What's the fastest locator in Selenium? 1> It depends on the element to be identified…
If you are asking about execution time for
different locators then id is the fastest.
If it is a matter of convenience, then you follow
this sequence.
Mostly used is -> id
If id is not unique, then prefer to use name as
locator.
If element is a link with simple text, use link text
or partial link text.
If element is difficult to identify with id, name or
links, then go for Css, xPath..
Bangalore MResult 23_M 2 What does ::(double colon) in sibling xpaths represent?
Bangalore MResult 23_M 3 What's the dependency to read/write excel documents in 3> we need Apache POI Api dependency to
Selenium? read/write excel documents in selenium.
Bangalore MResult 23_M 4 What's the difference between imports and extends? Import is used to import the predefined packages
to the program
extends keyword is used in inheritance to
acquiring the properties of parent class
Bangalore MResult 23_M 5 Why do we use extends when we have imports options ? 5> extends is used to inherit a particular class.
Like rather than importing all classes of package
we need only one class of that package. so we
use extend keyword.Extend is a term of
inheritance.
Bangalore MResult 23_M 6 How to add/remove test cases in Testng.xml? 6> we can use include and exclude tags in
testng.xml to add/remove testcases in testng.
xml.
Lets take an example: if a Class have three Test
Methods. In that we will include two test methods
and try to exclude one test method.
sample testng.xml file looks like:
<!DOCTYPE suite SYSTEM "http://testng.
org/testng-1.0.dtd" >
<suite name="Sample Test Suite" verbose="1" >
<test name="Method Test Cases" >
<classes>
<class name="com.easy.entry.AddTestCase">
<methods>
<include name="testCase1" />
<include name="testCase"2 />
<exclude name="testCase3" />
</methods>
</class>
</classes>
</test>
</suite>
Bangalore MResult 23_M 7 How to add waits in Selenium? 7> we can add implicit wait in selenium using
below code:
driver.manage().timeouts().implicitlyWait(30,
TimeUnit.SECONDS);
to add Explicit wait:
WebDriverWait wait = new WebDriverWait(driver,
30);
wait.until(ExpectedConditions.
visibilityOfElementLocated(By.xpath("//div)]")));
Hyderabad HCL 24_H 1 Move all zeroes to end of array- Given an array of integers, public class ZerosToEndInArray {
Move the all zero's to end of the array. Push all the zero’s
of a given array to the end of the array. // Function to move all zeros present in the
Example 1: INPUT: myArray={2,5,0,4,2,7,0,0,1,9,4} ---OUTPUT: array to the end
myArray={2,5,4,2,7,1,9,4,0,0,0} public static void reorder(int[] A)
{
// k stores index of next available
position
int k = 0;
reorder(A);
System.out.println(Arrays.toString
(A));
}
}
Hyderabad HCL 24_H 2 Print all the duplicate character and their count in the 2> public class PrintDuplicates {
given string.
Example 1: INPUT : String str="hcl-tech" ---OUTPUT :h-2,c-2 public static void main(String[] args) {
// TODO Auto-generated method stub
String input = "hcl-tech";
findDuplicates(input);
}
}
}
Set<Map.Entry<Character,Integer>> set=
map.entrySet();
for(Map.Entry<Character,Integer>entry :
set) {
if(entry.getValue()>1){
System.out.printf("%s : %d %n", entry.
getKey(),entry.getValue());
}
}
}
LOCATION COMPANY ROW ID Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana Shabana Khan
Hyderabad HCL 24_H 3 Reverse a string preserving space positions. INPUT : "Java 3> public class
is a programming language" ---OUTPUT : "egau gn a ReverseStringWithSpacePreserved {
lgnimmargor pasiavaJ"
public static void main(String[] args) {
// TODO Auto-generated method stub
String str= "Java is a Programming Language";
reverse(str);
}
Mumbai Accenture 25_A 1 Can we over load main method in java? 1>Yes, We can overload the main method in java
but JVM only calls the original main method, it
will never call our overloaded main method. So,
to execute overloaded methods of main, we must
call them from the original main method.
Mumbai Accenture 25_A 2 Explain about final class? 2> When a class is declared with final keyword, it
is called a final class. A final class cannot be
extended(inherited).
Mumbai Accenture 25_A 3 Test life cycle 3> Software testing life cycle is a sequence of
different activities which is performed by the
testing team to ensure the quality of the
software.
it is a part of SDLC.
The various phases involved in this cycle are:
Requirement Analysis
Test Planning
Test case development
Test Environment setup
Test Execution
Test Cycle closure
Mumbai Accenture 25_A 4 How to handle drop down using selenium ? 4> Using Select class in Selenium we can handle
drop downs
Select dropdown = new Select(driver.findElement
(By.id("selectDropdown")));
WebDriver provides three ways to select an
option from the drop-down menu.
1. selectByIndex - It is used to select an option
based on its index, beginning with 0.
dropdown.selectByIndex(5);
2. selectByValue - It is used to select an option
based on its 'value' attribute.
dropdown.selectByValue("Database");
3. selectByVisibleText - It is used to select an
option based on the text over the option.
dropdown.selectByVisibleText("Database
Testing");
Mumbai Accenture 25_A 5 Using selenium can we automate desktop application's ? 5> No,Selenium does not have the capability to
automate the desktop applications.It cannot
recognize the objects in a desktop application.
Mumbai Accenture 25_A 6 About vmodel? 6> The V-model is an SDLC model where
execution of processes happens in a sequential
manner in a V-shape.
This model came up in order to overcome the
drawbacks of waterfall model.
Under the V-Model, the corresponding testing
phase of the development phase is planned in
parallel. So, there are Verification phases on one
side of the ‘V’ and Validation phases on the other
side. The Coding Phase joins the two sides of the
V-Model.
Mumbai Accenture 25_A 7 How many locators available in selenium and explain each 7> Locators in selenium are used to identify the
and every one ? webElements on the webpage.
there are 8 types of locators available in
selenium webdriver.
id Locator:
ID’s are unique for each element so it is common
way to locate elements using ID Locator.
Name Locator:
We sometimes use Name locator to identify the
elements on our webpage. Locating elements
using Name is same as locating elements using
ID locator.
XPath Locator:
XPath is designed to allow the navigation of XML
documents, with the purpose of selecting
individual elements, attributes, or some other
part of an XML document for specific processing.
Compare to Css, Xpath is slow.
Hyderabad HCL 26_H 1 Difference between Given and When in cucumber feature 1> Given steps are used to describe the initial
file context of the system.
When steps are used to describe an event, or an
action. This can be a person interacting with the
system, or it can be an event triggered by
another system.
Hyderabad HCL 26_H 2 What is the purpose of Background in feature file 2>Background in Cucumber is used to define a
step or series of steps that are common to all the
tests in the feature file. It allows you to add some
context to the scenarios for a feature where it is
defined.
For example: In a .feature file if all the scenarios
have same Given Step. Then instead of repeating
the same step for all the scenarios we can put
that step under Background.
Hyderabad HCL 26_H 3 Can i give login username and password in And will it work? 3> yes to login username and password we can
give AND.
example:
Scenario:
Given I am on Facebook login page
When I enter username as "TOM"
And I enter password as "JERRY"
Then Login should fail
class ReverseString
{
public static void main(String[] args)
{
String input = "Automation";
Pune Synechrone 27_S 1 Selenium webdriver architecture 1> Selenium WebDriver is a Client Server
Architecture
-In real time, we will write code in Eclipse IDE by
using any one of the supported Selenium client
libraries like Java, C#, Python, Ruby, Perl.
-Once we execute the scripts in Eclipse, the
selenium client library will communicate with
selenium API.
-Selenium API will send the command taken from
language level binding to browser driver with the
help of JSON wired protocol.
-Selenium API sends the request to Browser
Driver, it may be Firefox driver, IE driver, Chrome
driver.
-The browser driver will use the HTTP server for
getting the HTTP request and the HTTP Server
filter out all the commands which need to be
executed.
-Then the commands in your selenium script will
be executed on the browser.
-Finally, HTTP server sends the response back to
the automation test script.
Pune Synechrone 27_S 2 Explain automation framework 2> Explain about
- which framework approach you used
-what type of project you created(Maven or
Gradle)
-which technology you use(like java)
-Different folder structure you used
-what you used for reporting
-what you used to fetch data from excel or other
data files
-how you create the logs
-which CI tools you used
-which Bug reporting tool you used
-what are different dependencies you added
Pune Synechrone 27_S 3 Why Testng is used if there is cucumber used in your 3> for Parallel execution
framework
Pune Synechrone 27_S 4 Java program to find word count from the given string 4> we can use split() function which is available in
String s= "my name is umesh"; String class
Pune Synechrone 27_S 5 Which catch block will get execute first. 5> it will execute first catch block with generic
There are two catch blocks in first catch block have exception.
exception e and second catch block have arithmetic If an exception occurs in try block then the
expections and will expect arithmetic exception in try control of execution is passed to the
block then which catch block will get execute first? corresponding catch block. A single try block can
have multiple catch blocks associated with it,
you should place the catch blocks in such a way
that the generic exception handler catch block is
at the last.
The generic exception handler can handle all the
exceptions but you should place is at the end, if
you place it at the before all the catch blocks
then it will display the generic message. You
always want to give the user a meaningful
message for each type of exception rather then
a generic message.
ex: Right way to use Generic exception in java
code
class Example1{
public static void main(String args[]){
try{
int a[]=new int[7];
a[4]=30/0;
System.out.println("First print statement in
try block");
}
catch(ArithmeticException e){
System.out.println("Warning:
ArithmeticException");
}
catch(ArrayIndexOutOfBoundsException e){
System.out.println("Warning:
ArrayIndexOutOfBoundsException");
}
catch(Exception e){
System.out.println("Warning: Some Other
exception");
}
System.out.println("Out of try-catch block...");
}
}
Pune Synechrone 27_S 6 6. String s1= "hello"; String s2="hello";
If(s1==s2) then tell me if it's true or false.
Pune Synechrone 27_S 7 String s ="hello"; s.concate("world"); 7> output : hello
What is the output? we know that In java, string objects are
immutable. Immutable simply means
unmodifiable or unchangeable.
Once string object is created its data or state
can't be changed but a new string object is
created.
Hyderabad Tessla 28_T 1 What do you mean by Enumeration in implicit wait? 1> Enumeration or Enum in Java is a data type
which contains a fixed set of constants.The Java
enum constants are static and final implicitly.
In implicit wait, TimeUnit is an Enum which
belongs to the package java.util.concurrent and
enumeration constants used in implicit wait are:
TimeUnit.DAYS
Time unit representing twenty four hours
TimeUnit.HOURS
Time unit representing sixty minutes
TimeUnit.MICROSECONDS
Time unit representing one thousandth of a
millisecond
TimeUnit.MILLISECONDS
Time unit representing one thousandth of a
second
TimeUnit.MINUTES
Time unit representing sixty seconds
TimeUnit.NANOSECONDS
Time unit representing one thousandth of a
microsecond
TimeUnit.SECONDS
Time unit representing one second
Hyderabad Tessla 28_T 2 Give example for Run time polymorphism? 2> Run Time Polymorphism / Dynamic
Polymorphism is also known as Method
Overriding.
Method overriding is a process where a method
in the child class has the same name and the
same parameters as that of the method in its
base class.
Hyderabad Tessla 28_T 3 Fluent wait? 3> Fluent wait is one of the wait available in
selenium webdriver and it same as explicit wait
but the only difference is it checks whether the
condition is satisfied and continues as per the
frequency.
// Waiting 30 seconds for an element to be
present on the page, checking
// for its presence once every 5 seconds.
Wait<WebDriver> wait = new
FluentWait<WebDriver>(driver)
.withTimeout(30, SECONDS)
.pollingEvery(5, SECONDS)
.ignoring(NoSuchElementException.class);
Bangalore Blume Global 29_B 1 Explain Bug life cycle 1> Bug life cycle:
Hyderabad Inspire infosol 30_I 1 How can you handle if application is opening in seperate
tab in same browser
LOCATION COMPANY ROW ID Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana Shabana Khan
Bangalore FIS global 31_F 1 Explain about project and work experience. 1> given the ans above
Bangalore FIS global 31_F 2 Explain about the usage of Jira ? How add testcases and 2> we can use Jira for both test Management and
defects? defect tracking.
In Jira, we will be create test cases as issues,
first we need to add a new issue type to your Jira
account.
where we give the below details
issue type, summary, description, reporter,
steps to complete, expected outcome
Bangalore FIS global 31_F 3 Worked on any other defect tracking tool? Do you know 1> given the ans above
about Hp ALM?If explain
Bangalore FIS global 31_F 4 Explain about the framework used in your project 4> given the ans above
Bangalore FIS global 31_F 5 How do read data in data drivern framework? Write a we use Apache POI api's to read the data in data
program to read data from Excel sheet driven framework if the data is stored in excels
if the data is stored in databases then we use
JDBC driver api's.
code to read data from excel:
String FilePath = "d://filepath.xls";
FileInputStream fs = new FileInputStream
(FilePath);
Workbook wb = Workbook.getWorkbook(fs);
Or You can also directly send the file as below
Sheet sh = wb.getSheet(1);
You can also get the sheet access by sheet
name, you should specify as below:
Sheet sh = wb.getSheet("sheet1");
Now we will get the content in particular location,
which will return contents as a string
System.out.println(sh.getCell(0,0).getContents());
There is an other style to get the cell contents as
below:
temp=n;
while(n>0){
r=n%10; //getting remainder
sum=(sum*10)+r;
n=n/10;
}
if(temp==sum)
System.out.println("palindrome number ");
else
System.out.println("not palindrome");
}
}
Bangalore FIS global 31_F 7 Explain how to get the 5 th child window. To switch between windows
Bangalore FIS global 31_F 9 Difference between API and webservices 9> APIs and Web Services both serve as
platforms for interactions between systems or
applications
a) Web services are a type of API, which must be
accessed through a network connection.
APIs are application interfaces, implying that one
application can communicate with another
application in a standardized manner.
b) Web service is used for REST, SOAP and XML-
RPC for communication.
API is used for any style of communication.
c)All Web services are APIs.
APIs are not web services.
d)Web services doesn’t have lightweight design,
needs a SOAP convention to send or receive data
over the system.
API has a light-weight architecture furthermore,
useful for gadgets which have constrained
transmission capacity like smart phones.
e) WebService provides supports only for the
HTTP protocol.
API provides support for the HTTP/s protocol: URL
Request/Response Headers, and so on.
d)Web service supports only XML.
API supports XML and JSON.
Bangalore FIS global 31_F 10 How did you write testcase using soap UI for API testing 12> @BeforeSuite
@BeforeGroups
@BeforeTest
@BeforeClass
@BeforeMethod
@Test
@AfterMethod
@AfterClass
@AfterTest
@AfterGroups
@AfterSuite
Bangalore FIS global 31_F 11 Do you know about testing framework ? Write an XML to run 11> List of API Methods are
scripts?list of API methods GET
POST
PUT
HEAD
DELETE
PATCH
OPTIONS
Testng xml to run all scripts:
SFO, USA Roberthalf 32_R 32 How do you automate localization testing -diff languages
in UI What are the tools used and how did you do
TX, USA personal Intrest and interview 33_P 33 I am getting the below error in eclipse and could not able
preparation to run any class.
Error: Could not find or load main class learning_Java.
Callbyvalueandcallbyref
Caused by: java.lang.ClassNotFoundException:
learning_Java.Callbyvalueandcallbyref
LOCATION COMPANY ROW ID Q.NO. QUESTION Raj Angeline J Deepthi krishna Parimaladevi Palanichamy Pratibha Rajkumar Rinku Sachin Bisth Shashi Kumar Sruajna M Sucheta Ranade Vijaya Yanala Rupa Basuthkar Gaurav Makwana
SFO, USA Roberthalf 32_R 32 How do you automate localization testing -diff languages
in UI What are the tools used and how did you do
TX, USA personal Intrest and interview 33_P 33 I am getting the below error in eclipse and could not able
preparation to run any class.
Error: Could not find or load main class learning_Java.
Callbyvalueandcallbyref
Caused by: java.lang.ClassNotFoundException:
learning_Java.Callbyvalueandcallbyref