Software Testing Interview Preparation Questions Answers
Software Testing Interview Preparation Questions Answers
INTERVIEW PREPARATION
QUESTIONS ANSWERS
Page | 1
SOFTWARE TESTING INTERVIEW PREPARATION QUESTIONS ANSWERS
1.SOFTWARE TESTING
2.AGILE
7.SQL QUERIES
8.POSTMAN
9.API TESTING
10.GIT
11.JENKINS
14.CUCUMBER
15.MAVEN
16.CORE JAVA
17.OOPS
18.TESTNG
19.SELENIUM
20.APPIUM
21.SIKULI
Page | 2
1) Why do you want to pursue your career in the field of software testing?
Answer: Based on my research, it is compulsory for any product to be of good quality to sustain
in a market. To gain satisfaction and confidence in the quality of services or products, from the
end-user, we must verify that product behaves as expected and outperforms the desired quality
standards. To gain excellence and value for money spent, we should offer the best quality
products and services to our clients. I strongly believe that software testing decides the measure
of product quality and performance.
As I always look for quality rather than features rich product, that do not perform as expected.
that is the main reason why I decided to pursue in the software testing domain.
2) Please explain your nature, habits, or likes that you think you are the right candidate for
the testing?
Answer: From my childhood, I was curious about how things work, I used to ask many
questions to my parents on why, how, and what about the things. During my school and college
days, I was debating on many topics, reading books, and searching libraries and the internet to
understand and find out reasons and answers to many of my questions. I used to visit my mentors
often to know and discuss my queries. Based on my knowledge seeking nature and desire for
perfection, I think I am right candidate for software testing
Page | 3
Features provided in software offer results as expected,
System securely display output as quickly as possible.
Software features should display same output and behave as expected every repeated instance
of running it.
The software can be tested manually by testers or can run automatically using a script and follow
steps that tester execute to test the application.
5) What are the features you check before you purchase the mobile?
Answer: Priority will be the price of a mobile, but various features to check before we make our
choice for our dream mobile will be
Display – Screen size, resolution, browser support, movable keypad, reliable network
connectivity.
Storage – capacity to store large files, images, documents, downloaded programs
Battery – long-lasting and quick charging batteries that should be easily available in market.
Processing power – for remote work situations should able to process designing graphical
images, presentation, comfortable keypad, file sharing options.
Ease of use – for elderly or novice, helpful settings, and configuration.
Camera– with high-quality picture, zoom effects, large pixel resolution.
Accessories should include the charger, battery, handsfree and screen guard
The warranty should include any online help in case of difficulty to use mobile, repair of mobile
due to hardware fault or replacement of mobile set.
Page | 4
8) Can you write possible test cases for a pencil?
Answer: Following are possible test cases for pencil
1. Check the length of a pencil, strength of the outer wooden body,
2. Check thickness and resilience of graphite material (one type of crystaline carbon black in
colour )
3. Check readability after writing text using pencil
4. Check if written on different types of paper, cloth, or wood.
5. Check how many meters can be written with the available graphite material in single pencil.
6. Check the written text on paper is erasable with a normal rubber eraser.
7. Check if a normal sharpener can sharpen the pencil or not
8. Check if you can write after graphite is dipped in water, oil or dust.
9. Check if the name of the company written has correct spelling printed on pencil or not.
10. Check if graphite are not broken already or brittle.
Page | 5
Test Data is the valid values that are fed to an application as inputs while running an application
in order to test it. It is mandatory to design valid test data as per the scenario that results in
expected output. In case the actual output differs from the expected output, the deviation is
reported as a bug in the defect management system.
Test Environment is a system configured that mimick or match to system specifications at the
client, in order to run software on this system to verify how the system at client behave for the
tests and use cases.
11) What is required for the tester to know before testing software applications?
Answer: In order to test, a tester should first understand
The requirements and output expected by using a software application and from software
requirement document approved by the customer and project owner
How software works, domain knowledge (software used in specific discipline or field such as
e-commerce, Banking, Insurance, Enterprise Resources planning, Gaming, Education or
training, or Search-based application)
whether the software is desktop based or web based
what are the features and its functionality,
How many input forms to be filled in, What are the input fields and their valid values,
How user interface elements like text field, radio button, checkbox, drop-down list, buttons
and their types (submit, reset, cancel) functions.
What to expect in an output form.
Working of computer, types of networks.
In case of desktop application, what technology is used in developing a software
How to install the software?
What technology is used in building user interface? (HTML, XHTML, JSP, ASP, Javascript,
VBScript, JQuery)
Where reference data gets stored, where data for analysis will be uploaded and then
processed
What database type is used to store data?
Page | 6
they are designed for. Desktop applications are designed to run on standalone machine, by single
user. Multiple users can access the printer, scanners if they are LAN connected with desktop
applications.
Some examples of desktop application are Windows file explorer – to access files stored on hard
drive of local machine, Microsoft’s office applications such as word, excel, PowerPoint to write
and access documents, generate tabular reports on finance and design presentations, Web
browsers to access websites and searching information on the internet.
Page | 7
compatibility tests for browsers used,
performance to test latency (time taken to access pages), delay in opening next pages or
output, and
security testing for verifying login for authentication.
Page | 8
Performance defects – If latency (delay in displaying page) is too high, If server crashes during
multiuser access, these are examples of performance defect. This can affect adversely and user
will not return back to website.
19) What is expected from the testing team on testing a software application?
Answer: It is expected while testing a software, tester should reveal all the defects and
deviations from requirements, while running an application such that it should break. Tester
should understand domain knowledge, able to design actual scenarios, conditions that are not
thought of and not handled by developer, able to configure specifications and preconditions to
verify how application performs. Have analytical knowledge and logical thinking; think out of
box while testing software.
Page | 9
22) What is smoke testing?
Answer: When software build is released, tester conducts primary tests like all the menus and
submenus are clickable, and display the corresponding page, tester make sure that modules and
feature are present in application, and there is absence of ‘Page Not found’ message while
accessing any page, Forms and Pages have all usable web elements and display stable pages.
example, drop down list in all the input form does not display items for user to select, due to any
reason, this if found during the smoke test, then tester will stop testing and can reject the build by
informing the short coming to development team.
Page | 10
example – Booking air tickets using ticketing portals like goibibo.com, where ticket is booked
using web service of the airlines showing flight time, destinations, availability of seats and fare
to travel to destination from starting point.
Page | 11
example – during amazon festive season sale, subjected to overload when users multifold times
than expected will access the portal and book a newly arrived mobile, there by website server
may fail to handle such an heavy load.
Page | 12
38) What is Compliance testing?
Answer: Compliance testing is a non-functional test that validates that the software designed
meets all the prescribed standards as described in requirement document. for example Vehicles
in North America are made according to Canadian Environmental Protection Act 1999 (CEPA
1999), under this act Environment Canada has an authority to regulate emission from on-road
engines.
Page | 13
Expected Result – what is expected from the feature being tested e.g. welcome page with
menus of other features should be displayed after user successfully logged in to the
application.
Actual Result- what is actual output or result after testing application, this is to be filled in by
tester
Status – If there is difference between actual and expected result test will fail, else test will
pass
Remarks – In case test fails, bug report details can be mentioned here.
Page | 14
Answer: Test scenario is functionality or feature that can be tested. It also provides high level
idea of what need to be tested, in order to create scenario we need set of test cases where we can
understand features of application and any short comings of application.
Page | 15
52) What is black box testing?
Answer: When we test application without worrying or having knowledge about details of
implementation, how internal code structure applied to software to achieve required output. it is
called black box testing. This type of testing is carried out mainly by testers. Some of the testing
techniques for black box testing are Equivalence Partitioning, Boundary Value Analysis, and
Cause Effect Testing.
Page | 16
57) What is Top Down Approach?
Answer: Top Down Approach of testing is breaking down complex module into smaller portions
till it becomes easy for assessment.
Example – Top management forms rules for organization, middle level management and lower
level employees has to follow the rules enforced.
Page | 17
such as unit test, integration tests, GUI tests, localization tests, usability tests, regression tests,
system tests.
Example: on clicking print button, a pop menu should display showing existing page and print
configuration window, with print button. On clicking on print button, contents such as text,
images or spreadsheets on selected page should be sent for printing.
Page | 18
iv) State Transition
v) Error Guessing
So there will be 3 possible scenarios where only one valid group of applicant having age is
between 18 to 49 years, will get driving license.
Page | 19
minimum i.e. 18 years, minimum +1 i.e. 19 years, maximum -1 i.e. 48 years, and maximum i.e.
49 years
i) Vijay Sales
iii) Croma
iv) Amazon
Page | 20
Have Item in your budget?
‘Open’ bugs when resolved by developer its status becomes ‘Fixed’, once the bugs are fixed and
build is retested for regression testing, defect is verified, if defect is not resolved, bug will be
‘Reopen’, which will be reassigned to the developer for fixing. if defect is resolved and
confirmed by tester then Bug status will be ‘Closed’.
Page | 21
Page | 22
71) What is Defect severity?
Answer: Severity of bug is an extreme level of damage like financial loss, company’s reputation
and loss of life, due to presence of the bug. example such as if point of sales machine does not
function as expected, and does not dispense bill, thereby customer may not pay the amount for
the purchases, in such situation, the defect due to which bills are not displaying amount of
purchase, is termed as severe test case, as due to such defect, there will be huge financial loss.
further say, infrared machine that used for removing decay in the teeth malfunction and damages
the jaw of patient, it may result into loss of life.
Defect severity are categorized into following levels
Blocker – Due to this defect type, it becomes impossible to further run the application, there for
the name – Blocker
Critical – There are some workarounds to accomplish the task, e.g. pdf format of file type is not
downloaded, where as word type is possible.
Major – some error may lead to understanding the title or content by end user, e.g. software
displays title and content in English, but does not display some of the title in Arabic language,
but display it in English only.
Page | 23
Minor – there are some defects which has very minor impact on functionality of application, e.g.
missing space between words, commas are missed in sentences.
Low -These defects does not impact at all, however if fixed it will be aesthetically pleasing, eg.
size of button, form border go out of screen and need to scroll in order to view the content.
Urgent – this must be fixed immediately e.g. payment gateway pages not displaying, or
confirmance of order processed not sent via email or sms, or transaction records not printed in
account details in banking software.
High – this should be resolved in subsequent releases, e.g. presentation or video does not have
company logo or has written content, but does not have voice that narates above content.
Medium – should be fixed based on the level of severity- eg. error occuring while user updates
his mobile number, while communication has options such as his email and mobile.
Low – May or may not be fixed e.g. spelling or grammar mistake in introductory page of portal,
as long as meaning is conveyed to the audience.
Page | 24
75) What is Quality assessment measurement?
Answer: It is a analysis to observe deviation between actual performance and expected
performance. Basis of assessment is an improvement in actual performance, whether new
hardware, or additional storage capacity or memory improvement or line of code that does not
consume processing power, but quickly display output.
Page | 25
Answer: There is a measure of process capability calculated using specification limits and
standard deviation of the process, which is Cp index. Most companies require Process Cp = 1.33
or greater.
Page | 26
82) What is Requirement Specification Document?
Answer: Document approved by customers and project owners that describe, what is expected
from the software to perform, how many features and functionality, what is requirement (what to
verify/validate). In short, Software requirement specification document has a purpose for
software to be built, description of software to accomplish and requirement in specific required
to fulfill using the software.
83) What documents will you refer to understand about features in the software?
Answer: In order to understand features and their functionality we refer requirement document
(SRS).
In order to understand overview of data flow, integration between systems, we should refer
design document, For understanding documentation on code, algorithms, interfaces and APIs
used in software technical documents or process documentation containing UML diagrams, How
end user will use the software we can find from user manual, and finally how to install the
software can be found from installation guide of the software.
86) Give few examples of sensitive information can be shared across network?
Answer: There are many incidents where we unknowingly share our information across network;
they are our email address- we may receive spam messages i.e messages for which we have not
granted permission to receive. they may contain, files attached that if opened may contain virus,
or may have damaging software. Our mobile number is second confidential information, we may
receive calls from persons we don’t know, they may harass us by calling at any time, demanding
donations, or try to send sms messages, may use our email and mobile number against our
knowledge in criminal and unlawful activities. Our credit card details like 16 digits number, pin
number – this will drain our all the money from our account and we will be unaware until
collection agencies knock our doors, or we receive the withdrawal notice via mail or mobile
Page | 27
number. Our pictures or anything that may be used against our self esteem over Social media
platform like Facebook or Instagram are sensitive information.
89) Give some examples of use of Java applets used in your application
Answer: Java applets were used to select local files from client machine in order to process them,
HTTP protocol sends these files over to server location.
Page | 28
stop() – stop() method is called by browser or appletviewer to suspect execution of applet
destroy() – destroy() method is called once before browser unloads the applet.
Page | 29
Java compiler Javac converts .java file into .class files which contain bytecode, (Java Virtual
Machine) JVM converts bytecode into machine language. JVM is platform dependent, there are
different JVM for different OS, Bytecode converted into machine language for particular
machine, executes depending on its kernel. Without JVM you cannot run Java Applications.
Compilers scans entire program and then converts it as a whole into machine language, takes
more time analyzing source code, however it is faster than interpreter, generates intermediate
object code hence takes more memory.
Page | 30
102) Can you explain Hibernate framework?
Answer: Hibernate is Object Relational Mapping tool (ORM) that simplifies java application
development and interacts with database. It implements Java Persistence API for data
persistence.
103) A type of testing in order to expose defects in the interfaces and in the interaction
between integrated components is?
Answer: Integration Level Testing
104) Identify type of testing wherein we subject the target of the test, to varying workloads
to measure and evaluate the performance behaviors and the ability of the target and the
test to continue to function properly under these different workloads?
Answer: Load Testing
Page | 31
6. HDMI for viewing Television with TV tuner if you want to view it over your computer,
7. SD slot – SD card in case you want to keep your pictures, process these photos etc. you may
need them, with extra price.
8. Wi Fi – In case you want to connect your pc with wifi for internet or wifi enabled speakers
9. Bluetooth – In case you are looking for connecting various appliances using Bluetooth.
10. What Operating System Mac OS, Windows or Linux – What operating system you are
comfortable using your computer in, type of software loaded, remote work like tech support
will only require Linux operating system, where as windows may be helpful for various User
friendly applications, but may get virus if not protected with antivirus software.
11. Play Game, or watch movies or Search internet? What is your purpose of purchasing will
matter on how much you should spend after it.
Retesting is a testing to make sure that previously failed test cases due to defect are passed and
the defect has been resolved. The test cases involved in retesting focus only on the failed test
cases due to the defect or the scenarios or steps followed result in failed functionality. It is better
to carry out manual testing in case of retesting to make sure that defect has actually been
resolved.
Page | 32
108) What are Unit testing techniques?
Answer: The various unit testing techniques are listed below
Statement Coverage
Decision Coverage
Branch Coverage
Condition Coverage
Control Flow
Data Flow
109) How do you decide which test cases to consider for Regression Testing?
Answer: selection of test cases for regression testing for the build received from release, should
based on following scenario priority for testing those test cases that were failed due to defect, on
testing if they are passed. All integration tests, boundary value scenarios, testing functionality of
components related to defect, end to end tests that involve change request or resolved test cases
after release, should be considered for regression.
Integration testing is testing of interconnected units and their interfaces, the data flow between
these units and to make sure that feature is working as per expected. it is carried out after unit
testing. Various test approach like top down, bottom up or hybrid integration are carried out
during testing.
Page | 33
111) What are the various contents of a Test Plan?
Answer: Test plan document should include following details
Features to be tested
Features not to be tested
Approach like should we test manually, automated scripts, test techniques (white,black or
grey box)
Criteria for Failed tests / pass tests
What condition for suspending test activities
Test environment such as hardware, software, network etc.
Man hours estimated while testing
specific training required, Risks involved, any assumptions or dependencies
Horizontal prototype
Vertical prototype
Throwaway prototype
Evolutionary prototype
Incremental prototype
Extreme prototype
Page | 34
114) What are SDLC phases?
Answer: The Software Development Life Cycle consists of following phases
Requirement Gathering and Analysis
Design
Coding
Testing
Deployment
Support
Page | 35
118) What are key challenges while testing a software application?
Answer: Some of the challenges of testing a software applications are listed below
Test entire application – It is virtually impossible to test and verify entire application with
each and every scenario. Even one of the seven principles of software testing says,
“Exhaustive Testing is Not Possible”.
Relationship with developers: Tester’s responsibility to check for any defects in the software
and how to break an application, it becomes tough to keep amicable relationship with
developers
Regression testing: In every build released from developer, tester has to check entire
application for end to end functionality every time along with resolved defect and
components or units that are integrated that may get affected due to change request or
resolved defect.
Testing always under time constraint: All the stack holders keep an eye on how the built has
came out, testers has to quickly start testing the build with sanity test, smoke test and
regression tests as send their observations as soon as possible.
Which tests to execute first? – Based on available timeline, and complexity of modules, test
lead has to distribute testing like user interface or feature testing using script automatically
and regression and integration tests manually. Non functional testing using tools like load
runner, API testing using Postman or REST assured. Regression tests using selenium and
mobile testing using Appium.
Understanding the requirements: There should be a walkthrough and review of software,
domain knowledge, how to test features etc. is mandatory for each member of tester.
Decision to stop the testing: Testing manager should explain testers when should testing be
stopped, based on what critical bugs should get resolved, any blockers affecting feature
pending by developers.
Page | 36
120) What is the advantage of using any bug tracking tool?
Answer: Main objective for using bug tracking tool is to deliver high quality software product by
keeping track of defect discovered and track these defects till it gets resolved, Improve Return on
Investment (ROI) by reducing cost of development, when quality product is developed, so that it
will have more reliable quality product, satisfied customers with long loyalty. Product and
Project team can keep a track of detect Issues Earlier and understand defect trends in ongoing
software development.
Better Communication, Teamwork and connectivity amongst stack holders about software
quality.
Page | 37
125) What is the difference between Web application and Client Server Application?
Answer: Client Server application is distributed on at least two systems, Client and Server where
client has visual pages like input forms, validation for valid data before sending requests to
server and output pages as response from server. Server has all business logic, database storage
where request received from client machines are responded back after processing through logic
and database tables, procedures. Client Server applications require LAN connection and
Database Drivers so that they are connected whenever request is sent for response. Some
examples are ATM machine, Banking software, and Stock Trading etc.
Web application are built in one server with all front end files, back end and processing logic
placed on single web server, various technologies such as HTML or ASP with Javascript or JS
libraries are used for front end design, where as back end storage and processing is done on
server in class files and DB procedures and tables. web application are accessed using web
browser, hence it require internet in addition to web application files placed on web server.
examples of web applications are Amazon, Flipkart and Snapdeal online portal, Gmail, Saavn
online music streaming services
127) What is difference between Black box testing and White box testing?
Answer: In case of White box testing it is mandatory to know internals of software applications,
such as structure, program functions, implementation of how data flows between components.
The tests covers white box testing are unit testing and integration testing. These tests are
performed by developers, and it is mandatory to know programming and implementation
knowledge, the test is based on design document provided by design team. Various testing
techniques used in White box testing are Statement Coverage, Branch coverage, decision
coverage, path coverage.
Black box testing does not need any understanding about internal structure of application, the
tests coveres black box testing are system and acceptance testing, testing is based on requirement
document received from product team. Various testing techniques used in Black box testing are
Equivalence partitioning, Boundary value analysis, Decision table testing, and Error Guessing.
Page | 38
128) What is the difference between Authentication and Authorization give an example.
Answer: Authentication is verify logged in user’s genuineness, in real world you were required
to show photo identity documents such as Aadhar card, Driving licence, PAN card or Passport in
order to receive documents addressed to you from courier, know your account balance at your
bank.
whereas authorization is verifies what module access rights the logged in user has. real life
examples are You are allowed to explore feature of an application based on your trial period,
once you become registered user by paying the registration fees, you can access more features of
the software.
129) Other than functionality what else you should test in Web Application?
Answer: In addition to functionality and feature testing, we should test browser compatibility,
security tests for authentication and authorization rights, latency – how long it takes to load a
web page, or request to come back as a response, load testing based on number of users logged in
during peak hours, and scalability testing.
Page | 39
133) Can you name some of Relational database?
Answer: some examples of relational databases are sqlserver, oracle, mysql, IBM DB2,
postgreSQL.
Page | 40
141) How do you test Cookies?
Answer: cookies are small text files that contain web visitor information such as websites
explored, pages visited, visitor’s ip address to identify already visited user. There are various
types of cookies,
Session cookies – user navigating websites actively, once they leave particular site, session
cookie disappears.
Tracking cookies – are used to keep record of multiple visits that was made to same particular
web site.
Authentication cookies – whether a a valid registered user has logged in again and if so with
what name?
Page | 41
146) What is Primary key and Foreign key?
Answer: Primary key is a type of constraint applied on particular column values in order to
uniquely identify a record (row) in the table. A column value should be unique (can not repeat),
and can not hold null values.There can only be single primary key per database table.
Foreign key is a type of constraint applied on the column value which already exist as a column
in another table with primary key constraint applied on. Foreign key value can accept multiple
null values. there can be multiple foreign key in single database table.
Page | 42
manager, collegue or developer or some process. You can explain situation however, but should
end your statement explaining how you were successful in controlling the situation.
152) Realizing you won’t be able to test everything – how do you decide what to test first?
Answer: There are a situation where testing a new build is allotted a bare minimum time, or you
are given several tasks or projects to look into. In such case, where you can not able to
completely cover all the scenarios of testing, you can focus on main functionality and features
released and check if any critical or blocking defect should not be present in an application
during regression tests. Usability, functionality, security, performance are few testing that should
be carried out either using scripts automatically or test manually.
Page | 43
156) What is Traceability Matrix & Coverage Matrix?
Answer: Traceability Matrix & Coverage Matrix is a document that is mapped with software
requirement documents and test case or scenarios all in single document. The purpose of such
document will ensure that the entire requirements have been covered by test cases and there is no
feature or functionality that has been left unchecked.
160) Where Exit and Entry Criteria are written in Test Plan?
Answer: Entry criteria are written document without referring to which one cannot begin any of
the SDLC phases. In order to begin SDLC phase Requirement document and complete flow
diagram of the application as well as Test Plan should be ready and available. An exit criterion is
the detailed document that decides moving from current phase of SDLC to the next phase. In
order to exit SDLC phases test cases should be written and reviewed, test data has been
identified and ready to use, scripts for automate the execution of test cases must be ready.
Page | 44
Answer: In order to verify email address, the front end tester should consider following criteria
Email address may contain alphanumeric characters as initial portion,
special character allowed are dot (.), underscore (_), in initial portion,
there should only be single @ symbol separating local part and domain
Domain name may end separating dot (.) with net, org, com and edu as well as country
specific characters eg. in for india, ca for canada.
WHERE condition;
163) If there is mistake in company Logo, what is Priority and Severity Justify your
answer?
Answer: Mistake in company logo on a product, does not impact its functionality or working, as
well as buying or selling activities of product, the defect has low severity. But, this defect will
impact greatly brand identity and impact how user will interact or may take as duplicate product,
hence such defect is of high priority.
Page | 45
166) Explain error guessing with an example.
Answer: Based on testing experience, testers design their test cases or scenarios, such method or
tests which are exploratory in nature, in order to locate defect in software, are called error
guessing.
169) What are Session and Cookies and what is difference between them?
Answer: Cookies and Sessions are small text files that store information.
Cookies Sessions
Cookie expires based on lifetime set by user Session ends when user closes web browser.
As HTTP is stateless protocol, cookies track Sessions store important information such as user id
application state using small text files on user’s on the server and are used to pass data values from
computer i.e. client. one page to another.
Page | 46
170)What is Mutation testing?
Answer: Mutation testing is white box testing usually conducted in unit testing level, by
changing few statements in source code and validate using debugger. objective of mutation
testing is to assess test case quality based on fault based test strategy that fails mutant code while
debugging.
You can learn more about exploratory testing please visit https://www.qafox.com/importance-of-
exploratory-testing/
172) Difference between HTTP and HTTPS, Explain how the data is secured in HTTPS?
Answer: HTTP is short for Hypertext Transfer Protocol, when you enter http:// in your browser,
you inform browser to allow connection via http protocol which is TCP (transmission control
protocol), in order to send and receive data packets over the web.
HTTPS is short for Hypertext Transfer Protocol Secure, when you enter http:// in your browser,
you inform browser to allow connection via http protocol over secured connection encrypted by
transport layer security.
Page | 47
173) Have you heard of Agile Methodology? Explain?
Answer: Agile is a process or a framework where a small team develops and tests customer
requirement assigned to them in their order of priorities to be accomplished in the small interval
in agreement with client representative from the team.
To learn more about Agile terminologies please visit https://www.qafox.com/agile-environment-
and-terminologies/
Page | 48
179) Have you used any Configuration Management tool?
Answer: I have assisted DevOps team occasionally and have used Chef and Puppet tools for
Configuration Management of their infrastructure.
You need to retest the portion of application where defect was fixed. This may be a portion of
tests in regression testing. Experience says, it is safe to do regression after retesting as to make
sure that other portions of software are intact and not affected after defect fix.
Page | 49
Answer: The software build is application compiled and integrated in order to get tested by
software testers. Release is deploying software with new version deployed to the customer, it has
additional features that were absent in previous release, and change request requested by
customers using previous release.
To make sure that application or software can be used by a disabled individual with ease,
To verify that the software is in compliance with the laws formed over requirements for
accessing software by disabled individuals.
Page | 50
To make sure that there is no legal action against the software provider in the future
188) How can you make your software ready for accessibility?
Answer: Screen Readers like JAWS, NVDA, VoiceOver, Window-Eyes, and Digital voice
recorders of brands like EVISTR, OLYMPUS WS-852, Zoom, Tascam and SONY can be
integrated with software to add accessibility feature for disabled individuals
To learn more about accessibility testing visit https://www.qafox.com/importance-of-
accessibility-testing-for-disabled/
189)What is Jenkins?
Answer: Jenkins is an open source automation tool that help devops to automate build, test and
deploy, integration and delivery of software, whenever multiple developer tries to commit his/her
source code and code is built, build status will be notified to developers such as which commit
has defect in case, next when the build is deployed over to test server any integration issue if any
will be reported to developer for any drawback or failed build. Jenkins a tool that automates
Continuous Integration, Deployment, feedback to developers, defect in build can be resolved
immediately.
Page | 51
Answer: Retail banks provide liquidity, an amount of money for spending and investment in
form of treasury bills(currency). In addition to save and invest individual and their families
finances, offer credit (loans) to purchase homes, cars, and other expenses. They also offer credit
cards based on their repayment history. debit card so that people can withdraw cash from ATM
machines, or shop groceries, clothing or things of need at point of sales using debit or credit
cards and cash management such as demand draft, ECS, RTGS/NEFT, cheques payment.
Page | 52
198) What do you mean by protocol?
Answer: Protocols are set of rules or procedures that are already agreed by the software industry,
for transmission of data between resistors, capacitors, inductors, diodes, and transistors of
electronic devices like desktop, laptop computers, mobile phones, printers, electronic devices
like digital cameras, DVD players, smart televisions etc
Page | 53
Answer: Defect cascading is defects that are encountered by software testers, which further
uncover another defect in the system while integration testing takes place. In order to locate
defects that are primary this may further realize other defects in the application.
203) Give some Test Management Tools you are aware of.
Answer: TestRail, Zephyr,TestFlo, JIRA, TestComplete, and TestLink are some of the industry
recognized test management tools.
206) Have you worked on SQL query? What you have done?
Answer: Yes, I have worked on SQL select commands where I queried on the database tables to
view and compare records present in tables and that displayed on application’s output.
208) What are tools used in software industry for API testing?
Answer: Some of the industry famous API testing tools are
Page | 54
SOAPUI
Postman
REST Assured
Select -‘Configure System’ by clicking on it. Configuration page will open. You can check
menus, ‘Maven Info Plugin Configuration’. In Maven Info Plugin Configuration click on the
checkbox that reads “This project is parameterized”. You will get ‘Add Parameter’ drop down.
Where in you will get a window with title ‘file parameter’, where file location should be copied
and click on Save button. There is another option known as ‘Build with Parameters’ , click it to
find location of file entered along with Choose file button, clicking this will allow you to select
local file to be selected for uploading. You should click Build button to build with uploaded file.
211) Have you worked on SQL query? What you have done?
Answer: SQL query are english like statements used to access and manipulating database. You
can create new databases, create views in database, set permissions on tables, procedures, views,
create new tables, update table with constraints, insert, view, modify or delete records in tables,
execute queries against a database tables.
Page | 55
213) If there are same multiple entry in the table, how to find Unique element in the table?
Answer: Using ‘Distinct’ keyword in sql statement make sure displaying unique value in the
table. eg. select distinct (state) from customers.
215) How to find any particular date of joining of employee from Employees table, date is
in number format then how to change it to date format?
Answer: The Date of employee joining an organization is in number format, say 01/02/2001, It
can be converted into date format DD/MM/YYYY as follows
TO_CHAR (TO_DATE(‘01022001′,’DD/MM/YYYY’), ‘DD/MM/YYYY’)
217) Arrange the following testing types in sequence in which we test any application
Functional Smoke Integration System Sanity Retesting Regression
Answer: Following is the order in which respective tests are carried out during STLC.
Smoke à Sanity à Integration à System à Functional à Retesting à Regression
Page | 56
218) List Name of HTTP methods for RESTful services
Answer: The HTTP methods used for RESTful services are POST, GET, PUT, PATCH, and
DELETE.
Page | 57
guide for different operating system can be verified and application is run to check that
installation is successful.
224) Have you come across any severe bugs in your application and did you contribute so
that it gets resolved?
Answer: There were severe, critical and blockers defects that were found during every build. I
sat with developer and product owner and explained the expected behavior of system and feature
and functionality. I tried understanding code and functions used to achieve the functionality and
pointed out shortcomings, there by rectifying the defect.
226) If any bug is reproducible at client-side (in production environment) not in the test
environment what are the different possibilities that this scenario occurs?
Answer: There are various scenarios like additional load of uploaded files for processing, logged
in users, time taken to receive response back due to which bug are reproduced at client side
(production environment) and not in the test environment.
227) If any bug is reproducible only on Testing server and not on Development server, how
you make sure that the developer fixes that bug?
Answer: The steps or scenario carried out to reproduce defect at test environment but the same
steps carried out at development server if does not produce defect. It may happen that there can
be some files missing at test environment, code changes at development server due to update on
build. Tester has to reproduce the defect carefully conducting steps at development server and
advice developer to fix the defect.
228) What is Data Migration Testing? What are the different approaches followed in Data
Migration?
Page | 58
Answer: Migration testing validates migration of application from old system to new system
with data integrity, no loss of data, and minimal downtime, with functional and non functional
aspects are met post migration. Pre migration, migration and post migration tests are phases of
migration test. in addition backward compatibility and rollback tests are executed along with.
Page | 59
233) write test cases on company web portal (say ACC cement)
Answer: various companies have their online presence in the form of web portal and social
media. The web portal should provide following information
The URL or web address provided should be browser compatible and should display the
similar content on all the browsers namely, Internet explorer, mozilla firefox, google chrome,
safari, opera etc.
Web site should by default display his home page on page load, without any delay.
The company information such as offerings, products, services are the links provided on
clicking which should display web pages with relevant information.
Company location, current contact information, like phone/mobile, email address and current
head of operations name should be displayed.
In Contact form, user can enter his details and on clicking submit button, a reply from the
company should be received and customer care department should speak with the visitor in
order to provide services asked for.
The product or services page should display their area of expertise, product range, zone wise
dealer’s address where visitor can get product or services via these dealers.
The web portal should also provide link for any current openings available or product
information so that visitor can avail these facilities.
Page | 60
Validate a software has drag and drop feature for image to be uploaded.
Validate a software can able to include more than one image in single pane.
Verify the image developed as a result of merging and modification should not include any
patches.
Validate the font inserted while image editing software should not blur out the text.
Verify the font along with image gets expanded or reduced while using zoom function
without any blur or breaks.
Verify it should not accept any document other than that of image format.
Validate that the image should be converted into final modified form as soon as possible.
Verify that the modified image is sent in email supplied.
Verify that to have image size limitation in order to quickly upload, process and send back
processed image.
Page | 61
possible password combination, and they can also prevent fraudulent sweepstakes entries or
illegitimate contest votes.
239) Why all websites visited want to have your consent to use cookies?
Answer: Many websites have changed their privacy policies after the law and the recent
developments of user data breaches in the tech industry. This will help make the users
understand what data are collected using cookies and what happens to it after they are collected.
Page | 62
else
endif
No of statements Executed: 5
No of statements Executed: 6
if (htinft > 5)
Page | 63
htinft = htinft * 30.48
scenario 1
scenario 1
Page | 64
htinft = htinft * 30.48
document.write(“You are eligible to appear military exams”);
document.write(“Your height is” + htinf +”cms”);
}
Decision coverage = 50%
Page | 65
identify, pass through all testing, remains hidden even after production, occures only in certain
scenario, can surface after release of the product.
248) Explain what the difference between latent and masked defects is?
Answer: Latent defect is a failure that is still hidden as the set of condition were never met that
can uncover a defect.
Masked defect is a defect that has not yet caused because another defect has prevented the area
of code from being executed so that masked defect can be found.
When set of condition or scenario are executed, latent defect will be discovered. masked defect
can be found once the defect preventing to execute area of application is resolved.
Page | 66
Answer: Test plan document is designed by test lead managers per every product under test is a
document that explains scope, approach, resources, and schedule of testing activities. This
document covers test strategies, objective for testing, exit or closure criteria, resource schedule
planning, as well as test deliverables to be included
253) what are the steps to follow when you discover defect?
Answer: Once tester finds a defect in an application, he should complete following steps in order
to register the defect.
Verify and validate the steps followed and try reproducing the defect.
Repeat the test steps and ensure that the defect occurs repeatedly.
Attach screenshots, backend server logs and/or database logs,
Understand the requirement and analyze the deviation from expected output for the scenario.
Include the scenario or test case in case, the scenario tested is not covered.
Report the bug in bug tracking system like Bugzilla or JIRA,
Analyze the defect and rank it based on its severity.
Page | 67
Arrange a team meeting, reveal the solution and ask people to co-operate
258) List common pit holes or mistakes that creates issues in project delivery?
Answer: There can be various mistakes that may create issues in project delivery.
Page | 68
uncertain or unclear objective of project and processes
Wrong Estimation of time and budget
Failure to manage scope described in project
Over micro managing of projects like police and enforcing the pressure in order to achieve
the tasks
Daily or weekly meets amongst team to update and understand the progress.
Not following the Processes
These are few of the mistakes that may result in delays in project delivery and there by losing the
project
positive impact of risk based testing are opportunity to learn and improve business
sustainability when you test application based on the risks involved
negative impact of risk based testing are threat of customer dissatisfaction, impact of overall
project cost due to detailed testing, bad or negative user experience, and possible loss of
customers.
Page | 69
261) When is used Decision table testing?
Answer: Decision table testing are used to validate system behavior with different input
combinations. Best example of such tests can be login to the application where there are two
input values, namely username and password and possible output can either be an error with not
allowing to enter in application or allowed to enter the welcome page.
One can use proxy to access those sites that are otherwise blocked eg. Your school library, or
accessing website back home while travelling abroad, posting comments on websites keeping
your identity hidden.
Page | 70
265) what is the difference between test scenarios, test cases, and test script?
Answer: Following are the definition that differentiate between them
Test scenario can be a description of test objective, tester can accomplish by testing an
application in multiple ways to ensure that the scenario has been covered with satisfaction.
Test case is summary of test scenario with steps or procedure to carry out with test data to the
application in order to validate that the application behaves as expected, or reproducing the
defect by following the steps written in test case, there by validate that the actual result
deviate from expected result.
Test script is steps in order to mimic test case to validate application’s behavior as expected
or behaves differently to locate defect.
266) What all things you should consider before selecting automation tools for the AUT?
Answer: Following are few points to be considered before selecting automation tool for
application under test.
There are various aspects of project that impact risk such as estimation of resources and duration
of activities, schedule, cost estimates, budget, quality and decision of either rent cloud services or
procurement of infrastructure.
Page | 71
268) How would you allocate responsibilities to your team members?
Answer: Team manager or test lead should allocate responsibilities to your team members to
achieve the team’s goals. Roles or responsibility assigned to the team member based on his/her
skills, experience and abilities, in such a way that it increases his morale and motivation.
271) What steps would you verify in case your desktop takes too long to start up?
Answer: In case slower Microsoft Windows startup (boot up) are due to various reasons
Page | 72
Answer: Defect triage is process of analyzing defect priority based on factors such as severity,
risk, and time required to fix /resolve the defect. During defect triage meet, stack holders discuss
and decide the priority of fixing the defects.
276) What are the different strategies for roll out to end users?
Answer: Software Roll out to end users has following strategies
Page | 73
Pilot: The actual production system is installed at a single or limited number of users. Pilot
basically means that the product is actually rolled out to limited users for real work.
Gradual Implementation: In this implementation we ship the entire product to the limited
users or all users at the customer end. Here, the developers get instant feedback from the
recipients which allow them to make changes before the product is available. But the
downside is that developers and testers maintain more than one version at one time.
Phased Implementation: In this implementation the product is rolled out to all users in
incrementally. That means each successive rollout has some added functionality. So as new
functionality comes in, new installations occur and the customer tests them progressively.
The benefit of this kind of rollout is that customers can start using the functionality and
provide valuable feedback progressively. The only issue here is that with each rollout and
added functionality the integration becomes more complicated.
Parallel Implementation: In these types of rollouts the existing application is run side by side
with the new application. If there are any issues with the new application we again move
back to the old application. One of the biggest problems with parallel implementation is we
need extra hardware, software, and resources.
Error Guessing – It is a test case design technique in which testers have to imagine the
defects that might occur and write test cases to represent them.
Error Seeding – It is the process of adding known bugs in a program for tracking the rate of
detection & removal. It also helps to estimate the number of faults remaining in the program.
278) Do you feel comfortable standing up to developers who disagree with your results?
Answer: In some situations, reporting failures can be a delicate process. Perhaps a developer
spent a lot of time on some code which does not exactly meet specifications. QA engineers need
to be able to stand up for what they know is right.
Page | 74
280)What is validation in software testing?
Answer: The meaning of validation is to confirm if application or system designed is in
compliance with the client’s requirements and its feature functions as desired and thereby meets
goals and needs of end user. In short it is to verify the software build is right product.
Page | 75
Answer: REST assured is a java based library used to test RESTful API and web services, HTTP
responses, status code, status messages and headers and body of responses.
286)What is Cucumber?
Answer: Cucumber is a tool that supports Behavior driven development, allowing expected
software behavior specified into logical language a customer can understand. This tool is
developed using Ruby, and Gherkin which is the format for cucumber specifications.
287)What is Capybara?
Answer: Capybara is a web-based automation framework used for creating functional tests that
simulate how users would interact with your application. It supports selenium web driver,
JavaScript, HTTP resources outside of application, used in running automated functional tests for
web based application.
288)What is Salesforce?
Answer: Salesforce is a cloud based customer relationship management service, designed to help
you sell, service, market, analyze, and connect with your customers. This is software that stores
customer contact information like names, addresses, and phone numbers, as well as keeps track
of customer activity like website visits, phone calls, email, and more.
290)What is TeamCity?
Answer: TeamCity is continuous integration servers that help integrate the code, build an
application in premise and over the cloud.
Page | 76
291) What is Gradle?
Answer: Gradle is a build automation tool for multi language software development. It helps to
compile, package, test, and deploy an application.
292)What is Framework?
Answer: Software framework is a structured way in which certain type of files are saved at
particular folders, making it uniform to use and search for by end users and development team,
eg. Eclipse is an integrated development Environment where various project can be designed by
keeping together compiled code and reference classes in such a way that their integration is taken
care by eclipse internally making developers free from integration of these files. Eg. JavaScript
framework, Application framework, web framework and Ajax framework.
Page | 77
Answer: Jira help create user stories and issues, plan sprints, and distribute tasks across software
teams, prioritize and discuss team’s work with complete visibility; keep track of latest release
related information and real time visual data on team’s performance.
Page | 78
302) What is configuration management?
Answer: configuration management is to maintain optimum state of product such as hardware,
software and network as an infrastructure’s performance, functional and physical attributes in
line with its requirement, design and operations in order for their best performance throughout its
life.
303) What are popular configuration management tools you have heard of?
Answer: Popular configuration management tools are Ansible, Chef, Puppet Enterprise,
Terraform to name a few which are industry famous configuration management tools for
infrastructure maintenance.
Page | 79
307) Have you appeared for ISTQB foundation test?
Answer: Many companies have hiring criteria of to hire someone who has passed ISTQB
foundation exam as a tester, as it validates ability to understand testing related terms and
principles in software industry. ISTQB foundation test is an universally accepted online exam to
assessment of knowledge on fundamentals of software testing for testing professionals. If you
have already appeared for the exam and passed this exam you can mention it. But if you have
been thinking of appearing for this exam, you should convince the interviewer that you will
sooner appear for the same.
How many Test case execution completed and bugs occured fixed during the regression testing
Mean Time between Failures(MTBF)rate if reduced and is within the acceptable rate.
Code Coverage Ratio can be calculated based on various tests like statement coverage, branch
coverage etc.
1. Testing shows presence of defects – testing any software will uncover defects in it
2. Early Testing is essential and will help defect in the initial stage of development.
3. Exhaustive testing is not possible – It is not possible to check each and every condition and
criteria of application.
4. Testing is context Dependent – Different domains are tested differently, thus testing is purely
based on the context of the domain or application.
5. Defect clustering – 80% of the problems are found in 20% of the modules.
6. Pesticide paradox – the set of test cases needs to be regularly reviewed and revised.
7. Absence of Error is fallacy as it will be impossible to imagine software without a defect.
Page | 80
310) What is Defect Clustering ?
Answer: Defect clustering is accumulation of most of the defects are found in just few modules.
It is said that 80% of defects are found in 20% of modules.
1) When defects surface even after testing with multiple test cases and scenarios.
e.g. if module1 has 25 bugs, module2 has 15 bugs, and module3 has 50 bugs, total number of
code per modules are module1 has 1250 LOC (lines of code), module2 has 2575 LOC , and
module3 has 7500 LOC, then Total bugs = 25+15+50 = 90, and size = 1250+2575+7500
= 11325, Defect density will be = 90/11325 = 0.00794 defects/loc = 7.94 defects/Kloc.
Page | 81
314) What is release?
Answer: Software release is a deployable software package after several iterations, where all
defects have been fixed to be installed at Production environment.
Page | 82
321) What is CRUD stands for?
Answer: CRUD stands for CREATE, READ, UPDATE, DELETE. In relational database
applications these are major functions that are implemented.
open terminal,
type For remote server login using the ssh:ssh user@server-name
Type any one of the following command to find os name and version in Linux:
cat /etc/os-release. OR lsb_release -a. OR hostnamectl.
Type the following command to find Linux kernel version:
uname -r
Page | 83
324) What is CRM software?
Answer: CRM stands for customer relationship management, improves enhanced
communication, managing sales team and customer opportunities, determining high quality sales
leads, sales analytics, reports and dashboards, integration over email and mobile phones.
325) List few of CRM software used for customer relationship management.
Answer: Salesforce, Pipedrive, Insightly, Zoho CRM, and Hubspot CRM are some of the CRM
softwares utilized in sales and customer relationship management activities.
Brute force
Backtracking
Cause elimination
Program slicing
Page | 84
This will give you confidence as you are doing and accomplishing on newer areas which you
have not explored. In case of new languages, read tutorials and watch you-tube videos.
329) How you coped with having to learn any new skills?
Answer: You should answer above question by showing how passionate you are about knowing,
learning and updating your skills.
You may say as, during my initial days with previous job as software developer trainee, It was a
challenge to prove myself in 6 month of probationary period.
I began learning UNIX commands, took a course where basics of computer peripherals was
taught. Lab training and surprise tests helped me a lot. My team lead and managers have
supported and encouraged me to pursue various courses and certifications. This helped me gain
solid background in basic knowledge.
Page | 85
333) What is Spike Testing?
Answer: Spike Testing is non functional testing where application under test are tested against
sudden and extreme increase or decrease in load, the extreme variations are measured in such
type of performance tests.
meeting deadlines,
targets or goals,
mentoring and coaching others,
learning new things and
Finding a way to solve a problem, or overcome a challenge.
Page | 86
Answer: In this interviewer want to know that Are you able to manage your task without any
supervision? How reliable you are if given position which needs your own decisions and
instincts to drive yourself. In such position, co-workers from other department may rely on your
work to complete their work. For eg. if you are accounts receivable clerk, your making invoices
will help product dispatch department, your collection of payments from customers will bring in
salary for entire staff.
Page | 87
342) Give one example of Low priority and low severity
Answer: The example of Low priority and low severity can be Spelling, Grammatical,
punctuation marks not properly placed, such mistakes in product labels.
343) Describe a situation where you successfully collaborated with developers to deploy a
program or application.
Answer: Interviewer wants to understand how do you handle your tasks in day to day basis, Are
you motivated by accomplishing tasks that needs collaboration with other team members from
different department? Can you convey your message to someone who is not from your team.
Finally your convincing and ability to drive or influence others is measured by this question.
344) Describe a time when you acted proactively to increase system performance.
Answer: In this question, interviewer wants to ascertain your proactiveness towards standards
accepted and required by organization. You can narrate a story where you have proved your
mattel by convincing your team lead, managers and product head to improve upon system
performance by replacing hardware configuration and suggesting better alternatives hardware to
install supplied software for better performance.
345) How do you keep up-to-date with industry developments? Are there specific blogs or
forums you read?
Answer: This is a question where you can answer based on your reading and being upgrade with
latest technologies and industry developments, Where in you may be receiving emails from
various domain experts, blogs, read articles and tutorials on various technologies in demand.
346) What process are you using for testing currently? Can you describe how you might
improve it?
Answer: As a software tester, you may be working on black box testing like functional,
regression, smoke, database testing, API testing, web services testing etc. These are functional
tests, then integration tests and then non functional i.e. performance testing. Use of automation in
API and database testing using scripts can improve the testing efforts.
Page | 88
347) What is your favorite testing tool? Why? If some technical constraint meant you were
unable to use it, what would you do instead?
Answer: You may answer this question only when you are aware of testing tools and what test
types these tools are used for. You can explain why tool is favorite, as what special features
make this tool unique from other tools testing same type of testing. Interviewer wish to
understand, how is your view with finding alternative solution or workaround, To what extent
you are dependent to the environment, circumstances, teammates, tools, personal computer etc.
Or you can quickly adapt the change. You should be well versed with the testing tool that is
favorites, You should able to substitute in case it is not available.
348) How to handle a situation when you don’t have time for complete testing?
Answer: Interviewer wants to know, how do you react real time scenario when there is a delivery
and acceptance testing is on the way, what tests will you take on priority? The answer to this
question will depend on how did you work and perform under pressure environment. The most
critical feature that was not working and have been send with a defect, It is mandatory to check if
the critical and major bugs have been resolved or not, The regression tests should be carried out
and integration tests that validates feature, end to end testing should be carried out. Based on the
test results, we can decide to release the build or not.
349) Do you measure how effective (or not) your testing is? What metrics do you use?
Answer: You need to organize things first – You need to plan testing procedure, how will you
divide the testing process, various types, test cases based on the test types, how will you test test
cases – using automation scripts or manual? Will you keep updating spreadsheets during testing
application over version control software OR use test management tools like JIRA or Bugzilla so
that all the testing execution, the date of execution, test cases executed, test status, registered
bugs etc. can be accessed by everyone on central location.
Writing detailed bug reports with clarity, backend logs captured during reproducing the defect.
Test cases should be written clearly, with all steps and expected results, attend daily meets
between team members and share concerns regarding any issues if any. Ask question to our self
to understand better. Exploration of application to know the features, ultimately find out various
bugs in it.
Page | 89
350) How well do you work under pressure and with deadlines?
Answer: In Agile environment where requirements change frequently, development and testing
activities are carried out in 2 weeks of interval where user stories need to be converted as
working features in the software under development, testers need to verify that these features are
designed as required by the end user. Regression tests are required to be carried out to verify
resolved defects are fixed and no new bugs gets uncovered.
351) What different software testing methods are used by a software company?
Answer: There are mainly three software testing methods used during testing of their application
namely
black box,
white box and
grey box
352) Name some of the test cases that you can automate.
Answer: Types of test cases that can be automated are
Pilot
Gradual Implementation
Parallel Implementation
Page | 90
Staged Execution
357) When is a case where automating a test case is not viable solution?
There are many advantages of test automation and test cases should be automated when possible
and when appropriate. However, there are certain scenarios when test automation is not
preferable and manual testing is a better option:
When the validation depends on the person performing the test (UI/UX, usability, look-and-
feel)
When the feature is being developed with constant changes and automating the test cases
would mean a waste of resources
When the test cases have extreme complexity and automating them would be a waste of
resources
When the requirement is for testers to perform manual sessions in order to gain deeper insight
into the system
Page | 91
358) How well do you deal with Ambiguity?
Answer: Ambiguity is scenario which is open to more than one criterion, making it unclear to
decide, There are various use cases or test cases are not generally straightforward and QA
Engineers should follow up on their own judgment. They have to feel great with ambiguity.
Page | 92
364) What are the challenges that you face as a software tester in the current/previous
company?
Answer: Interviewer wants to dig into your sentimental area of mind, where in case you out of
excitement reveal pain areas and tough situations you are facing at present, it will be an input for
the recruiter to assess your potential or limit of stress that you can handle during pressured
environment and deal with people with discipline.
Verifies operations and actions on application under Verifies behavior of application when subjected to
test load or stress
These tests checks if features functions as expected by These type of tests checks applications are developed
end user’s requirements as per expectations of end user
Types of functional tests are unit testing, smoke tests, Types of non functional tests are performance, load,
integration tests, regression tests stress, and scalability tests
Basically, it is used for ensuring the quality of software to the stakeholders of the application.
Page | 93
368. Why is testing required?
Ans. We need software testing for the following reasons-
1. Testing provides an assurance to the stakeholders that the product works as intended.
2. Avoidable defects leaked to the end-user/customer without proper testing adds a bad
reputation to the development company.
3. Defects detected earlier phase of SDLC results in lesser cost and resource utilization of
correction.
5. The testing team adds another dimension to the software development by providing a different
viewpoint to the product development process.
1. After test case execution – The testing phase can be stopped when one complete cycle of test
cases is executed after the last known bug fix with the agreed-upon value of pass-percentage
2. Once the testing deadline is met – Testing can be stopped after deadlines get met with no
high-priority issues left in the system.
3. Based on Mean Time Between Failure (MTBF) – MTBF is the time interval between two
inherent failures. Based on stakeholders’ decisions, if the MTBF is quite large, one can stop the
testing phase.
4. Based on code coverage value – The testing phase can be stopped when the automated code
coverage
370. What is Quality Control and what are the different types of testing involved in QC?
Ans. Quality control is a product-driven approach that checks that the developed product
conforms to all the specified requirements. It is considered a corrective measure as it tests the
built product to find the defects. It involves different types of testing like functional testing,
performance testing, usability testing, etc.
Page | 94
373. Explain the STLC – Software Testing life cycle.
Ans. The software testing life cycle refers to all the activities performed during the testing of a
software product. The phases include-
Requirement analysis and validation – In this phase, the requirements documents are
analyzed and validated and the scope of testing is defined.
Test planning – In this phase, the test plan strategy is defined, the estimation of test
effort is defined along with the automation strategy, and tool selection is done.
Test Design and Analysis – Here, test cases are designed, test data is prepared and
automation scripts are implemented.
Test environment setup – A test environment closely simulating the real-world
environment is prepared.
Test execution – The test cases are prepared, bugs are reported and retested once
resolved.
Test closure and reporting – A test closure report is prepared to have the final test
results summary, learning, and test metrics.
Black-box testing – In black-box testing, the tester need not have any knowledge of the
internal architecture or implementation of the system. The tester interacts with the system
through the interface providing input and validating the received output.
White box testing – In white box testing, the tester analyses the internal architecture of
the system as well as the quality of source code on different parameters like code
optimization, code coverage, reusability, etc.
Gray box testing – In gray box testing, the tester has partial access to the internal
architecture of the system e.g. the tester may have access to the design documents or
database structure. This information helps the tester to test the application better.
Page | 95
using an automation tool. It helps in reducing the test execution time as the test scripts written
once, can be run automatically any number of times without any human intervention.
Page | 96
specifications. It is a set of conditions with pre-requisites, input values, and expected results in a
documented form.
Page | 97
Steps to reproduce – The steps to reproduce the defect.
Expected Result – The expected behavior from which the application is deviating because
of the defect.
Actual Result- The current erroneous state of the application w.r.t. the defect.
Defect Severity – Based on the criticality of the defect, this field can be set to minor,
medium, major, or show stopper.
Priority – Based on the urgency of the defect, this field can be set on a scale of P0 to P3.
405. Give an example of Low priority-Low severity, Low priority-High severity, High
priority-Low severity, and High priority-High severity defects.
Ans. Below are examples for different combinations of priority and severity-
1. Low priority-Low severity – A spelling mistake in a page not frequently navigated by
users.
2. Low priority-High severity – Application crashing in some very corner cases.
3. High priority-Low severity – Slight change in logo color or spelling mistake in the
company name.
4. High priority-High severity – Issue with login functionality.
Page | 98
408. Explain the bug life cycle or the different states of a bug.
Ans. A bug goes through the following phases in software development-
New – A bug or defect when detected is in a New state.
Assigned – The newly detected bug when assigned to the corresponding developer is in
the Assigned state.
Open – When the developer works on the bug, the bug lies in the Open state.
Rejected/Not a bug – A bug lies in rejected state in case the developer feels the bug is not
genuine.
Deferred – A deferred bug is one whose fix gets deferred for some time(for the next
releases) based on the urgency and criticality of the bug.
Fixed – When a bug is resolved by the developer it is marked as fixed.
Test – When fixed the bug is assigned to the tester and during this time the bug is marked
as in Test.
Reopened – If the tester is not satisfied with the issue resolution the bug is moved to the
Reopened state.
Verified – After the Test phase, if the tester feels the bug is resolved, it is marked as
verified.
Closed – After the bug is verified, it is moved to Closed status.
Page | 99
Specification-based – Specification-based test design techniques are also referred to
as black-box testing. These involve testing based on the specification of the system
under test without knowing its internal architecture.
Structure-based – Structure-based test design techniques are also referred to as white
box testing. In these techniques, the knowledge of the code or internal architecture of
the system is required to carry out the testing.
Experienced-based – The experienced-based techniques are completely based on the
experience or intuition of the tester. The two most common forms of experienced-
based testing are – Adhoc testing and exploratory testing.
Boundary value analysis – Testing using the boundary values of the equivalence classes
taken as the test input.
Decision tables – Testing using decision tables showing the application’s behavior based
on a different combination of input values.
Page | 100
In equivalence class partitioning, a set of input data that defines different test conditions are
partitioned into logically similar groups such that using even a single test data from the group for
testing can be considered similar to using all the other data in that group.
For example, for testing a Square program (a program that prints the square of a number), the
equivalence classes can be-
Set of Negative numbers, whole numbers, decimal numbers, sets of large numbers, etc.
Decision tables are particularly helpful in designing test cases for complex business scenarios
involving the verification of applications with multiple combinations of input.
The higher the test coverage, the more the part of the software gets covered by test cases and
hence, the more effective will be the testing.
Page | 101
419. What is structure-based testing?
Ans. Structure-based test design techniques are also referred to as white box testing. In these
techniques, the knowledge of the code or internal architecture of the system is required to carry
out the testing. The various kinds of testing structure-based or white testing techniques are-
Statement testing – A white box testing technique in which the test scripts are designed
to execute the application’s code statements. Its coverage is measured as the line of code
or statements executed by test scripts.
Path testing – Testing the independent paths in the system(paths are executable
statements from entry to exit points).
421. What are Statement testing and statement coverage in white box testing?
Ans. Statement testing is a white box testing approach in which test scripts are designed to
execute code statements.
Statement coverage is the measure of the percentage of statements of code executed by the test
scripts out of the total code statements in the application. The statement coverage is the least
preferred metric for checking test coverage.
Page | 102
testing activities at multiple levels helps in the early identification of bugs. The different levels of
testing are –
1. Unit Testing
2. Integration Testing
3. System Testing
4. Acceptance Testing
4. Hybrid Integration Testing – Hybrid integration testing is the combination of both Top-
down and bottom-up integration testing. In this approach, the integration starts from the
middle layer, and testing is carried out in both the direction
Page | 103
430. What is acceptance testing?
Ans. Acceptance testing is testing performed by the potential end-user or customers to check if
the software conforms to the business requirements and can be accepted for use.
Page | 104
440. What is stress testing?
Ans. Stress testing is a type of performance testing in which an application’s behavior is
monitored under a higher workload than expected. Stress testing is done to find memory leaks
and the robustness of the application.
Page | 105
461. What is negative testing?
Ans. Negative testing is a type of testing in which the application’s robustness(graceful exiting
or error reporting) is evaluated when provided with invalid input or test data.
Whereas white-box testing requires internal design and implementation knowledge of the
application being tested. It is usually applicable for Unit and Integration testing.
Page | 106
471. What is the difference between smoke and sanity testing?
Ans. The difference between smoke and sanity testing is-
Smoke testing is a type of testing in which all major functionalities of the application are
tested before carrying out exhaustive testing. Whereas, sanity testing is a subset of
regression testing which is carried out when there is some minor fix in the application in
a new build.
In smoke testing, shallow-wide testing is carried out while in Sanity, narrow-deep testing
(for a particular functionality) is done.
The smoke tests are usually documented or automated. Whereas, the sanity tests are
generally not documented or unscripted.
Whereas, a release is installable software provided to the end-users after it gets certified by the
testing team. During the release of any software to the client, release notes are attached to it that
includes a number of defects still open, covered user stories, change requirements, and version of
the release.
Whereas, bug release is when a specific version of the software is released in the market with
some known bugs which are intended to get fixed in later versions. These types of issues are of
low priority and are mentioned in the release notes while sharing with the end-users.
Page | 107
477. What is failover testing?
Ans. Failover testing is a type of testing that is used to verify the application’s ability to allocate
more resources(more servers) in case of failure and transfer the processing part to the backup
system.
Page | 108
Whereas, debugging is an activity performed by the development team. In debugging the cause
of the defect is located and fixed. Thus removing the defect and preventing any future occurrence
of the defect as well.
Another difference between the two is – testing can be done without any internal knowledge of
software architecture. Whereas debugging requires knowledge of software architecture and
coding.
Whereas a masked defect is an existing defect that has not yet caused any failure because another
error has masked it or prevented it from getting discovered.
Do – It implements the plan into action. To serve the customer with better quality and
satisfaction it is necessary to have a good plan to execute.
Check – To check the progress of your plan which has been implemented. The result will
show how accurate the planning had been done.
Act – Acting upon the results to do further improvement which helps in achieving the
planned goals.
Page | 109
492. What is Context-driven testing?
Ans. Context-driven testing is the type of testing that involves adopting the test practices, and
methodologies and at times customizing them based on the context of the project.
In this type of testing, instead of following best practices, we follow what works best for the
project based on the skills, experience, and judgment of the testing team. For details check –
Context-driven methodology by James Bach.
In agile methodology, the development phase and testing phase run simultaneously. In traditional
methodology, the testing phase starts once the development phase is over.
The agile methodology needs less documentation. Due to quick delivery, developers make the
changes in the code based on the need. While in traditional methodology, the development
process starts only after the completed documented requirements are available with the team.
Customers are involved in every stage of the agile software life cycle, reviewing the product and
suggesting changes if required. In traditional methodology, customers are mainly involved in the
requirements gathering phase. They usually see the finished product during the last stages of the
development life cycle.
Page | 110
496. Can you name some agile frameworks?
Ans. The following are some agile frameworks:
Scrum
Crystal
Dynamic Systems Development Method (DSDM)
Feature Driven Development (FDD)
Kanban
Adaptive Software Development (ASD)
Lean Software Development (LSD)
Page | 111
500. What is extreme programming?
Ans. Extreme programming or XP is one of the popular approaches to agile software
development. It uses an object-oriented approach and it follows the same practices included in
the agile manifesto.
Extreme programming is responsible for introducing concepts that are now widely used as
standard practices such as user stories, continuous integration and test-driven development. One
of the advantages of extreme programming is that it gives the flexibility of incorporating
changing requirements at any point in the development life cycle.
Page | 112
Pair programming results in improved code quality and fewer mistakes in the code as
the other developer keeps reviewing the code as it is written.
Pair programming makes it easier to find solutions to any problem faced during the
coding as the other partner can help.
It allows easy knowledge transfer as if one partner is more experienced, s/he can teach
the other developer.
Page | 113
512. What is Kanban?
Ans. Like Scrum, Kanban is also one of the popular frameworks used in agile software
development. Kanban is a Japanese word for signboard. In this framework, work items or user
stories are displayed on the Kanban board, the team can see the status of each user story on the
board. Kanban allows the product to be developed in one large development cycle rather than
having iterations (like scrum). Kanban is incremental, not iterative.
516. What are the difference and similarities between scrum and agile?
Agile methodology is used in software development. It focuses on incremental
development methods where the objective of the methodology is to quickly deliver the
product. Whereas scrum is one of the frameworks of agile that falls under the agile
project management umbrella. It is also used for software development.
Agile follows an incremental and iterative approach to complete the projects. Scrum is
also incremental and iterative in nature.
Page | 114
517. Can you explain agile testing in brief?
Ans. Agile testing is a software testing process that follows principles of agile software
development. The agile development process is an iterative process where requirements keep on
changing as per the customer needs. Agile testing is a continuous process that is done
simultaneously with the development process. Agile testing includes testing the system
continuously until the desired software quality is achieved.
518. What approach should you follow as an agile tester when requirements change
continuously?
First, while creating test cases, an agile testing team should focus on writing generic test
cases that can be helpful in changing the test cases in the future.
An agile tester should collaborate with the product owner and business analyst to
understand the changed requirement and risks associated with the change to modify the
test cases.
The testing team should go with automation testing only after the requirements are
frozen.
Page | 115
522. What is the difference between Incremental and iterative development?
Ans. In an iterative development method, the software is developed and delivered to the
customer. Once the feedback is received from the customer, it is accommodated in the software
and it is developed again in sprints and then delivered to the customer.
The release candidate is a code /version /build released to make sure that during the last
development period, no critical problem is left behind. It is used for testing and is equivalent to
the final build.
Page | 116
527. What are the disadvantages of an agile model?
As the requirements change frequently, the developers may not be able to quantify the
full extent of the efforts required in the development process.
An agile method puts less emphasis on the documentation that might create problems in
the future especially for new joiners in the project.
Continuous involvement from the client team is expected that requires the client team to
be available for the meetings.
If the client team is not able to clearly explain the final outcome of the system, the project
might get taken off track.
An agile development process requires experienced developers who have the skills to
develop the system with the ability to make some quick and crucial decisions during the
process.
Continuous interaction of each team member is expected that increases the time and
energy required from the team.
Page | 117
Adaptation – If any issues or problems are found during inspection, adjustment or
changes to the process should be made in order to remove the problems.
534. What are the primary artifacts of the scrum process framework?
Ans. Scrum artifacts are responsible for providing key information to the development team and
the client. It helps in having the same understanding of the product development details.
535. Can you tell about the various events conducted in each scrum sprint?
Ans. Scrum consists of the following four events that are used for inspection and adaptation-
Sprint Planning – In sprint planning, a detailed discussion of the project work to be done
in the sprint is done.
Daily Scrum – Daily scrum is time-boxed to 15 minutes to discuss the development
team’s activities for the next 24 hours. It also includes discussions regarding the work
performed in the last 24 hours.
Sprint Review – Sprint review is conducted at the end of the sprint. It is done to discuss
the increment.
Sprint Retrospective – Sprint retrospective is conducted so that the development team
can inspect itself and they discuss the improvements or changes that can be done in the
next sprint for more efficiency.
The following are two questions that are answered in sprint planning:
What can be delivered in the sprint? – The product owner discusses the goal of the sprint
and items from product backlog will be selected to be included in the sprint backlog.
How will the work get done? – Based on the sprint backlog, the development team needs
to decide how it will work towards developing a usable increment.
Page | 118
537. What is a daily scrum?
Ans. The daily scrum is an event to discuss the development team’s activities for the next 24
hours. It is time-boxed to a maximum of 15 minutes. In this event, the following questions are
answered-
What did I do yesterday?
What will I do today?
Do I see any impediment which prevents the team from meeting the sprint goal?
The goal of the daily scrum is to inspect the progress of the sprint backlog items.
Page | 119
543. What is a story point?
Ans. A story point is a unit of measurement to estimate the total effort required to implement a
product backlog item or any other work. There are some factors that can be considered while
calculating the required effort: the amount of work to do, the complexity of the work and any
risk that may arise during the work.
Page | 120
549. What does a product burn down chart represent?
Ans. The product burn down chart is a visual representation of remaining work of a product
backlog.
The vertical axis in the product burn down chart represents the remaining amount of work in a
product backlog. The unit of this axis is story points. The horizontal axis represents the time that
will be measured in sprints i.e. iterations.
The vertical axis in the sprint burn down chart represents the remaining amount of work in a
sprint. The unit of this axis can be story points, workhours or workdays. The horizontal axis
represents the time that will be measured in days.
Spike is an experiment or an investment that helps the development team to estimate the story.
Spike is entered into a backlog by the product owner. Spikes have two types – Functional Spikes
and Technical Spikes.
For example, a user story contains requirements for integration with a 3 rd party software.
Developers have never worked with this software and they need some time to understand it. The
product owner can keep a day or two for this research and create a spike in the backlog.
In the tracer bullet, one of the components of the user story will be built into an end-to-end
solution with minimal code and feedback will be gathered. Based on the implementation of one
component, other components of the story can be coded.
Page | 121
554. How to measure velocity in scrum?
Ans. There are two types of velocity i.e. actual velocity and expected velocity.
The actual velocity is calculated using the below formula-
Actual velocity = Total no. of story points completed / No. of sprints
A good user story meets all these criteria and if it fails to do so, the team should consider a
rewrite.
Page | 122
Product Owner – The product owner is responsible for representing requirements to the
team. S/he should have a clear vision of what the product should be, and this vision
should be communicated with the team effectively by the product owner.
The product owner is also responsible for managing a product backlog. S/he is
responsible for listing the product backlog items, ordering the items, ensuring
transparency of product backlog, ensuring product backlog items are understood by the
development team, and optimizing the work done by the development team.
Development Team – Development team mainly consists of developers who perform the
development of the product by coding, testers who test the developed product, and
business analysts. The development team is responsible for delivering quality software in
the form of a usable increment at the end of the sprint. The development team should be
self-organizing and cross-functional. It is important to note that scrum recognizes no
titles for the development team other than the developer no matter what tasks are
performed by the person.
Scrum Master – Scrum master is the leader of the development team. S/he is responsible
for making sure the development team is executing sprint tasks properly. The scrum
master is the one who is responsible for managing the sprint.
Page | 123
566. What is bug leakage and bug release?
Bug Leakage: A bug which is actually missed by the testing team while testing and the build
was released to the Production. If now that bug (which was missed by the testing team) was
found by the end user or customer then we call it as Bug Leakage.
Bug release: Releasing the software to the Production with some known bugs then we call it as
Bug Release. These known bugs should be included in the release note. In other case, releasing
the software to the testing team with some known bugs whose severity and priority is low. These
bugs can be removed before releasing to production.
Bug triage is a formal process to find which bugs are important by prioritizing them based on
their severity, frequency, risk and other important parameters. Testers assign priority (high,
medium, low) to each and every bug in a bug triage meeting and based on the priority those bugs
will be fixed in an order. By doing this we could save a lot of organization’s time.
MR: MR stands for Modification Request. It is used to change the existing functionality in a
software, it is usually requested by clients.
ER: ER stands for Enhancement report. It is used to add a new feature in a software. It is usually
requested by clients.
Page | 124
03. Anchor Links
04. MailTo Links
Usability Testing
570.What is Usability Testing ?
01. Usability testing is nothing but the User-friendliness check.
02. In Usability testing, the application flow is tested so that a new user can understand
Page | 125
the application easily.
03. Basically, system navigation is checked in Usability testing.
Page | 126
06. All the fields should be properly aligned.
07. Enough space should be provided between field labels, columns, rows, and error
messages.
08. All the buttons should be in a standard format and size.
09. Home link should be there on every single page.
10. Disabled fields should be grayed out.
11. Check for broken links and images.
12. Confirmation message should be displayed for any kind of update and delete operation.
13. Check the site on different resolutions (640 x 480, 600x800 etc.?)
14. Check the end user can run the system without frustration.
15. If there is an error message on submit, the information filled by the user should
be there.
16. Title should display on each web page
17. All fields (Textbox, dropdown, radio button etc) and buttons should be accessible
by keyboard shortcuts and the user should be able to perform all operations by
using keyboard.
18. Check if the dropdown data is not truncated due to the field size and also check
whether the data is hardcoded or managed via administrator.
571.Interface Testing
Three areas to be tested here are - Application, Web and Database Server
01. Application: Test requests are sent correctly to the Database and output at the
client side is displayed correctly. Errors if any must be caught by the application
and must be only shown to the administrator and not the end user.
02. Web Server: Test Web server is handling all application requests without any
service denial.
03. Database Server: Make sure queries sent to the database give expected results.
Test system response when connection between the three layers (Application,
Web and Database) cannot be established and appropriate message is shown to the
end user.
572.Database Testing
Database is one critical component of your web application and stress must be laid
to test it thoroughly. Testing activities will include-
01. Test if any errors are shown while executing queries.
02. Data Integrity is maintained while creating, updating or deleting data in database.
03. Check response time of queries and fine tune them if necessary.
04. Test data retrieved from your database is shown accurately in your web application.
To perform the Database testing, the tester should be aware of the below mentioned
points:
Page | 127
01. The tester should understand the functional requirements, business logic, application
flow and database design thoroughly.
02. The tester should figure out the tables, triggers, store procedures, views and
cursors used for the application.
03. The tester should understand the logic of the triggers, store procedures, views
and cursors created.
04. The tester should figure out the tables which get affected when insert update
and delete (DML) operations are performed through the web or desktop applications.
Test Scenarios for Database Testing
01. Verify the database name: The database name should match with the specifications.
02. Verify the Tables, columns, column types and defaults. All things should match
with the specifications.
03. Verify whether the column allows a null or not.
04. Verify the Primary and foreign key of each table.
05. Verify the Stored Procedure.
06. Test whether the Stored procedure is installed or not.
07. Verify the Stored procedure name
08. Verify the parameter names, types and number of parameters.
09. Test the parameters if they are required or not.
10. Test the stored procedure by deleting some parameters
11. Test when the output is zero, the zero records should be affected.
12. Test the stored procedure by writing simple SQL queries.
13. Test whether the stored procedure returns the values
14. Test the stored procedure with sample input data.
15. Verify the behavior of each flag in the table.
16. Verify the data gets properly saved into the database after the each page submision.
17. Verify the data if the DML (Update, delete and insert) operations are performed.
18. Check the length of every field. The field length in the back end and front end
must be same.
19. Verify the database names of QA, UAT and production. The names should
beunique.
20. Verify the encrypted data in the database.
21. Verify the database size. Also test the response time of each query executed.
22. Verify the data displayed on the front end and make sure it is same in the back
end.
23. Verify the data validity by inserting the invalid data in the database.
24. Verify the Triggers.
Page | 128
Compatibility Testing
573.What is Compatibility Testing?
Compatibility testing is used to determine if your software is compatible with other
elements of a system with which it should operate, e.g. Browsers, Operating Systems,
or hardware.
Performance Testing
574.What is Performance Testing ?
Performance Testing is conducted to evaluate the compliance of a system or
component with specified performance requirements.
Page | 129
03. Stress test your web site to determine its break point when pushed to beyond
normal loads at peak time.
04. Test if a crash occurs due to peak load, how does the site recover from such
an event.
05. Make sure optimization techniques like gzip compression, browser and
server side cache enabled to reduce load times.
575.Security Testing
Security Testing involves the test to identify any flaws and gaps from a security
point of view.
Test Scenarios for Security Testing :
01. Verify the web page which contains important data like password, credit card
numbers, secret answers for security question etc should be submitted via
HTTPS (SSL).
02. Verify the important information like password, credit card numbers etc should
display in encrypted format.
03. Verify password rules are implemented on all authentication pages like Registration,
forgot password, change password.
04. Verify if the password is changed the user should not be able to login with the
old password.
05. Verify the error messages should not display any important information.
06. Verify if the user is logged out from the system or user session was expired, the
user should not be able to navigate the site.
07. Verify to access the secured and non secured web pages directly without login.
08. Verify the “View Source code” option is disabled and should not be visible to the
user.
09. Verify the user account gets locked out if the user is entering the wrong password
Page | 130
several times.
10. Verify the cookies should not store passwords.
11. Verify if, any functionality is not working, the system should not display any application,
server, or database information. Instead, it should display the custom
error page.
12. Verify the SQL injection attacks.
13. Verify the user roles and their rights. For Example The requestor should not be
able to access the admin page.
14. Verify the important operations are written in log files, and that information
should be traceable.
15. Verify the session values are in an encrypted format in the address bar.
16. Verify the cookie information is stored in encrypted format.
17. Verify the application for Brute Force Attacks.
The below scenario will explain the answer to this question in a better way.
Page | 131
Here, you will first test module A deeply. Your next stress will be on module B. But what about
module C? This module will be tested as well but with less stress, because module C does not
depend on module A for its functioning, rather it depends on module B.
If you are a white box tester, you must know which modules are to be tested and which ones can
be affected. But in case you are a black box tester, then you will be required to do Regression
Testing as well.
Regression tests should be carried out only on those modules associated with the modified
module.
579. Share the most challenging situation that you have ever faced during testing?
Answer: This is an excellent question indeed! A few years back, when I switched my job, I was
asked the same question by my interviewer. A perfect answer to this question usually depends on
the challenges experienced by an individual.
Software Testing has a lot of challenges both in the Manual and automation.
Discovering a bug that was difficult to be found out could be the answer to this question. It was
quite challenging for me. Fixing these unreproducible bugs can be difficult, but it is often
possible.
Always keep in mind that whenever you are answering such a question, you need to be realistic
and don’t stress yourself. Do not let anyone dull your sparkle. Just be yourself.
580. What are you going to do if there is no Functional Spec, or any documents related to
the system and the developer who wrote the code does not work in the company anymore,
but you have a system and need to test?
Answer: It is, unfortunately, one of the typical situations in Indian companies because of the
high attrition rate.
Here, you need to do Exploratory Testing of the product. It is about exploring, finding out about
the software, what it does, what it doesn’t, what works, and what doesn’t work.
In this testing, you will come to know about the system and its basic workflow. In Exploratory
Testing, you can also discover ‘blocker’ bugs that are harmful to your system and therefore
protect your system from being crashed.
If you are a white box tester, the next step is to look for different module codes. By this, you will
be able to analyze the test cases for different modules and their relations.
581. On which basis we give priority and severity for a bug and give one example for high
priority and low severity and high severity and low priority?
Always the priority is given by team leader or Business Analyst. Severity is given by the reporter
of bug. For example, High severity: hardware bugs application crash. Low severity: User
interface bugs. High priority: Error message is not coming on time, calculation bugs etc. Low
priority: Wrong alignment, etc
Page | 132
582. What do you mean by reproducing the bug? If the bug was not reproducible, what is
the next step?
If you find a defect, for example click the button and the corresponding action didn’t happen, it
is a bug. If the developer is unable to find this behaviour he will ask us to reproduce the bug. In
another scenario, if the client complaints a defect in the production we will have to reproduce it
in test environment.
If the bug was not reproducible by developer, then bug is assigned back to reporter or goto
meeting or informal meeting (like walkthrough) is arranged in order to reproduce the bug.
Sometimes the bugs are inconsistent, so that that case we can mark the bugs as inconsistent and
temporarily close the bug with status working fine now.
583. What is the responsibility of a tester when a bug which may arrive at the time of
testing. Explain?
First check the status of the bug, then check whether the bug is valid or not then forward the
same bug to the team leader and then after confirmation forward it to the concern developer.
If we cannot reproduce it, it is not reproducible in which case we will do further testing around it
and if we cannot see it we will close it, and just hope it would never come back ever again.
584. How can we design the test cases from requirements? Do the requirements, represent
exact functionality of AUT?
Ofcourse, requirements should represents exact functionality of AUT.
First of all you have to analyze the requirements very thoroughly in terms of functionality. Then
we have to think about suitable test case design technique [Black Box design techniques like
Specification based test cases, functional test cases, Equivalence Class Partitioning
(ECP), Boundary Valve Analysis (BVA), Error guessing and Cause Effect Graphing] for writing
the test cases.
By these concepts you should design a test case, which should have the capability of finding the
absence of defects.
586. What is the difference between use case, test case, test plan?
Use Case: It is prepared by Business analyst in the Functional Requirement Specification(FRS),
which are nothing but a steps which are given by the customer.
Test cases: It is prepared by test engineer based on the use cases from FRS to check the
functionality of an application thoroughly
Page | 133
Test Plan: Team lead prepares test plan, in it he represents the scope of the test, what to test and
what not to test, scheduling, what to test using automation etc.
Behavioral QA questions
Behavioral questions are an opportunity to explore your professional background and describe how
you’ve handled workplace situations. You’ll use the STAR method (Situation, Tasks, Actions,
Results) to answer behavioral questions with detailed, compelling stories about your past
successes.
Interviewers ask this question to learn more about how you recover from and resolve inadvertent
QA errors and the results of your efforts to resolve the situation.
How to answer:
Use the STAR method to compose your answer. Describe the situation you were in when you
missed the bug, the tasks you were responsible for and the role you played, the actions you took to
resolve the missed bug, and the results of your actions.
Take this opportunity to exhibit self-awareness around past work-related mistakes and confidence
in being able to handle them.
588. When you’ve found a bug, how have you resolved it?
Interviewers ask this question to learn more about your experience with different QA processes
and methodologies, your past successes in resolving bugs, and how these successes might translate
to your performance in the open position.
How to answer:
Use the STAR method to compose your answer. Describe the situation you were in when you
found the bug, the tasks you were responsible for and the role you played, the actions you took to
resolve the bug, and the results of your actions.
Take this opportunity to describe your QA successes in concrete terms and your process, step by
step.
Page | 134
589. Tell me about your most difficult project.
Interviewers ask this question to get a feel for your work ethic. They want to know how you
approach QA challenges, such as tight deadlines or fixing bugs during the testing process, and the
actions you take to succeed.
How to answer:
Use the STAR method to describe the situation of your most difficult project, the tasks you were
responsible for and your role, the actions you took to overcome the challenge, and the results of
your actions.
Take this opportunity to showcase your commitment to working through challenges and emphasize
the impact of your efforts.
Situational QA questions
Situational questions are prompts for describing how you would react to hypothetical workplace
situations and give employers a sense of your job performance potential. Skillful answers can
demonstrate how you think on your feet and imagine different approaches to QA scenarios.
As with behavioral questions, which focus on the past, you can use the STAR method to walk
interviewers through your proposed strategies.
590. How would you ensure your team accounts for all details in the QA process?
Interviewers ask this question to gauge your level of attention to detail and understand how you
motivate and collaborate with others to optimize the QA process.
How to answer:
Use the STAR method to describe a hypothetical situation involving a QA process,
the tasks you’d be responsible for to ensure detailed attention to the project, actions you would
take, and the results you would anticipate.
Take the opportunity to describe your QA methods and approaches in detail and how you would
apply them to future projects.
Page | 135
591. If a client found an error in a status report, how would you resolve the issue?
Interviewers ask this question to find out how you handle interactions with clients or project
stakeholders, especially when you or your team is responsible for an error.
How to answer:
Use the STAR method to describe a hypothetical situation in which a client notices a status report
error, the tasks you’d be responsible for in this scenario, the actions you would take to resolve the
error and communicate with the client, and the results you would anticipate.
Take the opportunity to emphasize your communication and problem-solving skills, as well as
your resilience when facing challenges.
592. How would you approach a project that you have doubts about?
Interviewers ask this question to learn how you evaluate projects, raise questions, conduct more
research into a project, and communicate your misgivings to coworkers or managers.
How to answer:
Use the STAR method to describe a hypothetical situation in which you have doubts about a
project, the tasks you’d be responsible for, the actions you’d take to communicate your doubts or
find out more through research, and the results you would anticipate.
Take the opportunity to emphasize your critical thinking and communication skills, as well as your
conscientious approach to understanding a project inside and out.
Testing-related QA questions
These questions are your opportunity to showcase your QA knowledge and skills. To prepare,
review your training and experience, and refresh your memory of common concepts, terms, and
methods.
Interviewers ask this question to gauge your familiarity and experience with this aspect of
quality assurance.
Page | 136
How to answer:
Review your notes, documentation, or training materials on test planning and any experience
you’ve had with it.
Be prepared to describe the components of a test plan, different kinds of test plans, how to create
one, and different use cases.
Interviewers ask this question to discover your familiarity with this concept and experience with
the process.
How to answer:
Review everything you’ve learned about testing and reflect on your experiences.
Be prepared to discuss the testing life cycle and why each phase is important.
595. Can you define stress testing, load testing, and volume testing?
Interviewers ask this question to gauge your understanding of these terms and any experience
you have with these types of testing.
How to answer:
Refer to several authoritative QA sources to confirm that you have up-to-date definitions of these
terms.
Prepare to define these terms clearly, discuss the scenarios necessitating each one, and describe
your experience with them.
Most interviewers will invite you to ask questions throughout the interview and at the end. This is
your opportunity to get the most out of your interview experience. Prepare questions in advance to:
Page | 137
Signal your interest in a position.
Demonstrate your conscientious approach to job-seeking (and, by extension, job performance).
Get the exact information you need about the company and the position to make a career decision.
Asking this question can give you insights into the skills and traits that lead to success in the QA
role you’re applying for. With these insights, you can refine your QA characteristics and cultivate
new ones to match the company's expectations.
Asking this question shows that you are mindful of what individual companies are doing with
specific apps and tools. Depending on the interviewer’s answer, asking this question also presents
an opportunity to share your experience with technologies the company uses or commit to
becoming familiar with them.
Asking this question shows that you are mindful of different QA methods and practices from one
company to the next and are keen on aligning your QA experience and training with the
prospective employer’s QA process.
599. What does your development team need from a new QA hire?
Asking this question demonstrates that you are interested in learning more about what the
employer is looking for and how you can develop the workplace and technical skills to become an
attractive candidate for the development team.
Ans:I will open a defect and get it closed by devloper as non reproducible
Page | 138
601.How do you coordinate QA Testing progress with broader team?
Ans:I schedule QA Triage weekly status call with all QA team,developers,BA Product,business
teams.I will open all my open question and get clarification from product team and get them
documented.
3.Also helps to suggest the potential that arise with the design plan this saves lot of time
4.Is QA Engineer as occupied with multiple project then he can be involved after development
phase
603. How do you deal when developer is not accepting your defect?
Ans:1.It must be because you/him have misunderstanding in this case you can send email to
product team with the actual behaviour and asking them if it is correct
2.You can bring this up in QA triage or standup meeting and if required share your screen and
Ans:Yes it is always good to go over your test case with broader team ,In case you miss any
scenario then review comment will save you.
Ans:Code Freeze is asking development team to maintain stable environment when code is
freezed nothing should be deployed to test environment
Page | 139
607.Do You ask for Code Freeze Date?
Ans:Yes I always ask for a code freeze date this date should be such that at that point all
Defects should be closed.Thats When I ask for code freeze so that I can perform my regression
testing.
Ans:1.Production Stability is to make sure we don’t have any issues to the code that we signed
off
2.My goal is always maintain 100% production stability.
3.I Prioritize my QA tasks in such a way that my primary focus is to maintain production
stability and it is never effected.
Some popular frameworks and tools that are used for unit testing include JUnit, NUnit,
and xUnit.
It’s important to keep in mind that unit testing is only one aspect of software testing and it
should be used in combination with other types of testing such as integration testing, functional
testing, and acceptance testing to ensure that the software meets the needs of its users.
It focuses on the smallest unit of software design. In this, we test an individual unit or group of
interrelated units. It is often done by the programmer by using sample input and observing its
corresponding outputs.
Page | 140
Example:
a) In a program we are checking if the loop, method, or
function is working fine
b) Misunderstood or incorrect, arithmetic precedence.
c) Incorrect initialization
611. Integration Testing?
Integration testing is a method of testing how different units or components of a software
application interact with each other. It is used to identify and resolve any issues that may arise
when different units of the software are combined. Integration testing is typically done after
unit testing and before functional testing, and is used to verify that the different units of the
software work together as intended.
1. Top-down integration testing: It starts with the highest level modules and integrates them
with lower-level modules.
2. Bottom-up integration testing: It starts with the lowest-level modules and integrates them
with higher-level modules.
3. Big-Bang integration testing: It combines all the modules and integrates them all at once.
4. Incremental integration testing: It integrates the modules in small groups, testing each
group as it is added.
1. It helps to identify and resolve issues that may arise when different units of the software
are combined.
2. It helps to ensure that the different units of the software work together as intended.
3. It helps to improve the overall reliability and stability of the software.
4. It’s important to keep in mind that Integration testing is essential for complex systems
where different components are integrated together.
5. As with unit testing, integration testing is only one aspect of software testing and it should
be used in combination with other types of testing such as unit testing, functional testing,
and acceptance testing to ensure that the software meets the needs of its users.
The objective is to take unit-tested components and build a program structure that has been
dictated by design. Integration testing is testing in which a group of components is combined
to produce output.
Integration testing is of four types: (i) Top-down (ii) Bottom-up (iii) Sandwich (iv) Big-Bang
Example:
(a) Black Box testing:- It is used for validation.
In this, we ignore internal working mechanisms and
Page | 141
focus on what is the output?.
1. It helps to ensure that changes made to the software do not introduce new bugs or cause
existing functionality to break.
2. It helps to ensure that the software continues to work as intended after changes have been
made.
3. It helps to improve the overall reliability and stability of the software.
4. It’s important to keep in mind that regression testing is an ongoing process that should be
done throughout the software development
5. lifecycle to ensure that the software continues to work as intended. It should be automated
as much as possible to save time and resources. Additionally, it’s important to have a well-
defined regression test suite that covers
Every time a new module is added leads to changes in the program. This type of testing makes
sure that the whole component works properly even after adding components to the complete
program.
Example
In school, record suppose we have module staff, students
and finance combining these modules and checking if on
integration of these modules works fine in regression testing
Page | 142
613. Smoke Testing?
This test is done to make sure that the software under testing is ready or stable for further
testing
It is called a smoke test as the testing of an initial pass is done to check if it did not catch the
fire or smoke in the initial switch on.
Example:
If the project has 2 modules so before going to the module
make sure that module 1 works properly
Page | 143
operating system
(c) Test cases that may cause excessive disk requirement
Page | 144
622.Difference Between Quality Assurance and Quality Control?
2.It is the Static Process of analyzing 2.It Involves dynamic testing of a Software
Product by running it.
the documents and not the actual end
Product.
5.It Involves Activies like document 5.It Involves activities like functional
Review ,test case ,review,test case ,review testing,Automation testing.
Walkthrough,inspection.
1.Testing was done without executing 1.Testing is done by executing the product
The program.
2.This testing does the verification 2.This Testing does the Validation Process
Process.
3.Static Testing is about prevention of 3.Dynamic testing is about finding and fixing
Defects. Defects.
4.Static Testing gives an assessment 4.Dynamic Testing gives bugs in the software
Page | 145
Of code and documentation System
5.Static Testing involves a checklist 5.Dynamic Testing involve test cases for
And process. Execution.
7.Cost of Finding Defects and Fixing is less 7.Cost of Finding and Fixing Defect High.
8.Return on investment will be high for this 8.Return on investment will be high for
Process. This Process.
Page | 146
4.You Can Automate Regression 4.You Can not automate Retesting.
Testing.
5.Regression testing is done for passed 5.Retesting is done for failed test cases.
Test cases.
6.Regression testing checks for 6.Retesting makes sure that the original
Unexpected side effects. Fault has been correct.
7.Test cases for regression testing 7.Test cases for Retesting is obtained
Can be obtained from the from failed test cases.
Functional specification.
2.Test Cases focus on How to Test. 2.Test Scenario focus on what to test.
3.Test Case are clearly defined steps. 3.Test Scenario are generally one liner.
4.Test Cases can be derived from test 4.Test Scenarios are derived from use case
Scenarios.
5.Test Cases are efficient in exhaustive 5.Test Scenarios are beneficial in quick
Testing of an application. Testing end to end functions.
6.More resources are required for 6.Relatively less time and resources are
Documentation and execution of required for creating and testing using
Test cases. Test scenarios.
3.It is applicable for lower levels 3.It is Applicable for higher level of testing
Of testing Unit Testing+Integration System Testing +Application Testing.
Page | 147
4.Statement Coverge,Branch Coverage 4.Equivalance Partitiioning is black box testing
And path coverage. Technique.
6.The main objective of white 6.The Main Objective of testing is to check the
Box testing is done to check Functionality.
The quality of code.
SDLC STLC
1.The Main Objective is to completed 1.The Only Objective of STLC Phase is testing.
Successful development of software
Including testing and other phases.
3.In SDLC the development team 3.In STLC the test analysis creates the integration
Create the high and flow level test plan.
Design plan.
4.The Real Code is developed 4.The Testing team prepare test environment and
And actual work takes place execute them.
As per design.
Verification Validation
1.Verification and ensure that product is 1.Validation ensures that product actually meets
Built according to the requirement and client need.
Design.
Page | 148
3.It Involves static testing. 3.In Involves Dynamic Testing.
4.Verification uses methods like 4.It uses method like black box testing
Reviews,walkthrough,inspections. White Box testing .
5.It find bugs early in the development 5.It find the bugs that the verification process
Cycle. Can not catch.
Waterfall Agile
1.The Waterfall methodology is 1.Agile Methodology is incremental and iterative.
Sequential and linear.
3.The Working model of software 3.The Working model is delivered during the
Is delivered at the later phase of initial phase and successive iteration of the
SDLC. Model is delivered to the client for feedback.
3.It is easy to define functional requirement 3.It is difficult to define the requirements
For non functional testing
Page | 149
5.Carred out to validate software 5.It is done to validate the performance
Actions. Of Software.
6.Functional Testing is easy to execute 6.Its very hard to perform non functional
By manual testing. Testing.
7.It Describe what the product does . 7.It Describe how the Product Work.
4.DDL Statement affect the whole table. 4.DML Statement affect one or more row.
Page | 150
RDBMS Interview Questions
Let’s start with the basic RDBMS interview questions first and then we will move to more
complex database interview questions. Since these questions focus on the database fundamentals
which are common to all the databases, so the questions hold good for the different databases –
SQL server, Oracle, MySQL, etc.
RDBMS has primary keys and data is stored in tables. DBMS has no concept of primary keys
with data stored in navigational or hierarchical form.
RDBMS defines integrity constraints in order to follow ACID properties. While DBMS doesn’t
follow ACID properties.
Page | 151
639. What is a tuple, record, or row in a table?
Ans. A tuple is a single record or single row in a table. For example, in the case of a student
table, the data corresponding to a student will be called a tuple or record of that student.
642. Explain DDL commands. What are the different DDL commands in SQL?
Ans. DDL refers to Data Definition Language. The DDL commands are used to define or alter
the structure of the database. The different DDL commands are-
CREATE – Used to create a table in the DB
DROP – Drops the table from the DB
ALTER – Alters the structure of the DB
TRUNCATE – Deletes all the records from the DB but not its database structure
RENAME – Renames a DB object
643. Explain DML commands. What are the different DML commands in SQL?
Ans. DML refers to Data Manipulation Language. These commands are used for managing data
present in the database. Some of the DML commands are – select, insert, update, delete, etc.
644. Explain DCL commands. What are the different DCL commands in SQL?
Ans. DCL refers to Data Control Language. These commands are used to create roles, grant
permission, and control access to the database objects. The three DCL commands are-
GRANT – Grants permission to a database user.
REVOKE – Removes access privileges from a user-provided with the GRANT
command.
Deny – Explicitly prevents a user from receiving particular permission(e.g. preventing a
particular user belonging to a group to receive the access controls.
645. Explain TCL commands. What are the different TCL commands in SQL?
Ans. TCL refers to Transaction Control Language. These commands are used to manage the
changes made by DML statements. These are used to process a group of SQL statements
comprising a logical unit. The three TCL commands are-
COMMIT – Commit write the changes to the database
SAVEPOINT – Savepoints are the breakpoints, these divide the transaction into smaller
logical units which could be further roll-backed.
ROLLBACK – Rollbacks are used to restore the database since the last commit.
Page | 152
646. What are SQL constraints?
Ans. SQL constraints are the set of rules that impose some restrictions while inserting, deleting,
or updating the data in the databases. In SQL, we have both column level as well as table level
constraints which are applied at columns and tables respectively. Some of the constraints in SQL
are – Primary Key, Foreign Key, Unique Key, Not NULL, DEFAULT, CHECK, and Index
constraint.
649. What is the difference between a unique key and a primary key?
Ans. A unique key allows null value (although only one) but a primary key doesn’t allow null
values. A table can have more than one unique keys columns while there can be only one
primary key. A unique key column creates a non-clustered index whereas the primary key
creates a clustered index on the column.
Page | 153
654. What is a Check constraint?
Ans. A check constraint is used to limit the value entered in a field. For example, we can ensure
that field ‘Salary’ can only have a value greater than 1000 using check constraint.
CREATE TABLE EMP_SALARY(
EmpID int NOT NULL,
NAME VARCHAR (30) NOT NULL,
Salary INT CHECK (Salary > 1000),
PRIMARY KEY (EmpID)
);
658. What is the difference between delete, truncate and drop command?
Ans. The difference between the Delete, Truncate and Drop command is –
Delete command is a DML command. It removes rows from a table based on the
condition specified in the where clause, being a DML statement we can rollback changes
made by the delete command.
Truncate is a DDL command. It removes all the rows from the table and also frees the
space held, unlike the delete command. It takes a lock on the table while the delete
command takes a lock on rows of the table.
Drop is a DDL command. It removes the complete data along with the table structure
(unlike the truncate command that removes only the rows).
Page | 154
3. Right Join – To fetch all rows from right table and matching rows of the left table
SELECT * FROM TABLE1 RIGHT JOIN TABLE2 ON TABLE1.columnA =
TABLE2.columnA;
4. Full Outer Join – To fetch all rows of the left table and all rows of right table
SELECT * FROM TABLE1 FULL OUTER JOIN TABLE2 ON TABLE1.columnA =
TABLE2.columnA;
5. Self Join – Joining a table to itself, for referencing its own data
SELECT * FROM TABLE1 T1, TABLE1 T2 WHERE T1.columnA = T2.columnB;
660. What is the difference between cross join and full outer join?
Ans. A cross join returns the cartesian product of the two tables. So there is no condition or on
clause as each row of TabelA is joined with each row of TableB whereas a full outer join will
join the two tables on the basis of the condition specified in the on clause and for the records not
satisfying the condition null value is placed in the join result.
A ‘where’ clause is used to fetch data from the database that specifies particular criteria
(specified after the where clause). Whereas a ‘having’ clause is used along with ‘GROUP BY’ to
fetch data that meets particular criteria specified by the aggregate function.
For example – for a table with Employee and Project fields. If we want to fetch Employee
working on a particular project P2, we will use ‘where’ clause-
Select Employee
From Emp_Project
where Project = P2;
Now if we want to fetch Employees who are working on more than one project. We will first
have to group the Employee column along with the count of the project and then the ‘having’
clause can be used to fetch relevant records-
Select Employee
From Emp_Project
GROUP BY Employee
Having count(Project)>1;
662. What is the difference between Union and Union All command?
Ans. The fundamental difference between Union and Union All command is – Union is by
default distinct i.e. it combines the distinct result set of two or more select statements.
Whereas, Union All combines all the rows including duplicates in the result set of different
select statements.
Page | 155
664. What is a View in SQL?
Ans. A view is a virtual table. It is a named set of SQL statements that can be later referenced
and used as a table.
CREATE VIEW VIEW_NAME AS
SELECT COLUMN1, COLUMN2
FROM TABLE_NAME WHERE CONDITION;
Page | 156
672. What are the ACID properties?
Ans. This is one of the frequently asked database interview questions. ACID properties refer to
the four properties of transactions in SQL-
1. Atomicity – All the operations in the transaction are performed as a whole or not
performed at all.
2. Consistency – State of database changes only on successfully committed transactions.
3. Isolation – Even with concurrent execution of multiple transactions. The final state of the
DB would be the same as if transactions got executed sequentially. In other words, each
transaction is isolated from one another.
4. Durability – Even in the state of crash or power loss the state of the committed
transaction remains persistent.
Page | 157
ROUND() – Used to round a number to the decimal places specified
NOW() – Used to fetch current system date and time
LEN() – Used to find the length of a string
SUBSTRING() or MID() – MID and SUBSTRING are synonyms in SQL. They are used
to extract a substring from a string by specifying the start and end index. Syntax –
SUBSTRING(ColumnName, startIndex, EndIndex).
LOCATE() – Used to find the index of the character in a string. Syntax –
LOCATE(character,ColumnName)
LTRIM() – Used to trim spaces from left
RTRIM() – Used to trim spaces from right
Page | 158
triggerTime{Before or After}
triggerEvent{Insert, Update or Delete}
ON tableName
FOR EACH ROW
triggerBody
In fact, I have been asked most of these questions during interviews in the different phases of my
career.
If you want to skip the basic questions and start with some tricky SQL queries then you can
directly move to our SQL queries interview questions for the experienced section.
Consider the below two tables for reference while trying to solve the SQL queries for practice.
Table – EmployeeDetails
EmpId FullName ManagerId DateOfJoining City
Table – EmployeeSalary
Page | 159
EmpId Project Salary Variable
421 P1 12000 0
Here is a list of top SQL query interview questions and answers for fresher candidates that will
help them in their interviews. In these queries, we will focus on the basic SQL commands only.
683. Write an SQL query to fetch the EmpId and FullName of all the employees working
under the Manager with id – ‘986’.
Ans. We can use the EmployeeDetails table to fetch the employee details with a where clause for
the manager-
SELECT EmpId, FullName
FROM EmployeeDetails
684. Write an SQL query to fetch the different projects available from the EmployeeSalary
table.
Ans. While referring to the EmployeeSalary table, we can see that this table contains project
values corresponding to each employee, or we can say that we will have duplicate project values
while selecting Project values from this table.
So, we will use the distinct clause to get the unique values of the Project.
SELECT DISTINCT(Project)
FROM EmployeeSalary;
685. Write an SQL query to fetch the count of employees working in project ‘P1’.
Ans. Here, we would be using aggregate function count() with the SQL where clause-
SELECT COUNT(*)
Page | 160
FROM EmployeeSalary
686. Write an SQL query to find the maximum, minimum, and average salary of the
employees.
Ans. We can use the aggregate function of SQL to fetch the max, min, and average values-
SELECT Max(Salary),
Min(Salary),
AVG(Salary)
FROM EmployeeSalary;Ques.5. Write an SQL query to find the employee id whose salary
lies in the range of 9000 and 15000.
Ans. Here, we can use the ‘Between’ operator with a where clause.
FROM EmployeeSalary
687. Write an SQL query to fetch those employees who live in Toronto and work under the
manager with ManagerId – 321.
Ans. Since we have to satisfy both the conditions – employees living in ‘Toronto’ and working
in Project ‘P2’. So, we will use AND operator here-
SELECT EmpId, City, ManagerId
FROM EmployeeDetails
688. Write an SQL query to fetch all the employees who either live in California or work
under a manager with ManagerId – 321.
Ans. This interview question requires us to satisfy either of the conditions – employees living in
Page | 161
‘California’ and working under Manager with ManagerId – 321. So, we will use the OR operator
here-
SELECT EmpId, City, ManagerId
FROM EmployeeDetails
689. Write an SQL query to fetch all those employees who work on Projects other than P1.
Ans. Here, we can use the NOT operator to fetch the rows which are not satisfying the given
condition.
SELECT EmpId
FROM EmployeeSalary
SELECT EmpId
FROM EmployeeSalary
For the difference between NOT and <> SQL operators, check this link – Difference between the
NOT and != operators.
690. Write an SQL query to display the total salary of each employee adding the Salary
with Variable value.
Ans. Here, we can simply use the ‘+’ operator in SQL.
SELECT EmpId,
Salary+Variable as TotalSalary
FROM EmployeeSalary;
Page | 162
691. Write an SQL query to fetch the employees whose name begins with any two
characters, followed by a text “hn” and ends with any sequence of characters.
Ans. For this question, we can create an SQL query using like operator with ‘_’ and ‘%’ wild
card characters, where ‘_’ matches a single character and ‘%’ matches ‘0 or multiple characters.
SELECT FullName
FROM EmployeeDetails
692. Write an SQL query to fetch all the EmpIds which are present in either of the tables –
‘EmployeeDetails’ and ‘EmployeeSalary’.
Ans. In order to get unique employee ids from both tables, we can use the Union clause which
can combine the results of the two SQL queries and return unique rows.
SELECT EmpId FROM EmployeeDetails
UNION
693. Write an SQL query to fetch common records between two tables.
Ans. SQL Server – Using INTERSECT operator-
MySQL – Since MySQL doesn’t have INTERSECT operator so we can use the subquery-
SELECT *
FROM EmployeeSalary
WHERE EmpId IN
(SELECT EmpId from ManagerSalary);
Page | 163
694. Write an SQL query to fetch records that are present in one table but not in another
table.
Ans. SQL Server – Using MINUS- operator-
SELECT * FROM EmployeeSalary
MINUS
MySQL – Since MySQL doesn’t have a MINUS operator so we can use LEFT join-
SELECT EmployeeSalary.*
FROM EmployeeSalary
LEFT JOIN
695. Write an SQL query to fetch the EmpIds that are present in both the tables –
‘EmployeeDetails’ and ‘EmployeeSalary.
Ans. Using subquery-
SELECT EmpId FROM
EmployeeDetails
where EmpId IN
Page | 164
696. Write an SQL query to fetch the EmpIds that are present in EmployeeDetails but not
in EmployeeSalary.
Ans. Using subquery-
SELECT EmpId FROM
EmployeeDetails
697. Write an SQL query to fetch the employee’s full names and replace the space with ‘-’.
Ans. Using the ‘Replace’ function-
SELECT REPLACE(FullName, ' ', '-')
FROM EmployeeDetails;
FROM EmployeeDetails;
699. Write an SQL query to display both the EmpId and ManagerId together.
Ans. Here we can use the CONCAT command.
SELECT CONCAT(EmpId, ManagerId) as NewId
FROM EmployeeDetails;
700. Write a query to fetch only the first name(string before space) from the FullName
column of the EmployeeDetails table.
Ans. In this question, we are required to first fetch the location of the space character in the
FullName field and then extract the first name out of the FullName field.
For finding the location we will use the LOCATE method in MySQL and CHARINDEX in SQL
SERVER and for fetching the string before space, we will use the SUBSTRING OR MID
Page | 165
method.
FROM EmployeeDetails;
FROM EmployeeDetails;
701. Write an SQL query to uppercase the name of the employee and lowercase the city
values.
Ans. We can use SQL Upper and Lower functions to achieve the intended results.
SELECT UPPER(FullName), LOWER(City)
FROM EmployeeDetails;
702. Write an SQL query to find the count of the total occurrences of a particular
character – ‘n’ in the FullName field.
Ans. Here, we can use the ‘Length’ function. We can subtract the total length of the FullName
field from the length of the FullName after replacing the character – ‘n’.
SELECT FullName,
FROM EmployeeDetails;
703. Write an SQL query to update the employee names by removing leading and trailing
spaces.
Ans. Using the ‘Update’ command with the ‘LTRIM’ and ‘RTRIM’ functions.
UPDATE EmployeeDetails
Page | 166
704. Fetch all the employees who are not working on any project.
Ans. This is one of the very basic interview questions in which the interviewer wants to see if the
person knows about the commonly used – Is NULL operator.
SELECT EmpId
FROM EmployeeSalary
705. Write an SQL query to fetch employee names having a salary greater than or equal to
5000 and less than or equal to 10000.
Ans. Here, we will use BETWEEN in the ‘where’ clause to return the EmpId of the employees
with salary satisfying the required criteria and then use it as a subquery to find the fullName of
the employee from the EmployeeDetails table.
SELECT FullName
FROM EmployeeDetails
WHERE EmpId IN
SQL Server-
SELECT getdate();
Oracle-
Page | 167
707. Write an SQL query to fetch all the Employee details from the EmployeeDetails table
who joined in the Year 2020.
Ans. Using BETWEEN for the date range ’01-01-2020′ AND ’31-12-2020′-
SELECT * FROM EmployeeDetails
AND '2020/12/31';
Also, we can extract the year part from the joining date (using YEAR in MySQL)-
708. Write an SQL query to fetch all employee records from the EmployeeDetails table
who have a salary record in the EmployeeSalary table.
Ans. Using ‘Exists’-
SELECT * FROM EmployeeDetails E
WHERE EXISTS
709. Write an SQL query to fetch the project-wise count of employees sorted by project’s
count in descending order.
Ans. The query has two requirements – first to fetch the project-wise count and then to sort the
result by that count.
For project-wise count, we will be using the GROUP BY clause and for sorting, we will use the
ORDER BY clause on the alias of the project count.
SELECT Project, count(EmpId) EmpProjectCount
FROM EmployeeSalary
GROUP BY Project
Page | 168
ORDER BY EmpProjectCount DESC;
710. Write a query to fetch employee names and salary records. Display the employee
details even if the salary record is not present for the employee.
Ans. This is again one of the very common interview questions in which the interviewer just
wants to check the basic knowledge of SQL JOINS.
Here, we can use the left join with the EmployeeDetail table on the left side of the
EmployeeSalary table.
SELECT E.FullName, S.Salary
FROM EmployeeDetails E
LEFT JOIN
EmployeeSalary S
ON E.EmpId = S.EmpId;
FROM TableA
Page | 169
SQL Query Interview Questions for Experienced
Here is a list of some of the most frequently asked SQL query interview questions for
experienced professionals. These questions cover SQL queries on advanced SQL JOIN concepts,
fetching duplicate rows, odd and even rows, nth highest salary, etc.
712. Write an SQL query to fetch all the Employees who are also managers from the
EmployeeDetails table.
Ans. Here, we have to use Self-Join as the requirement wants us to analyze the EmployeeDetails
table as two tables. We will use different aliases ‘E’ and ‘M’ for the same EmployeeDetails
table.
SELECT DISTINCT E.FullName
FROM EmployeeDetails E
ON E.EmpID = M.ManagerID;
To learn more about Self Join along with some more queries, you can watch the below video that
explains the self-join concept in a very simple way.
713. Write an SQL query to fetch duplicate records from EmployeeDetails (without
considering the primary key – EmpId).
Ans. In order to find duplicate records from the table, we can use GROUP BY on all the fields
and then use the HAVING clause to return only those fields whose count is greater than 1 i.e. the
rows having duplicate records.
SELECT FullName, ManagerId, DateOfJoining, City, COUNT(*)
FROM EmployeeDetails
Page | 170
714. Write an SQL query to remove duplicates from a table without using a temporary
table.
Ans. Here, we can use delete with alias and inner join. We will check for the equality of all the
matching records and then remove the row with a higher EmpId.
DELETE E1 FROM EmployeeDetails E1
716. Write an SQL query to fetch only odd rows from the table.
Ans. In case we have an auto-increment field e.g. EmpId then we can simply use the below
query-
SELECT * FROM EmployeeDetails
In case we don’t have such a field then we can use the below queries.
Using Row_number in SQL server and checking that the remainder when divided by 2 is 1-
FROM (
FROM EmployeeSalary
)E
Page | 171
WHERE E.RowNumber % 2 = 1;
SELECT *
FROM (
FROM EmployeeSalary
)t
WHERE rn % 2 = 1;
717. Write an SQL query to fetch only even rows from the table.
Ans. In case we have an auto-increment field e.g. EmpId then we can simply use the below
query-
SELECT * FROM EmployeeDetails
In case we don’t have such a field then we can use the below queries.
Using Row_number in SQL server and checking that the remainder, when divided by 2, is 1-
FROM (
FROM EmployeeSalary
)E
Page | 172
WHERE E.RowNumber % 2 = 0;
SELECT *
FROM (
FROM EmployeeSalary
)t
WHERE rn % 2 = 0;
718. Write an SQL query to create a new table with data and structure copied from
another table.
Ans.
CREATE TABLE NewTable
719. Write an SQL query to create an empty table with the same structure as some other
table.
Ans. Here, we can use the same query as above with the False ‘WHERE’ condition-
CREATE TABLE NewTable
720. Write an SQL query to find the nth highest salary from a table.
Ans. Using Top keyword (SQL Server)-
Page | 173
FROM (
FROM Employee
SELECT Salary
FROM Employee
721. Write SQL query to find the 3rd highest salary from a table without using the
TOP/limit keyword.
Ans. This is one of the most commonly asked interview questions. For this, we will use a
correlated subquery.
In order to find the 3rd highest salary, we will find the salary value until the inner query returns a
count of 2 rows having the salary greater than other distinct salaries.
SELECT Salary
WHERE 2 = (
Page | 174
WHERE Emp2.Salary > Emp1.Salary
SELECT Salary
WHERE N-1 = (
SQL Joins are one of the most commonly used concepts while working with multiple tables. For
this reason, interview questions based on SQL joins are frequently asked during the interviews
involving SQL.
In this article, we have compiled top SQL joins interview questions (starting with the basic ones)
that you should prepare for the interviews. So let’s begin.
A simple example can be combining the two tables – EmployeeDetails and EmployeeSalary.
Now, we may look to join these two tables in order to get useful information like fetching the
name of the employee getting the highest salary. Since the name is present in the
Page | 175
EmployeeDetails table and salary is present in EmployeeSalary, so, we will join these two tables
using joins.
EmpId Name ManagerId
EmployeeDetails
121 P1 8000
321 P2 9000
421 P3 9500
EmployeeSalary
SELECT *
ON EmployeeDetails.EmpId = EmployeeSalary.EmpId;
Page | 176
Full Join-Full join is used to return all the records of both the tables as long as there is a
matching record in either table.
Self Join-Self join is a join that is used to join a table to itself. In a self-join, a table is
considered as if it were two tables.
Cartesian Join-Cartesian join is used to return the number of rows in the first table
multiplied by the number of rows in the second table. It is also referred to as cross join.
725. What is the difference between Full Join and Cross Join?
Ans. A Full Outer Join is a combination of a Left Outer and Right Outer Join. It returns all rows
in both tables that match the query’s WHERE clause, and in cases where the ON condition is not
satisfied, it puts NULL values.
Whereas, a Cross join produces a cartesian product between the two tables, returning all possible
combinations of all rows.
Example – In the below two tables the Employee and Department tables have a common field
‘EmpNo’. So, in the case of natural joins, we don’t need to mention the On clause over the
‘EmpNo’ field of both the tables.
EmpId Name City
568 KD Seattle
897 PK Austin
215 PP Miami
Employees
5466 HR 897
Page | 177
DeptId DName EmpId
5219 IT 215
8795 HK 568
Department
FROM Department
FROM TableName1
JOIN TableName2
ON TableName1.ColumnName = TableName2.ColumnName;
FROM TableName1
Page | 178
JOIN TableName2
729. What is the difference between cross join and natural join?
Ans. A cross join produces a cross product or cartesian product of two tables whereas the natural
join is based on all the columns having the same name and data types in both the tables.
1. Join combines rows of the tables that are present in the query.
2. Join is applicable when the number of columns present in the query is the same and the
corresponding attributes have the same domain.
3. There are two types of a union like UNION and UNION ALL.
4. The number of the resultant rows is more as compared to the number of rows present in
each table involved in the query.
Page | 179
EmpNo EmpName DeptId GenderId
Table – Employees
DeptId DeptName
101 HR
102 IT
Table – Department
GenderId Gender
01 Male
02 Female
Table – Gender
FROM Employees
Page | 180
API Testing Interview Questions
A list of frequently asked API Testing interview questions and answers are given below.
API (Application Programming Interface) helps in communication and data exchange between
two software systems. API act as an interface between two applications and allows the two
software systems communicate with one another. API is a collection of functions which can be
executed by another software program.
API works as; it takes a request from the source, takes that request to the database, fetches the
request data from the database and returns a response to the source. API takes the requests from
the user and gives the response without exposing the internal details. API acts as Abstraction.
Page | 181
Play Video
API testing is a type of software testing that involves testing APIs directly. API is a part of
integration testing to check whether the API meets expectations in terms of functionality,
reliability, performance, and security of applications. Multiple API system can performed API
testing. In API testing, our primary focus is on Business Logic Layer of the software
architecture.
o Unit Testing
o Functional Testing
o Load Testing
o Runtime/Error Detection
o Security Testing
o UI Testing
o Interoperability and WS compliance Testing
o Penetration Testing
o Fuzz Testing
Page | 182
735. What are the protocols used in API Testing?
o HTTP
o REST
o SOAP
o JMS
o UDDI
o Parasoft SOAtest
o PostMan
o AlertSite API monitoring
For API the test environment is a quite complex method where the configuration of server and
database is done as per the requirement of the software application. API testing does not involve
graphical user interface (GUI).
API framework is described by the config. File which consist of the list of all APIs that are
required to be activated and are activated for any particular program run. This is essential as
every test run does not require all APIs.
Page | 183
739. What are the limits of API usage?
Many APIs have certain limit set up by the provider. Hence, try to estimate our usage and
understand how that will impact the overall cost of the offering.
o Test for core functionality: API testing provides access to the application without the
user interface. The core functionality of the application will be tested before the GUI
tests. This will help to detect the minor issue which can become bigger during the GUI
testing.
o Time effective: API testing is less time consuming than GUI testing. Particularly, API
test requires less code so it can provide better and faster test coverage compare to GUI
test automation. This will reduce the cost for the testing project.
o Language Independent: In API testing data is exchange using XML or JSON. These
transfer mode are completely language-independent, which allows users to select any
code language when adopting automation test service for the project.
o Easy Integration with GUI: API tests provide highly integrable tests which is useful to
perform functional GUI tests after GUI tests. Simple integration would allow new user
accounts to be created within the application before GUI started.
1. Exhaustive Testing: Exhaustive testing is not possible. Instead we need optimal amount
of testing which is based on the risk assessment of the application.
2. Defect Clustering: Defect Clustering states that a small number of modules contain the
most of the defect detected. Approximately 80% of the defect found in 20% of the
modules. By experience we can identify such risky modules. But this approach has its
own problems. If the same tests are repeated over and over again, eventually the same
test case will no longer find new bugs.
Page | 184
3. Pesticide Paradox: Testers cannot depend on existing technique. They must have to look
continually to improve the existing method to make testing more effective. But even all
these hard work in testing we can never claim our product is bug free. To overcome this,
test cases need to be regularly reviewed and revised add new and different test cases to
help find more defects.
4. Testing shows presence of defects: Testing principle states that- testing talks about the
presence of defects not about the absence of defect. Software testing reduces the
probability of undiscovered defects remaining in the software but even if no defects
found, it is not a proof of correctness.
But if we work hard, taking all precautions and make our software products 99% bug
free. The software does not meet the needs and requirements of the client.
5. Absence of error -fallacy: This can be possible the software which is 99% bug free is
still unusable. The case can be if the system is tested for the wrong requirement. Software
testing is not finding the defects but also to check that software addresses the business
needs. The absence of error is fallacy i.e. finding and fixing defects does not help if the
system build is unusable and doesn't fulfill the user's needs and requirements.
6. Early Testing: Testing should start as soon as possible in the software development
lifecycle. So that defects in the requirement or design phase captured in the early stages.
It is cheaper to fix defect in the early stages of testing. We should start finding the bug at
the moment the requirements are defined.
7. Testing is context dependent: Testing is context dependent that we test an e-commerce
site will be different from the way we test the commercial. All the developed software's
are not identical. We will use different methodology; techniques and type of testing
depend on the application type.
Example: A framework can include predefined classes and functions that can be used to process
input, manage hardware devices and interact with system software.
Page | 185
Framework is similar to an Application Programming Interface, technically framework includes
API. Framework serves foundation for programming while API provides access to the elements
supported by the framework. Framework also includes code libraries, compiler and other
programs used in the software development process.
API framework is defined by configuration file which consists the list of all APIs that is required
to be activated and activated for a particular program run.
Here, are the common tests that performed on API are as:
1. Response of the API should be verified based on the request. We will verify that the
return value is based on request.
2. When API is updating any data structure we should verify the system is authenticating
the outcome.
3. We will verify whether the API is trigger other event or request another API.
4. We will verify the behavior of the API when no value is return.
In API testing, we send a request to API with the known data and then analysis the response.
Page | 186
No.
1. API may or may not need network for its operations. Web Services always need network for its
operation.
2. API can be communicated through SOAP, REST, XML- Web service can be communicated
RPC and CURL calls as well. through SOAP, REST, AND RPC.
API can also be exposed in number of ways like JAR,
DLL, XML over HTTP, JSON over HTTP etc.
3. API can perform all the operations which web service Web service can't perform all the
can't perform. operations like API.
4. All APIs are not web service. All web services are API
A good documentation is must for any foundation. API documentation serves as quick reference
for accessing library or working within a program.
When we use any such documents, it must consists of proper plan, content source, proper layout,
information related to each function etc.
There are various documentation tools like Doxygen and JavaDoc. Here, are the functions which
are documented which revolve around the parameters like:
o Function description
o Type and syntax of error message that may occure
o Syntax, elements and sequence needed for each parameter
o Links regarding functions
Here, are the various documentation template that make the whole process simple and easy. They
are:
Page | 187
o Swagger
o Miredot
o Slate
o FlatDoc
o API blueprint
o RestDoc
o Web service API specification
748.What are the types of bug that can be found during API testing?
o Stress
o Security
o Duplicate or missing functionality
o Reliability
o Unused flags
o Performance
o Incompatible error handling
o Multi-threaded issue
o Improper errors
749. What are the difference between API testing and UI testing?
UI (User Interface) testing means the testing of the graphical user interface. The focus of UI
testing is on the look and feel of the application. In user interface testing the main focus is on
how users can interact with app elements such as images, fonts, layout etc. are checked.
API testing allows the communication between two software systems. API testing works on
backend also known as backend testing.
Page | 188
750. What is SOAP?
SOAP (Simple Object Access Control) . It is an XML based protocol that helps in exchanging
information among computers.
REST API is a set of function helps the developers performing requests when the response is
receiving. Through HTTP protocol interaction is made in REST API.
REST is defined as Representational state transfer. It is an effective standard for API creation.
752. What are the differences between SOAP and REST API?
Sr. SOAP API REST API
No.
3. SOAP can work with XML format. In REST permit different data format such as Plain text, HTML,
SOAP all the data passed in XML XML, JSON etc. But the most preferred format for transferring
format. data is in JSON.
753. What are the major challenges faced during API testing?
o Parameter Selection
o Parameter Combination
Page | 189
o Call sequencing
o Output verification and validation
o A major challenge is providing input values which are very difficult because GUI is not
available.
754.What are the difference between API Testing and Unit Testing?
1. API testing is a form of black box testing. Unit testing is a form of white box testing.
2. API testing is performed after the project completion Unit testing is performed when the project is
during the test. created.
3. In API testing there is a wide scope of testing. In Unit testing there is a limited scope of
testing we can test only the basic functionality.
4. API testing is done by the testers. The whole purpose Unit testing is done by the developer. In unit
of API testing is end to end testing of the testing every functionality is separately tested.
functionality.
1. SOAP (Simple Object Access Protocol) - SOAP is a XML based method which is used in
Web Services.
Page | 190
2. RESTFUL Web Services - To implement the concept of REST architecture HTTP method is
used. RESTFUL Web Services defines URI (Uniform Resource Identifier), and also provides
resource representation like JSON and a set of HTTP method.
REST architecture treats any content as resource, which can be text files, HTML pages, images,
videos or dynamic business information. REST server gives the functionality to access the
resources and modifies them. We can identify the each resources by URIs/ global IDs.
REST uses different representation to define the resources like text, JSON and XML. The most
popular representation of resources is JSON and XML.
RESTFUL Web Services uses the HTTP protocol. They use the HTTP protocol as a medium of
communication between the client and the server.
1. REST is stateless. With the use of the REST API the server has no status, we can restart
the server between two calls, inspite of all the data is transferred to the server.
2. Web Services uses POST method to perform operations, while REST uses GET method
to access the resources.
RESTFUL Web Services use the HTTP protocol as a communication tool between the client and
the server. This is the technique when the client sends a message in the form of HTTP request
the server send back the HTTP reply which is called Messaging. This message consists message
data and Meta data i.e. information on the message itself.
Page | 191
761. What are the components of an HTTP request?
GET request can be cached and bookmark. It remains in the browser history and has length
restriction. When dealing with sensitive data GET requests should not be used.
POST: POST is used to send data to server for creation or updating the resources.
PUT: PUT replaces the current representation of the target resource with the request payload.
OPTIONS: OPTION is used to describe the communication option for the target resources.
HEAD: HEAD asks for response which is identical to GET requests, but without the response
body.
PUT or POST method is used create a resource. GET is only used to request the resources.
Page | 192
764.What is URI? What is the purpose of web-based service and what is it's format?
URI stands for Uniform Resource Identifier. It is a string of characters designed for
unambiguous identification of resources and extensibility by the URI scheme. The purpose of
URI is to locate the resource on the server hosting of the web service.
SOAP (Simple Object Access Protocol) is defined as the XML based protocol. SOAP is also
known for developing and designing web services and also enable the communication between
the applications developed on different platform by using different programming languages on
the internet. SOAP is platform and language independent.
We can use SOAP API to perform the operation on records like create, retrieve, update or delete.
We can use API to manage password, perform searches etc.
Page | 193
Top 55+ Most Asked Postman Interview Questions and Answers
Postman is a free HTTP client-based software application and a collaboration platform for API
development. It is mainly used to perform API testing. It is a very popular API client which
facilitates developers and provides a platform to design, build, share, test, and document APIs.
Postman supports testing of HTTP requests by utilizing GUI (Graphical User Interface), which
later we can execute and validate the responses.
The Postman tool also facilitates us to send HTTP/s requests to a service and get their responses.
We can ensure that the service is up and running by using this.
When the Postman was developed, it was originally a Chrome browser plugin. It extends its
solution with the native version for both Mac and Windows.
The Postman tool has become a choice of more than 8 million users. Following are the main
reasons for using Postman:
Play Video
o It is free: Postman is free software that we can use for API testing. It is free to download
and use for teams of any size.
o It is easy to use: Postman is an easy-to-use software tool. We can send HTTP requests of
various types (such as GET, POST, PUT, PATCH, etc.). We have to download it, and we
can send our first request in minutes. It also gives us the ability to save environments for
future use.
o Community & Support: It has a huge community forum for customer support and
extensive documentation.
o It is extensible: Postman facilitates us customizing it according to our needs with the
Postman API.
Page | 194
o APIs Support: It facilitates us to make any API call (REST, SOAP, or plain HTTP) and
easily inspect even the largest responses. It also helps manage the end-to-end lifecycle of
the API - starting from design to mocking to testing and finally maintaining the APIs.
o Runtime Services: Postman provides Runtime Services that help us manage API
collections, environments, work-spaces, and different examples.
o Integration: Postman facilitates us to easily integrate test suites into our preferred CI/CD
tools and services, such as Jenkins with Newman (command-line collection runner).
770.What is an API?
API is an acronym that stands for "Application Programming Interface". It is a set of routines,
protocols, and tools used for building Software applications. API is an interface, so it specifies
how one software program should interact with other software programs.
In other words, we can say that API is an Application Programming Interface that acts as an
interface between two software applications and allows these two software applications to
communicate with each other. API is a collection of software functions that another software
program can execute.
o API Key
o Oauth 1.0
o Oauth 2.0
o Bearer Token
o Basic auth
o Digest auth
o Hawk Authentication
o AWS Signature
o NTLM Authentication
Page | 195
772. What is the use of the collection in Postman?
In Postman, a collection is used to group similar requests. It systematically arranges the requests
into folders.
773. What are the various tools used for API Testing?
Following is a list of some tools that are used for API Testing:
o Postman
o SoapUI
o Katalon Studio
o Tricentis Tosca
o Apigee
o Jmeter etc.
We can access the Postman variables by using the variable name as:{{variable_name}}
o GET
o POST
o PUT
o PATCH
o COPY
o DELETE
o HEAD
o OPTIONS
Page | 196
o LINK
o UNLINK
o PURGE
o LOCK
o UNLOCK
o PROPFIND
o VIEW
An HTTP request is a programming request made by the client to a named host located on a
server. HTTP works as a communication interface or a request-response protocol between a
client and server. The main aim of the HTTP request is to access a resource on the server. To
make the HTTP request, the client uses components of a URL (Uniform Resource Locator),
which includes the information needed to access the resource.
A client (browser) sends an HTTP request to the server; then, the server responds to the client.
The response sent by the server contains the status information about the request, and it can also
contain the requested content.
o HTTP methods: It is a set of request methods used to perform needed action for a given
resource (GET, PUT, POST, and DELETE).
o Uniform Resource Identifier (URI): It is a kind of address that describes the resource.
o HTTP Version: It specifies the version of the HTTP. For example HTTP v1.1
o Request Headers: It specifies the content type and content length of the request. For
example: Content-type: application/ JSON, Content-Length: 511
o Payload: It is used to specify the Request Body that includes message content.
Page | 197
778.Why does Postman accept Base64 encoding only?
Postman accepts Base64 encoding only because it transmits the data into the textual form and
sends it in an easier form, such as HTML form data. This is also preferred because we can rely
on the same 64 characters in any encoding language we want to use.
779.Which type of encoding does Postman accept authorization credentials and why?
Postman accepts authorization credentials in Base64 encoding only. This is inbuilt in Postman,
or else you can refer to a third-party website to convert the credentials in base64. The Base64
authorization credentials are generally used because they transmit the data into a textual form
and send it in an easier form, such as HTML form data.
o Status/Response Code: The server generates the status or response codes when the client
makes a request. For example, 404 means Page Not Found, and 200 means Response is
OK.
o HTTP Version: It describes the HTTP version. For example: HTTP v1.1, HTTP v1.3 etc.
o Response Header: The Response Header includes the information for the HTTP response
message. For example, Content-type, Content-length, date, status, and server type.
o Response Body: The Response Body contains the client's data requested from the server.
In Postman, the term environment is a set of key-value pairs. You can create multiple
environments in Postman and switch among them quickly by pressing a button. There are 2 types
of environment, global and local.
Page | 198
782. Can we have two global scope variables with the same name in Postman?
The global variables are global, so we cannot set duplicate names for them without any
environment as it creates confusion for the software. On the other hand, local variables can have
the same name but in different environments.
In Postman, if 2 variables have the same name (one being local, the other global), then the higher
priority is of the local variable. The local variable will overwrite the global variable.
In Postman, we can log the variable values in the console by using the following command:
1. console.log(pm.variables.get("variable_name"));
The Postman monitor is used for running collections. Collections run till the specified time
defined by the users. It requires the users to be logged in, and the users share the Monitor reports
over an email on a daily or monthly basis.
As we know, a workspace is a collaborative environment for users to develop and test APIs. In
the same way, a team workspace is a workspace that is shared by the whole team working on the
same collections of requests. Usually, it is time-consuming and hard to share the collections
through external drives or other sharing; the team workspace synchronizes and collaborates all
the team's work in one place.
Query Params or Query Parameters are used for sorting or filtering the resources. On the other
hand, Path Variables are used for identifying specific resources.
Page | 199
788.What is the use of Postman Collection runners?
The Postman Collection runner is used to perform Data-driven testing. It runs a group of API
requests for multiple iterations with different data sets.
In Postman, Basic Auth is an authorization technique provided for HTTP user agents like web
browsers to enter username and password. After entering the username and password, it gets
associated with the request.
Yes, we can import local variables in Postman Monitors, but it is not allowed to import global
variables in Postman Monitors.
In POST methods, the binary form is designed to send data easily in a format it is impossible to
enter data manually. This is mainly used when sending large files like images, CSV files, etc., in
the POST request. The binary representation is one of the easiest representations used for
sending complex data with the request.
Page | 200
793.What is the use of Postman cloud when we are working in a company?
The Postman cloud is a common repository of companies to access Postman collections. That is
why we use it when we are working in a company. We can save the work instantly in the
Postman cloud after logging in. It facilitates the team members to access data/collections from
anywhere.
The digest auth or digest authorization is one of the authorization techniques provided by
Postman. This technique lets the clients send the request first to the API and get responses from
the server, including a number that can be used only once a real value and 401 unauthorized
responses. After that, the client can send back an encrypted data array with both username and
password and the data received from the server earlier. Now, the server uses this data to generate
an encrypted data string and compares this with what was sent for authenticating the request.
It is not suggested and is not preferred to save your work in the Postman cloud as the company's
work is not allowed to be leaked and remain confidential. While saving your work on Postman
cloud, it may cause a security breach as it requires sign-in. That's why the Postman Cloud is not
suggested for saving work, and team workspace is highly preferred.
The status code 201 means created when you have successfully created a resource using POST
or PUT request. It returns a link to a newly created resource using the location header.
The local variables are automatically removed once you have executed and completed the tests.
In Postman, there are two ways to save the responses of an API to a file:
Page | 201
o First, click on the download button in the response section.
o Second, click on the arrow next to the send button. Here, you will see an option to send
and download. After clicking on it, you will get a prompt Postman asking for the location
of saving the response post successful request execution.
The status code 304 means NOT MODIFIED. It is used to minimize the network bandwidth
usage in conditional GET requests. The response body should be empty. Headers should have a
date, and location, etc.
In Postman, the 301 status code is used to specify that the page has been permanently redirected
from one website page to another. It tells the search engine that the old page is outdated, and the
search engine has to index the new page URL.
o Global Variables: Global variables allow data access between different collections,
requests, and scripts. They are available throughout the workspace.
o Local Variables: Local variables are the temporary variables that can be accessed only
within the scope of requests scripts. Depending on the requirements, these variables are
either scoped to a single request or single collection. These variables are not available
once the script execution is completed.
o Environment Variables: The Environment variables allow us to tailor the requests about
different development environments such as local testing, stage testing, or prod testing.
Page | 202
o Collection Variables: The Collection variables are independent of the environment and
scoped to be available for all the requests present within the collection.
o Data Variables: The Data variables come from external JSON or CSV files and define
the datasets required to run the collection in Collection Runner or Newman.
The key difference between the form data and x-www-form-urlencoded is that the URL will be
prearranged when sent through x-www-form-urlencoded.
804.In which conditions should we use global, collection, and local variables?
Global variables are the general-purpose variables. They are used while passing data to other
requests and are ideal for quick results and prototyping.
Collection variables are generally used for storing some constants that do not change during the
execution of the collection. These variables are used for constants that do not change during the
execution and URLs / authentication credentials if only one environment exists.
Local variables are the temporary variables and are only available within the request that has set
them or when using Newman/Collection runner during the script execution. These variables are
used whenever we have to override all other variable scopes.
In Postman, we can access the history of requests in the History tab provided on the Postman
application. When we sign into the Postman account, the history will be synced across the
devices where you are logged in. After clicking on any of the requests present in the History tab,
the view will open the request that we saved while working on it earlier. History also contains
the collection runs that were executed as summarized versions.
When you click on the "View More option" on the request, you will see options to save,
document, monitor, delete or mock the request. You can also select multiple requests by using
Command or Control button and then clicking on the request.
Page | 203
806.How can we stop executing requests or stop the collection run?
We can stop executing requests or stop the collection run by using the following command:
1. postman.setNextRequest(null);
Yes, it is possible to reuse the authentication token for multiple requests. We can achieve it by
creating a collection and adding all the requests having the same authentication token to that
collection and then assigning the auth token to the same collection. We can apply it to the
individual requests by selecting the "Inherit auth from parent" option in the Authorization tab.
In the GET request, the query parameters are stored in the URL in Postman.
The pre-request scripts at the compilation level are executed first in a collection run.
o 200 (OK): Status code 200 specifies that the request was correct.
Page | 204
o 201 (Created): Status code 201 specifies that the value wrapped with the request has
been created in the database. Here, it is obvious that the request was correct.
o 204 (No Content): Status code 204 specifies that the request was correct and received,
but there is no content to send. It means there is no response to send to the client by the
server.
o 400 (Bad Request): Status code 400 specifies a bad request. A bad request means that
the syntax of the request was incorrect. It appears when we have sent the wrong
parameters along with the request URL or in the request's body.
o 401 (Unauthorized request): Status code 401 specifies an unauthorized request. An
unauthorized request is a request for which you are not authorized. This status code
appears when we are not authorized to access the server or enter the wrong credentials.
o 404 (Not Found): Status code 404 specifies that the server was connected, but it could
not find what was requested. It simply means "request not found". This status code
normally appears when we request a web page not available on the server.
Postman provides a space known as Scratch Pad. The Scratch Pad facilitates us to work without
being connected to Postman servers and also provides the flexibility to utilize some of the
features of Postman offline. These features include collection creation, creating requests, and the
ability to send requests. The Scratch Pads are stored locally, and once logged in; the work is
saved into the workspace.
o Get
o Post
o Put
o Delete
o Patch
o Head
Page | 205
o Delete
Some examples of the JS libraries available in Postman are Lodash, Moment, GUID, etc.
GUID is an acronym that stands for Global Unique Identifier. It is a set of hexadecimal digits
separated by hyphens and solves the purpose of uniqueness.
Example:
1. {
2. "id": "{{$guid}}",
3. }
In Postman, we can generate random numbers of a given range using some script. Suppose you
want to generate numbers between the range of 1 to N, then use the following pre-request script:
Page | 206
820.How can we view request logs and response logs in Postman?
We can view request logs and response logs in Postman through the Postman Console window.
In Postman, the binary form is designed to send the information in a specific format that cannot
be entered manually. For example, images, files, etc. Everything in a computer is converted to
binary.
The functional method is advised and recommended while writing tests in Postman. Although we
can use JavaScript methods, there has been no notice of ending the support for the JavaScript
method.
Page | 207
825. What are the challenges faced in API testing?
5. Using programming languages like PHP or .NET, execute the API call
Accuracy of data
Schema validation
Authorization checks
Page | 208
Non-functional testing like performance and security testing
The most common API documentation templates are: Swagger, RestDoc, FlatDoc, Slate, Web
Services API Specification, API Blueprint, and Miredot.
TestApi is known as the library of test building blocks which are essential for developers and
testers when creating testing tools as well as automated test suites.
830. What kinds of bugs does API testing find most commonly?
Stress
Reliability
Security
Unused flags
Performance
Multi-threading issues
Improper errors
2xx successful – the request was successfully received, understood, and accepted
4xx client error – the request contains bad syntax or cannot be fulfilled
Page | 209
5xx server error – the server failed to fulfill a valid request
Payload/body is a secured input data that is sent to API to process the request. The payload is
generally constructed in JSON format in REST API.
We can write a pre-request script to pass dynamic data or we can create a collection and pass
dynamic data using a CSV file.
Browser APIs are built-in with the browsers. They enable developers to implement complex
operations without administering the sophisticated lower-level code.
The implementation consisted of running the code from the JUnit tests into the APIs and then
refreshing the tests to summon those APIs. The modifyCertificate method, which gives the
implementation for the certificates resource PUT method, is the most difficult REST API to
implement.
REST is stateless, therefore the SERVER has no state (or session data).
With a well-applied REST API, the server could be restarted between two calls as every data is
passed to the server.
Web service mostly uses POST method to make operations, whereas REST uses GET to access
resources.
Page | 210
838. What is the most popular way to represent a resource in REST?
Caching is used for network optimization by reducing the load on servers. It is the ability to store
copies of frequently accessed data. Get Requests are by default cacheable, however, Post can be
made cacheable.
In short, a pre-request script is a script that runs before the execution of a request.
Two types of scripts in Postman are test script and pre-request script.
SOAP is more reliable than REST as it practices WS-Security for transmission with Secure
Socket Layer. Also, SOAP is state-full as it takes the request as a whole, unlike REST which
gives independent processing of various methods. No independent processing is present in
SOAP.
When using SOAP, users often experience firewall security mechanisms as the biggest obstacle.
This blocks all the ports, leaving a few like HTTP port 80 and the HTTP port used by SOAP that
bypasses the firewall. The technical complaint against SOAP is that it mixes the specification for
message transport with the specification for message structure.
Page | 211
847. Can we automate API testing?
Yes, we can automate API testing by using automation testing tools for API testing.
Yes, JMeter is good for API testing, especially REST API. JMeter is an open source tool used for
performance or load testing.
The PUT or POST method should be used to create a resource. GET is only used to request data
from a specified resource.
850. What is URI? What is the main purpose of REST-based web services and what is its
format?
URI stands for Uniform Resource Identifier. It is a string of characters designed for
unambiguous identification of resources and extensibility via the URI scheme.
The purpose of a URI is to locate a resource(s) on the server hosting of the web service.
Run Scope is an API testing tool that is typically a web application supporting an easier user
interface platform to test back-end services.
Page | 212
853. Is it possible to hack API while testing?
Yes, it is possible. This is because we are sending requests over the internet which mostly
follows HTTP protocol. This protocol is text-based and is easier to read. Hence, it is required to
perform security testing of the APIs to ensure safer systems.
To test the security of the API during API testing, we need to validate two components:
856. What is the most commonly used command-line tool to explore API?
The most commonly used command-line tool to explore API is cURL.
857. When a user attempts to access records that do not belong to them, what should the API
return in the response status code?
The API should return the 401 status code.
858. What is the kind of API traffic that is internal to the organization?
The Internal Traffic is internal to the organization.
859 Which among the following options is used for requesting JSON instead of XML from
API?
The Use Accept Header would be used for requesting JSON instead of XML with API.
API testing is generally black-box testing. We don't look at what happens behind the API server.
We only validate the responses.
Page | 213
862. Which markup language can be used in Restful Web API?
JSON and XML are the two markup languages that can be used in Restful Web API.
863. What is the upper limit for a payload to pass in the POST method?
GET appends data to the service URL. But, its size shouldn’t exceed the maximum URL length.
However, POST doesn’t have any such limit.
So, theoretically, a user can pass unlimited data as the payload to POST method. But, if we
consider a real use case, then sending POST with a large payload will consume more bandwidth.
It’ll take more time and present performance challenges to your server. Hence, a user should take
action accordingly.
REST outlines several guidelines that web services must follow to be considered RESTful. These
guidelines ensure that requests and resources are sent easily and efficiently between client and
server using standardized HTTP methods.
A REST API, also called a RESTful API, is an API that follows REST principles. In a REST
API, all data are treated as resources, each one represented by a unique uniform resource
identifier (URI). For example, the Twitter API makes each tweet an available resource that can
be retrieved by clients. Clients can also use Twitter’s API to post tweets and perform other
actions on the site.
Page | 214
Stateless: In stateless communication, the server does not store any information about past
requests/responses. Each request and response contains all information needed to complete the
interaction. Stateless communication reduces server load, saves memory, and improves
performance. It also eliminates the possibility of a failed request caused by missing data.
Layered system: Layers are servers that sit between the client and API server. These additional
servers perform various functions, like identifying spam and improving performance (See
also: What Is a CDN?). In REST, layers are modular and can be added and removed without
affecting the messages between the client and the API server.
Cacheable: Server responses indicate whether or not the resource is cacheable, so that clients
can cache any resources to improve performance.
Code on demand: An API can send executable computer code to clients in its response. This
lets the client application run the code in its own back end.
Statelessness simplifies client-server interactions because the server does not rely on past
requests to process future requests, and thus does not need to consume space and resources
storing data from these requests.
Page | 215
o a request method that indicates the HTTP request method to be performed on the resource (i.e.,
GET, POST, PUT, DELETE).
o a URI that identifies the requested resource on the server.
o the HTTP version being used, which signals which version the API should respond with.
HTTP Request Header: Lists metadata about the request, such as the user agent, file formats
the client will accept, format of the request body, language, caching preferences, etc.
HTTP Request body: Contains any data associated with the request. This is only necessary if
the request is to modify data on the server with the POST or PUT methods.
Page | 216
873. What is a resource?
Answer: In REST, every accessible piece of content on the server is labeled as a resource. A
resource is an object with a type, associated data, a relationship with other resources on the
server, and a list of methods that can be used with it. For example, a resource could be an HTML
or text file, a data file, an image or video, or an executable code file.
A resource is identified with a uniform resource identifier, or URI. Clients access resources by
including their URIs in HTTP requests.
<protocol>://<service-name>/<ResourceType>/<ResourceID>
875. What is caching?
Answer: Caching is the method of temporarily storing a copy of a server response in a location
(like computer memory) in order to retrieve it more quickly in the future.
When working with REST APIs, Caching improves server performance by reducing the work the
server has to do to fulfill the request. Caching also makes applications that use the API run faster
since they don’t need to send a new request every time they need a resource.
Cache duration of a resource (i.e., how long the resource can be cached by the client before the
resource is retrieved again) is specified in the HTTP response header with the Cache-
Control field.
Twitter allows publishing sites to pull information like tweets, users, tweet streams, and so on.
Developers can also write programs to post tweets through the API instead of the website
interface.
Airlines expose their flight times and prices through APIs so travel and ticketing sites can use
them.
To display weather information, weather apps harness public APIs that share weather data.
Page | 217
Public transportation services usually make their data publicly in real-time via APIs so that
mapping and navigation apps (like Google Maps) can use them.
In turn, Google Maps hosts several APIs that make its mapping data available to developers.
Developers leverage these APIs to palace dynamic maps on their websites or in their apps.
SOAP is a strict protocol for building secure APIs. REST is not a protocol — it is an
architectural style dictated by a set of guidelines (see question 3).
REST APIs are simpler to build, more lightweight, and generally faster than SOAP APIs.
SOAP APIs are considered more secure than REST APIs, though REST APIs can still
implement safety features to make them reasonably secure.
SOAP encodes data in XML format. REST allows you to encode data in any format, though
XML and JSON are most popular.
878. What is the difference between REST and AJAX?
Answer: Asynchronous JavaScript, or AJAX, is a set of web development techniques used in
web applications. At its core, AJAX allows a web page to make requests to a server and update
the page interface without needing to refresh.
An AJAX client might utilize REST APIs with its requests, but AJAX doesn’t have to work with
REST APIs exclusively. REST APIs can communicate with any client, whether the client uses
AJAX or not.
Also, unlike REST which uses HTTP requests and responses for messaging, AJAX sends its
requests to the server with the XMLHttpRequest object that is built into JavaScript. Server
responses are executed by the page’s JavaScript code to alter the page content.
879. What are some benefits of REST?
Answer: REST is by far the most common method for building web APIs. Here are some
reasons why:
REST is based around HTTP and fits within the existing infrastructure of the web, making it
easy to implement by web applications.
REST uses simple web technologies like XML and JSON, making it easy to learn.
Because REST communications are stateless, the client and server are decoupled. This means
that integrations are scalable and easy to build and manage over time.
Page | 218
The REST architecture is flexible enough to adapt to a huge variety of use cases.
REST is a lightweight architecture. Applications built with REST are generally faster than those
built with other types of APIs.
Additionally, REST is less strict with its security measures than SOAP, so developers need to be
cautious and only work with APIs from legitimate, reputable providers. It also makes REST a
poor choice for sending confidential information between servers and clients.
881. How do you test APIs?
Answer: There are many software tools designed for testing RESTful APIs — Postman, JMeter,
and Katalon Studio are a few. The testing process usually involves sending various requests from
your testing tool and monitoring how your API responds. Many testing tools also support
automated testing, allowing you to run many different scenarios quickly.
To learn more about how API testing works and what kinds of tests you can run, see our guide to
API testing.
882. How do you keep REST APIs secure?
Answer: REST APIs do not employ as strict security measures as SOAP APIs, and therefore
should not be used to send or retrieve sensitive information. However, good REST APIs still
implement safety measures for secure and reliable data transfers.
Authentication and authorization: All requests to the API should be authenticated and
authorized. Authentication is the process of verifying the identity of the client, and authorization
is confirming that the client has permission to access the requested resources.
Validation: After authentication and authorization, requests still need to be scanned for
potentially malicious code before the API gives access to its resources. Otherwise, a server will
be vulnerable to an injection attack.
Encryption: TLS/SSL encryption secures the connection between client and server and
prevents attackers from intercepting requests and responses.
Rate-limiting: Rate-limiting methods like quotas and throttling prevent brute-force attacks
like DDoS that attempt to slow or crash the server.
No sensitive information in URIs: Protected information (e.g., username, password, or
authentication token) should not be visible in the URI of a resource.
For more in-depth explanations, see our post on API security.
883. What are some main characteristics of REST?
Answer: If you’re asked to point out the main features that distinguish REST APIs from others,
here are some points to touch on:
REST makes server resources available via URIs. Each resource has a unique URI.
Page | 219
REST is stateless, meaning the server does not store information about past communications
with clients.
REST uses GET to retrieve resources from a server, whereas other web service methods use
POST.
887. Why does Postman never accepts any other encoding apart from Base64?
You can use base64 as it helps us transmit the data into the textual form and send it as HTML
form data. Moreover, we must rely upon the same 64 characters in any encoding language.
Page | 220
889. What is the Postman execution order for a collection?
For all the requests in a collection, the scripts will execute in the following given order:
Step 1) A pre-request script associated with a collection will run before every request.
Step 2) A pre-request script associated with a folder will run before every request in a specific
folder.
Step 3) A test script associated with a collection will run after every request.
Step 4) A test script associated with a folder will run after the request in the specific folder.
890.Can you have two global scope variables with the same name in Postman?
No, the global scope never has duplicate/same names, while variables having local scope can
have the same name in various environments.
891.How can you use POSTMAN to generate random numbers in a specific range?
In your Pre-request script define your variable with:
{{randomNum}}
893. Why saving your work in the Postman cloud is not advisable?
You should not save your work in Postman as your business details do not remain confidential.
Moreover, saving your on-Postman cloud may cause a security breach as it requires sign-in.
Therefore, saving your work in the Postman cloud is not advisable.
Page | 221
Postman is not an ideal API tool for workspace management in the form of code as there
can be lots of code duplication while handing the dynamic API requests.
897.Can you read the Postman Chrome application to read and write cookies?
No, it is impossible to read and write cookies using the app.
Page | 222
Basic GIT Interview Questions
A VCS keeps track of the contributions of the developers working as a team on the projects.
They maintain the history of code changes done and with project evolution, it gives an upper
hand to the developers to introduce new code, fixes bugs, and run tests with confidence that
their previously working copy could be restored at any moment in case things go wrong.
A repository is a file structure where git stores all the project-based files. Git can either stores
the files on the local or the remote repository.
The command creates a copy (or clone) of an existing git repository. Generally, it is used to get
a copy of the remote repository to the local repository.
The git config command is a convenient way to set configuration options for defining the
behavior of the repository, user information and preferences, git installation-based
configurations, and many such things.
For example:
To set up your name and email address before using git commands, we can run the below
commands:
Page | 223
903. Can you explain head in terms of git and also tell the number of heads that can be
present in a repository?
- To go or checkout to 1 commit before the latest commit, we use git checkout HEAD~1
- To uncommit the last 3 commits without losing the changes, we first run git reset HEAD~3.
Then we can see the changes made in the last 3 commits and then update it manually and
commit it finally.
- In order to uncommit the last 3 commits and also remove the changes, we can run the
command: git reset --hard HEAD~3. This command will completely remove all the changes.
- To look into the changes made in the last 3 commits, we can run git diff HEAD~3
- To make a new commit by reverting the last 3 commits, we can run the command: git revert -
-no-commit HEAD~3...HEAD
Git usually handles feature merges automatically but sometimes while working in a team
environment, there might be cases of conflicts such as:
1. When two separate branches have changes to the same line in a file
2. A file is deleted in one branch but has been modified in the other.
These conflicts have to be solved manually after discussion with the team as git will not be
able to predict what and whose changes have to be given precedence.
This command returns a tree object representation of the current repository along with the
mode and the name of each item and the SHA-1 value of the blob.
git status command is used for showing the difference between the working directory and the
index which is helpful for understanding git in-depth and also keep track of the tracked and
non-tracked changes.
Page | 224
907. Define “Index”.
Before making commits to the changes done, the developer is given provision to format and
review the files and make innovations to them. All these are done in the common area which is
known as ‘Index’ or ‘Staging Area’.
In the above image, the “staged” status indicates the staging area and provides an opportunity
for the people to evaluate changes before committing them.
This command adds files and changes to the index of the existing directory.
You can add all changes at once using git add . command.
You can add files one by one specifically using git add <file_name> command.
You can add contents of a particular folder by using git add /<folder_name>/ command.
With the help of git, developers have gained many advantages in terms of performing the
development process faster and in a more efficient manner. Some of the main features of git
which has made it easier to work are:
Branching Capabilities:
- Due to its sophisticated branching capabilities, developers can easily work on multiple
branches for the different features of the project.
- It also has an easier merge option along with an efficient work-flow feature diagram for
tracking it.
- Git is a distributed system and due to this nature, it became easier to trace and locate data if
it's lost from the main server.
- In this system, the developer gets a repository file that is present on the server. Along with
this file, a copy of this is also stored in the developer’s system which is called a local
repository.
- Due to this, the scalability of the project gets drastically improved.
- This feature helps in easier interaction amongst the developers of a team to coordinate merge-
Page | 225
operations.
- It keeps a proper track of the changes done by developers to the code.
- Due to the presence of a wide variety of features, git helps to increase the speed of the release
cycle and helps to improve the project workflow in an efficient manner.
Git stash can be used in cases where we need to switch in between branches and at the same
time not wanting to lose edits in the current branch. Running the git stash command basically
pushes the current working directory state and index to the stack for future use and thereby
providing a clean working directory for other tasks.
To delete a branch we can simply use the command git branch –d [head].
To delete a branch locally, we can simply run the command: git branch -d
<local_branch_name>
To delete a branch remotely, run the command: git push origin --delete
<remote_branch_name>
Deleting a branching scenario occurs for multiple reasons. One such reason is to get rid of the
feature branches once it has been merged into the development branch.
913. What differentiates between the commands git remote and git clone?
git remote command creates an entry in git config that specifies a name for a particular URL.
Whereas git clone creates a new git repository by copying an existing one located at the URL.
git stash apply command is used for bringing the works back to the working directory from the
stack where the changes were stashed using git stash command.
This helps the developers to resume their work where they had last left their work before
switching to other branches.
Page | 226
915. Differentiate between git pull and git fetch.
git pull git fetch
915. Can you give differences between “pull request” and “branch”?
pull request branch
This process is done when there is a need to put a developer’s A branch is nothing but a
change into another person’s code branch. separate version of the code.
“Push request” is termed so because it is done when the target repository requests us to push
our changes to it.
“Pull request” is named as such due to the fact that the repo requests the target repository to
grab (or pull) the changes from it.
917. Can you tell the difference between Git and GitHub?
Git GitHub
GitHub provides a variety of services like forking, user management, etc along with providing
a central repository for collaborative work.
Page | 227
918. What do the git diff and git status commands do?
git diff git status
This shows the changes between This shows the difference between the working directory
commits, working trees, etc. and index that is essential in understanding git in depth.
git diff works in a similar fashion to git status with the only difference of showing the
differences between commits and also between the working directory and index.
919. What has to be run to squash multiple commits (last N) into a single commit?
Squashing multiple commits to a single one overwrites the history which is why it is
recommended to be done using full caution. This step can be done by running the
command: git rebase -i HEAD~{{N}} where {{N}} represents the number of commits needed
to be squashed.
920. How would you recover a branch that has already pushed changes in the central
repository but has been accidentally deleted from every team member’s local machines?
We can recover this by checking out the latest commit of this branch in the reflog and then
checking it out as a new branch.
This command tracks every single change made in the repository references (that can be
branches or tags) and also maintains the branches/tags log history that was either created
locally or checked out. Reference logs such as the commit snapshot of when the branch was
created or cloned, checked-out, renamed, or any commits made on the branch are maintained
by Git and listed by the ‘reflog’ command.
This recovery of the branch is only possible when the branch was either created locally or
checked-out from a remote repository in your local repository for Git to store its reference
history logs.
This command should be executed in the repository that had the lost branch.
A set of files that represents the state of a project at a given point in time.
Reference to parent commit objects.
A 40 character string termed as SHA-1 name uniquely identifies the commit object.
Page | 228
922. Explain the levels in git config and how can you configure values using them?
In order to make git work, it uses a set of configurations that are pre-defined by default by
means of configuration files (or config files). We can change the default behavior of git by just
modifying these files which are basically text files. In order to do this, it is important to
understand how git identifies these files. It does so by following the below steps:
- Firstly, git searches for the config values in the system-wide gitconfig file stored
in <<installation_path>>/etc/gitconfig file that has settings defined and applied to every
user of the system and all their repos.
- In case you want git to search from this particular file and read/write on it, we can pass the
option --system to git config command.
- Next, git searches for the ~/.gitconfig file or ~/.config/git/config that has the scope specific to
the user.
- Git can be made to read/ write from this file specifically bypassing --global to the git config
command.
- Lastly, git searches for the config values in the git directory of the local repository that we are
currently working on.
- These config values are specific to that particular repository alone and can be accessed by
passing --local to the git config command.This is the default config file that gets accessed and
modified upon in case we do not specify any levels.
923. What is a detached HEAD and what causes this and how to avoid this?
Detached HEAD indicates that the currently checked-out repository is not a local branch. This
can be caused by the following scenarios:
When a branch is a read-only branch and we try to create a commit to that branch, then the
commits can be termed as “free-floating” commits not connected to any branch. They would be
in a detached state.
When we checkout a tag or a specific commit and then we try to perform a new commit, then
again the commits would not be connected to any branch. When we now try to checkout a
branch, these new commits would be automatically placed at the top.
In order to ensure that detached state doesn't happen, =instead of checking out commit/tag, we
can create a branch emanating from that commit and then we can switch to that newly created
branch by using the command: git checkout -b <<new_branch_name>>. This ensures that a
new branch is checkout out and not a commit/tag thereby ensuring that a detached state
wouldn't happen.
Page | 229
924. What does git annotate command do?
This command annotates each line within the given file with information from the commit
which introduced that change. This command can also optionally annotate from a given
revision.
Syntax: git annotate [<options>] <file> [<revision>]
You can get to learn more about this command from the official git documentation here.
925. What is the difference between git stash apply vs git stash pop command?
git stash pop command throws away the specified stash (topmost stash by default) after
applying it.
git stash apply command leaves the stash in the stash list for future reuse. In case we wanted to
remove it from the list, we can use the git stash drop command.
926. What command helps us know the list of branches merged to master?
git branch --merged helps to get the list of the branches that have been merged into the current
branch.
Note: git branch --no-merged lists the branches that have not been merged to the current
branch.
Conflicts occur whenever there are multiple people working on the same file across multiple
branches. In such cases, git won't be able to resolve it automatically as it is not capable of
deciding what changes has to get the precedence.
Following are the steps are done in order to resolve git conflicts:
1. Identify the files that have conflicts.
2. Discuss with members who have worked on the file and ensure that the required changes are
done in the file.
3. Add these files to the staged section by using the git add command.
4. Commit these changes using the git commit command.
5. Finally, push the changes to the branch using the git.
928. What is best advisable step in cases of broken commit: Create an additional commit
OR amend an existing commit?
It is always advisable to create an additional commit rather than amending the existing commit
due to the following reasons:
- Doing the amend operation destroys the previously saved state of that commit. If only the
Page | 230
commit message gets changes or destroyed, it's acceptable but there might be cases when the
contents of the commits get amended. This results in the loss of important information
associated with the commit.
- Over usage of git commit --amend can have severe repercussions as the small commit amend
can continue to grow and gather unrelated changes over time.
There can be cases where we want to revert from the pushed changes and go back to the
previous version. To handle this, there are two possible approaches based on the situations:
Approach 1: Fix the bad changes of the files and create a new commit and push to the remote
repository. This step is the simplest and most recommended approach to fix bad changes. You
can use the command: git commit -m "<message>"
Approach 2: New commit can be created that reverts changes done in the bad commit. It can
be done using git revert <name of bad commit>
This command is used to introduce certain commits from one branch onto another branch
within the repository. The most common use case is when we want to forward- or back-port
commits from the maintenance branch to the development branch.
931. Explain steps involved in removing a file from git index without removing from the
local file system?
Sometimes we end up having certain files that are not needed in the git index when we are not
being careful while using the git add command. Using the command git rm will remove the file
from both the index and the local working tree which is not always desirable.
Instead of using the git rm command we can use the git reset command for removing the file
from the staged version and then adding that file to the .gitignore file to avoid repeating the
same mistake again.
932. What are the factors involved in considering which command to choose among: git
merge and git rebase?
Both these commands ensure that changes from one branch are integrated into another branch
but in very different ways. Git rebasing can be thought of as saying to use another branch as a
new base for the work.
Page | 231
Following are some factors that tell when to use merge and rebase commands:
In case our branch gets contributions from other developers outside the team as in open-source
or public repositories, then rebase is not preferred.
- This is because rebase destroys the branch and it results in broken and inconsistent
repositories unless the git pull --rebase command is used.
Rebase is a very destructive operation. If not applied correctly, it results in loss of committed
work which might result in breaking the consistency of other developer’s contribution to the
repository.
If the model of having branches per feature is followed, rebasing is not a good idea there
because it keeps track of related commits done by the developers. But in case the team follows
having branches per developer of the team, then the branch has no additional useful
information to be conveyed. In this model, rebasing has no harm and can be used.
If there is any chance where there might be a necessity to revert a commit to previous commits,
then reverting a rebase would be almost impossible as the commit data would be destroyed. In
such cases, the merge can be used.
933. How do you find a commit which broke something after a merge operation?
This can be a time-consuming process if we are not sure what to look at exactly. Fortunately,
git provides a great search facility that works on the principle of binary search as git-
bisect command.
The initial set up is as follows:
Upon running the above commands, git checks out a revision that is labeled as halfway
between “good” and “bad” versions. This step can be run again by marking the commit as
“good” or “bad” and the process continues until the commit which has a bug is found.
934. What are the functionalities of git reset --mixed and git merge --abort?
git reset --mixed command is used for undoing changes of the working directory and the git
index.
git merge --abort command is used for stopping the merge process and returning back to the
state before the merging occurred.
Page | 232
935. Can you tell the differences between git revert and git reset?
git revert git reset
This command is used for creating a new commit This command is used for undoing the local
that undoes the changes of the previous commit. changes done in the git repository
Using this command adds a new history to the This command operates on the commit
project without modifying the existing history history, git index, and the working directory.
Page | 233
Jenkins Interview Questions For Freshers
Jenkins is a self-contained, open-source automation server that can be used to automate all
sorts of tasks related to building, testing, and delivering or deploying software. Jenkins can be
installed through native system packages, Docker, or even run standalone by any machine with
a Java Runtime Environment (JRE) installed.
Based on the level of automation, the above three paradigms can be better represented as below
-
938. What are the common use cases Jenkins is used for?
Jenkins being open-source automation can be used for any kind of software-based automation.
Some of the common use-cases include but not limited to -
Page | 234
939. What are the ways to install Jenkins?
1. Native System Package Manager like - apt (Linux), brew (Mac), etc.
2. Docker (popular docker images for Jenkins is available for different platforms like
Unix/Mac/Windows in the docker registry)
3. Kubernetes (available as a helm chart and can be installed on our Kubernetes clusters)
4. Standalone (on any machine with a Java Runtime Environment installed)
A Job/Project is the fundamental unit of a logical work (like a software build, an automation
task, test execution, etc) using the Jenkins automation server and other required plugins,
configurations & infrastructures.
Jobs can be of different types like - a freestyle project, a multi-configuration project, a pipeline
project, a multi-branch project, etc
Jenkins Pipeline
The pipeline is a special type of Jenkins job - simply a sequence of steps controlled by a
defined logic - which Orchestrates long-running activities that can span across multiple build
agents. It is suitable for building pipelines (formerly known as workflows) and/or organizing
complex activities that cannot be easily achieved using a freestyle job.
Page | 235
943. Explain Jenkins Multibranch Pipeline?
Jenkins Multibranch Pipeline
It is a pipeline job that can be configured to Create a set of Pipeline projects according to the
detected branches in one SCM repository. This can be used to configure pipelines for all
branches of a single repository e.g. if we maintain different branches (i.e. production code
branches) for different configurations like locales, currencies, countries, etc.
Credentials can be stored securely in Jenkins using the Credentials plugin, which stores
different types of credentials like - Username with a password, SSH username with the private
key, AWS Credentials, Jenkins Build Token, Secret File/Text, X509 & other certificates, Vault
related credentials securely with proper encryption & decryption as and when required.
945. How can we stop a scheduled job from being executed temporarily?
Disable the job from the job details page to temporarily stop all scheduled executions & other
factors/events from triggering the job and enable it back to resume the job schedules/triggers.
If a job is not required permanently, we can delete the job from the jobs list view page.
Intermediate Questions
There are many ways we can trigger a job in Jenkins. Some of the common ways are as below
-
Trigger an API (POST) request to the target job URL with the required data.
Trigger it manually from the Jenkins web application.
Trigger it using Jenkins CLI from the master/slave nodes.
Time-based Scheduled Triggers like a cron job.
Event-based Triggers like SCM Actions (Git Commit, Pull Requests), WebHooks, etc.
Upstream/Downstream triggers by other Jenkins jobs.
Build Cause is a text attribute that represents what made a job's build to be triggered, say it
could be a Jenkins User (from UI), Timer for Scheduled jobs, Upstream jobs for a job which
was triggered by upstream job, etc. This is mainly used to identify the nature of the builds - be
it nightly, manual, automated, etc.
Page | 236
948. How Jenkins knows when to execute a Scheduled job/pipeline and how it is
triggered?
Jenkins master will have the cron entries set up for the jobs as per the scheduled Job's
configurations. As and when the time for a particular job comes, it commands agents (based on
the configuration of the job) to execute the job with required configurations.
In Jenkins, credentials are a set of information used for authentication with internal/external
services to accomplish an action. Jenkins credentials are provisioned & managed by a built-in
plugin called - Credentials Binding - plugin. Jenkins can handle different credentials as follows
-
And as we can guess, this can be extended to several other extensible credential types like -
AWS credential, Azure secrets, etc. using commonly available plugins.
Jenkins credentials can be of one of the two scopes - Global & System
Global - the credential will be usable across all the jobs configured in the Jenkins instance (i.e.
for all jobs). This is more suited for user Jobs (i.e. for the freestyle, pipeline, or other jobs) to
authenticate itself with target services/infrastructures to accomplish the purpose of the job)
System - This is a special scope that will allow the Jenkins itself (i.e. the core Jenkins
functionalities & some installed plugins) to authenticate itself to external
services/infrastructures to perform some defined tasks. E.g. sending emails, etc.
As an organization starts using more and more pipeline jobs, there is a chance for more and
more code being duplicated in every pipeline job, since a part of the build/automation
processes will be the same for most of the jobs. In such a situation, every other new upcoming
job should also duplicate the same piece of code. To avoid duplications, the Jenkins project
brought in the concept of Shared Libraries, to code - DRY - Don't Repeat Yourself.
Page | 237
Shared libraries are a set of code that can be common for more than one pipeline job and can
be maintained separately. Such libraries improve the maintenance, modularity & readability of
the pipeline code. And it also speeds up the automation for new jobs.
Retrieving information about jobs, views, nodes, builds, etc. from Jenkins for programmatic
consumption.
Trigger a build (both parameterized & non-parameterized), stop/abort a build, enable/disable a
Job, group/remove jobs into/from views, etc.
Create/copy/modify/delete jobs.
and many other programming language-specific functionalities. It has wrappers for main
programming languages like - Python, Ruby & Java. It can be triggered via CURL as below -
953. How to get the Jenkins version programmatically in Jobs/Pipelines or nodes other
than master?
To check the version of Jenkins, load the top-level page or any top-level Remote Access API
path like the '.../api/*' page and then check for the 'X-Jenkins' response header.
This contains the version number of Jenkins, like "1.404". This is also a good way to check if
an URL is a Jenkins URL.
954. What happens when a Jenkins agent is offline and what is the best practice in that
situation?
When a job is tied to a specific agent on a specific node, the job can only be run on that agent
and no other agents can fulfill the job request. If the target node is offline or all the agents on
that particular node are busy building other jobs, then the triggered job has to wait until the
node comes online or an agent from that node becomes available to execute the triggered build
request.
Page | 238
As a result, a triggered job may sometimes wait indefinitely without knowing that the target
node is offline. So, it is always the best practice to tie the jobs to a group of nodes & agents,
referred to with a 'Label'. Once a job is tied to a Label, instead of a specific node/agent, any of
the nodes/agents falling under the label can fulfill a build request, when a job is triggered. This
way we can reduce the overall turn-around time of the builds.
Even then if a job is waiting for more time for the nodes/agents, then it is time to consider
adding more nodes/agents.
Blue Ocean is the redefined user experience for Jenkins. Designed from the ground up for
Jenkins Pipeline, it is still compatible with freestyle jobs, Blue Ocean reduces clutter and
increases clarity. Blue Ocean’s main features include -
Sophisticated visualizations of continuous delivery (CD) Pipelines, allowing for fast and
intuitive comprehension of your Pipeline’s status.
Pipeline editor - makes the creation of Pipelines approachable by guiding the user through an
intuitive and visual process to create a Pipeline.
Personalization to suit the role-based needs of each member of the team.
Pinpoint precision when intervention is needed and/or issues arise. Blue Ocean shows where in
the pipeline attention is needed, facilitating exception handling and increasing productivity.
Native integration for branch and pull requests, enables maximum developer productivity when
collaborating on code with others in GitHub, Bitbucket, etc.
Conventional UI Jenkins
Jenkins has a mechanism known as "User Content", where administrators can place files inside
the $JENKINS_HOME/userContent folder and these files are served from
yourhost/jenkins/userContent.
This can be thought of as a mini HTTP server to serve images, stylesheets, and other static
resources that you can use from various description fields inside Jenkins.
Continuous integration is a process where a developer’s code changes are constantly integrated
into the main code and the same will be tested automatically and the results of the tests will
decide whether the change is ready for deployment. In this process -
Page | 239
Developer Makes a change - commit/pull_request - in feature/dev branch
Source Control Management system generates appropriate events
SCM Specific Jenkins Plugins like Git/SVN will detect those events from the configured
repositories and these events will be used to Trigger - build/dependent/test - jobs on Jenkins
After the Test/Dependent jobs are completed, the change/patch will be labeled according to the
status of the test job
Based on the Status (i.e. readiness of a change to be merged with the main branch), the
Continuous Delivery or Continuous Deployment strategy/tool will take it forward.
Artifacts are the exportable/storable/archivable results of a specific job build. This can be
configured using a plugin called - Copy artifact Plugin. Based on the configured pattern, the
files/directories matching the configured patterns will be archived for a Jenkins build, which
can be used for future references. In the pipeline, it can be configured as follows -
Artifact archival takes in a pattern for matching target files. Similarly, it also takes in a pattern
(ANT build system pattern for matching files) for exclusion as well which will be ignored
while selecting the files for archival.
For e.g.
archiveArtifacts artifacts: 'output/*.txt', excludes: 'output/specific_file.txt'
The above command will archive all the text files from the output folder except
specific_file.txt
960. How can we share information between different build steps or stages in a Jenkins
Job?
Every build step or stage will be running in its process and hence sharing information between
two different build steps is not so direct. We can use either a File, a Database Entry, an
Environment Variable, etc. to share info from one build step to another or a post-build action.
Using language-specific code coverage plugins like JaCoCo, CodeCov, etc or generic
tools/plugins like Sonarqube which will add the code coverage data to builds with some minor
tweaks in the code and the same can be displayed as a graph in Jenkins.
Page | 240
962. Default Environment Variables by Jenkins & How to introduce custom environment
variables?
From the Job details page, we can use Job Config History to - See diff, Review & Revert the
Job configs from the history of changes we have made to a particular job. This will be super
useful when a job is misconfigured by someone by mistake, it can be reviewed and reverted
easily to any of its earlier states.
Global Tools are tools that need to be installed outside the Jenkins environment and need to be
controlled from within the Jenkins environment. Hence it needs its corresponding Jenkins
plugin as well. Steps to using a Global Tool generally include -
Install the tool Plugin into the Jenkins instance, to include the global tool into a list of global
tools used by Jenkins.
Install the tool in the Jenkins instance or provide away (maybe a command to download and)
install the tool during runtime.
Go to Manage Jenkins -> Global Tools Configuration and Scroll through the tool list and
configure the global tool-specific configurations.
Make use of the installed global Tool in your job/pipeline.
Basic requirements for a Jenkins shared library to be used in a Pipeline Code are -
E.g.
#!/urs/bin/env groovy
@Library('[email protected]')_
Page | 241
966. How to install a Custom Jenkins Plugin or a Version of Plugin Not available in
Jenkins Update Center?
Generally, it is the best practice to use the latest version of a plugin. But there are ways to
install custom plugins or outdated versions of a published plugin. Jenkins Plugins are exported
using a .hpi file and the same can be installed in multiple ways -
The above command Installs a plugin either from a file, an URL or from the update center.
SOURCE: If this points to a local file, that file will be installed. If this is an URL, Jenkins
downloads the URL and installs that as a plugin. Otherwise, the name is assumed to be the
short name of the plugin in the existing update center (like "findbugs") and the plugin will be
installed from the update center.
-deploy: Deploy plugins right away without postponing them until the reboot.
-name VAL: If specified, the plugin will be installed as this short name (whereas normally the
name is inferred from the source name automatically).
-restart: Restart Jenkins upon successful installation.
Assuming a .hpi file has been downloaded, a logged-in Jenkins administrator may upload the
file from within the web UI:
Navigate to the Manage Jenkins > Manage Plugins page in the web UI.
Click on the Advanced tab.
Choose the .hpi file under the Upload Plugin section.
Upload the plugin file.
Restart the Jenkins instance
Assuming a .hpi file has been explicitly downloaded by a systems administrator, the
administrator can manually place the .hpi file in a specific location on the file system.
Copy the downloaded .hpi file into the JENKINS_HOME/plugins directory on the Jenkins
controller (for example, on Debian systems JENKINS_HOME is generally /var/lib/jenkins).
The master will need to be restarted before the plugin is loaded and made available in the
Jenkins environment.
Page | 242
967. How to download the Console log for a particular Jenkins build programmatically?
Produces the console output of a specific build to stdout, as if you are doing 'cat build.log'
E.g.
Jenkins provides remote access API to most of its functionalities (though some functionalities
are programming language-dependent). Currently, it comes in three flavors -
XML
JSON with JSONP support
Python
Remote access API is offered in a REST-like style. That is, there is no single entry point for all
features, and instead, they are available under the ".../api/" URL where the "..." portion is the
data that it acts on.
For example, if your Jenkins installation sits at interviewbit.com, visiting /api/ will show just
the top-level API features available – primarily a listing of the configured jobs for this Jenkins
instance.
Jenkins, and several plugins, allow users to execute Groovy scripts in Jenkins. To protect
Jenkins from the execution of malicious scripts, these plugins execute user-provided scripts in
a Groovy Sandbox that limits what internal APIs are accessible.
Page | 243
This protection is provided by the Script Security plugin. As soon as an unsafe method is used
in any of the scripts, the "In-process Script Approval" action should appear in "Manage
Jenkins" to allow Administrators to make a decision about which unsafe methods, if any,
should be allowed in the Jenkins environment.
This in-process script approval inherently improves the security of the overall Jenkins
ecosystem.
Common monitoring platforms like DataDog, Prometheus, JavaMelody & few others - have
their corresponding Jenkins plugin, which when configured, sends Metrics to the
corresponding Monitoring platform, which can then be Observed with the latest tools &
technologies. The same can be configured with Alarms & Notifications for immediate attention
when something goes wrong.
This is to avoid an infinite hang, as some of the failure modes in the network cannot be
detected otherwise. The timeout is also set to a long enough value so that a temporary surge in
the load or a long garbage collection pause will not trip off the close-down.
Ping thread is installed on both controller & agent; each side pings the other and tries to detect
the problem from their sides.
The ping thread time out is reported through java.util.logging. Besides, the controller will also
report this exception in the agent launch log. Note that some agent launchers, most notably
SSH agents, writes all stdout/stderr outputs from the agent JVM into this same log file, so you
need to be careful.
There are many ways we can trigger a job in Jenkins. Some of the common ways are as below -
Trigger an API (POST) request to the target job URL with the required data.
Trigger it manually from the Jenkins web application.
Trigger it using Jenkins CLI from the master/slave nodes.
Time-based Scheduled Triggers like a cron job.
Page | 244
Event-based Triggers like SCM Actions (Git Commit, Pull Requests), WebHooks, etc.
Upstream/Downstream triggers by other Jenkins jobs
Page | 245
SOFWARE TESTING PROJECT RELATED QUESTIONS
973. Explain your project?
Ans: Utah Retirement Systems administers pension plans and retirement savings plans for
public employees in the U.S. state of Utah. There are eight separate defined-benefit pension
plans administered by URS, as well as various retirement savings plans. As of December 31,
2014, the URS was managing over $31 billion in its pension trust funds, for nearly 200,000
members.[1] Besides the pension trust funds, the URS manages a 401(k), 457(b), a traditional
IRA and Roth IRA with around $4.5 billion in assets combined at the end of 2014. [2]
Membership[edit]
Members of the eight URS pension systems are the employees of over 700 different employers.
The two largest systems are the Public Employees Noncontributory Retirement Systems, Tier I
and Tier II, with 463 participating employers including all of Utah's school districts, the State of
Utah, and its counties and various political subdivisions. The old Contributory system has 159
employers, the Public Safety system has 131, and the Firefighters' system has 59 employers.
(Tier 2 Public Safety and Firefighters has 149.) There is a separate retirement system for Judges,
and one for Governors and Legislators. 161 employers participate in the URS 457 Savings Plans,
and 380 in the 401(k) Plans.[3]
Page | 246
975. What type of tests you have performed?
Ans:Unit Testing,System Testing,System Integration Testing Usability testing ,UI Testing
,Smoke testing ,Sanity testing ,Regression testing.
Also if requirement is matched I will apply various application checklist to verify the
requirement if its passed or not
It its fail I will report bug using NeoTrack,JIRA.
980. How many test cases have you designed? How many do you write in a day?
Ans:I Wrote and Desing around 25 test cases in a day.
Page | 247
27 HR Interview Questions and Answers
If you're the interviewer, there's a lot you should already know: The candidate's resume and
cover letter should tell you plenty, and LinkedIn and Twitter and Facebook and Google can tell
you more.
The goal of an interview is to determine whether the candidate will be outstanding in the job, and
that means evaluating the skills and attitude required for that job. Does she need to be an
empathetic leader? Ask about that. Does she need to take your company public? Ask about that.
If you're the candidate, talk about why you took certain jobs. Explain why you left. Explain why
you chose a certain school. Share why you decided to go to grad school. Discuss why you took a
year off to backpack through Europe, and what you got out of the experience.
When you answer this question, connect the dots on your resume so the interviewer understands
not just what you've done, but also why. Interviewers will be listening for a genuine response.
Every candidate knows how to answer this question: Just pick a theoretical weakness and
magically transform that flaw into a strength in disguise.
ADVERTISING
For example: "My biggest weakness is getting so absorbed in my work that I lose all track of
time. Every day I look up and realize everyone has gone home. I know I should be more aware
of the clock, but when I love what I'm doing I just can't think of anything else."
So your "biggest weakness" is that you'll put in more hours than everyone else? Great. A
seasoned interviewer has a BS detector that can easily pick up on such silliness.
A better approach for a candidate is to choose an actual weakness, but one you're working to
improve. Share what you're doing to overcome that weakness. No one is perfect, but
showing you're willing to honestly self-assess and then seek ways to improve comes pretty
darned close.
Although a job candidate's resume and experience should make their strengths readily apparent,
interviewers ask this popular interview question because they want to know how their skills can
drive a long-term growth in the company.
If you're asked, provide a sharp, on-point answer. Be clear and precise. If you're a great problem
solver, don't just say that: Provide a few examples, pertinent to the opening, that prove you're a
Page | 248
great problem solver. If you're an emotionally intelligent leader, don't just say that: Provide a few
examples that prove you know how to answer the unasked question.
In short, don't just claim to have certain attributes--prove you have those attributes.
Answers to this question go one of two basic ways. Candidates try to show their incredible
ambition (because that's what they think you want) by providing an extremely optimistic answer:
"I want your job!" Or they try to show their humility (because that's what they think you want)
by providing a meek, self-deprecating answer: "There are so many talented people here. I just
want to do a great job and see where my talents take me."
In either case, you learn nothing, other than possibly how well candidates can sell themselves.
For interviewers, here's a better question: "What business would you love to start?"
That question applies to any organization, because every employee at every company should
have an entrepreneurial mind-set.
The business a candidate would love to start tells you about her hopes and dreams, her interests
and passions, the work she likes to do, the people she likes to work with -- so just sit back and
listen.
Since candidates cannot compare themselves with people they don't know, all they can do is
describe their incredible passion and desire and commitment and, well, basically beg for the job.
(Way too many interviewers ask the question and then sit back, arms folded, as if to say, "Go
ahead. I'm listening. Try to convince me.")
Here's a better interview question: "What do you feel I need to know that we haven't discussed?"
Or even, "If you could get a do-over on one of my questions, how would you answer it now?"
Rarely do candidates come to the end of an interview feeling they've done their best. Maybe the
conversation went in an unexpected direction. Maybe the interviewer focused on one aspect of
their skills and totally ignored other key attributes. Or maybe candidates started the interview
nervous and hesitant, and now wish they could go back and better describe their qualifications
and experience.
Plus, think of it this way: Your goal as an interviewer is to learn as much as you possibly can
about every candidate, so don't you want to give them the chance to ensure you do?
Just make sure to turn this part of the interview into a conversation, not a soliloquy. Don't just
passively listen and then say, "Thanks. We'll be in touch." Ask follow-up questions. Ask for
examples.
Page | 249
And of course if you're asked this question, use it as a chance to highlight things you haven't
been able to touch on.
Job boards, general postings, online listings, job fairs -- most people find their first few jobs that
way, so that's certainly not a red flag.
But a candidate who continues to find each successive job from general postings probably hasn't
figured out what he or she wants to do -- and where he or she would like to do it.
So don't just explain how you heard about the opening. Show that you heard about the job
through a colleague, a current employer, by following the company--show that you know about
the job because you want to work there.
Employers don't want to hire people who just want a job; they want to hire people who want a
job with their company.
Now go deeper. Don't just talk about why the company would be great to work for; talk about
how the position is a perfect fit for what you hope to accomplish, both short-term and long-term.
And if you don't know why the position is a perfect fit, look somewhere else. Life is too short. A
skilled interviewee loves this interview question because a well-crafted answer shows
interviewers the value you will bring to the company.
Here's an interview question that definitely requires an answer relevant to the job. If you say
your biggest achievement was improving throughput by 18 percent in six months but you're
interviewing for a leadership role in human resources, that answer is interesting but ultimately
irrelevant.
Instead, talk about an underperforming employee you "rescued," or how you overcame infighting
between departments, or how so many of your direct reports have been promoted.
The goal is to share achievements that let the interviewer imagine you in the position -- and see
you succeeding.
993. "Tell me about the last time a co-worker or customer got angry with you. What
happened?"
Conflict is inevitable when a company works hard to get things done. Mistakes happen. Sure,
strengths come to the fore, but weaknesses also rear their heads. And that's OK. No one is
perfect.
Page | 250
But a person who tends to push the blame -- and the responsibility for rectifying the situation --
onto someone else is a candidate to avoid. Hiring managers would much rather choose
candidates who focus not on blame but on addressing and fixing the problem.
Every business needs employees who willingly admit when they are wrong, step up to take
ownership for fixing the problem, and, most important, learn from the experience.
Three words describe how you should answer this question: relevance, relevance, relevance.
But that doesn't mean you have to make up an answer. You can learn something from every job.
You can develop skills in every job. Work backward: Identify things about the job you're
interviewing for that will help you if you do land your dream job someday, and then describe
how those things apply to what you hope to someday do.
And don't be afraid to admit that you might someday move on, whether to join another company
or -- better -- to start your own business. Employers no longer expect "forever" employees.
Let's start with what you shouldn't say (or, if you're the interviewer, what are definite red flags).
Don't talk about how your boss is difficult. Don't talk about how you can't get along with other
employees. Don't bad-mouth your company.
Instead, focus on the positives a move will bring. Talk about what you want to achieve. Talk
about what you want to learn. Talk about ways you want to grow, about things you want to
accomplish; explain how a move will be great for you and for your new company.
Complaining about your current employer is a little like people who gossip: If you're willing to
speak badly of someone else, you'll probably do the same to me. An experienced interviewer will
push to get a real answer by asking this follow-up question: How is your current employer not
satisfying these needs?
Maybe you love working alone, but if the job you're interviewing for is in a call center, that
answer will do you no good.
So take a step back and think about the job you're applying for and the company's culture
(because every company has one, whether intentional or unintentional). If a flexible schedule is
important to you, but the company doesn't offer one, focus on something else. If you like
constant direction and support and the company expects employees to self-manage, focus on
something else.
Find ways to highlight how the company's environment will work well for you -- and if you can't
find ways, don't take the job, because you'll be miserable.
Page | 251
When you're the one in the interviewer's seat, you'll get a more honest answer by asking: What
do you care about most at work?
997. "Tell me about the toughest decision you had to make in the past six months."
The goal of this question is to evaluate the candidate's reasoning ability, problem-solving skills,
judgment, and possibly even willingness to take intelligent risks.
Having no answer is a definite warning sign. Everyone makes tough decisions, regardless of their
position. My daughter worked part-time as a server at a local restaurant and made difficult
decisions all the time -- like the best way to deal with a regular customer whose behavior
constituted borderline harassment.
A good answer proves you can make a difficult analytical or reasoning-based decision -- for
example, wading through reams of data to determine the best solution to a problem.
A great answer proves you can make a difficult interpersonal decision, or better yet a difficult
data-driven decision that includes interpersonal considerations and ramifications.
Making decisions based on data is important, but almost every decision has an impact on people
as well. The best candidates naturally weigh all sides of an issue, not just the business or human
side exclusively.
This is a tough question to answer without dipping into platitudes. Try sharing leadership
examples instead. Say, "The best way for me to answer that is to give you a few examples of
leadership challenges I've faced," and then share situations where you dealt with a problem,
motivated a team, worked through a crisis. Explain what you did and that will give the
interviewer a great sense of how you lead.
999. "Tell me about a time you disagreed with a decision. What did you do?"
No one agrees with every decision. Disagreements are fine; it's what you do when you disagree
that matters. (We all know people who love to have the "meeting after the meeting," where
they've supported a decision in the meeting but they then go out and undermine it.)
Show that you were professional. Show that you raised your concerns in a productive way. If you
have an example that proves you can effect change, great -- and if you don't, show that you can
support a decision even though you think it's wrong (as long as it's not unethical, immoral, etc.).
Every company wants employees to be honest and forthright, to share concerns and issues, but to
also get behind a decision and support it as if they agreed, even if they didn't.
Page | 252
1000. "Tell me how you think other people would describe you."
I hate this question. It's a total throwaway. But I did ask it once, and got an answer I really liked.
"I think people would say that what you see is what you get," the candidate said. "If I say I will
do something, I do it. If I say I will help, I help. I'm not sure that everyone likes me, but they all
know they can count on what I say and how hard I work."
1001. "What can we expect from you in your first three months?"
Ideally the answer to this should come from the employer: They should have plans and
expectations for you.
You'll work hard to determine how your job creates value -- you won't just stay busy,
you'll stay busy doing the right things.
You'll learn how to serve all your constituents -- your boss, your employees, your peers,
your customers, and your suppliers and vendors.
You'll focus on doing what you do best -- you'll be hired because you bring certain skills,
and you'll apply those skills to make things happen.
You'll make a difference -- with customers, with other employees, to bring enthusiasm and
focus and a sense of commitment and teamwork.
Then just layer in specifics that are applicable to you and the job.
Many companies feel cultural fit is extremely important, and they use outside interests as a way
to determine how you will fit into a team.
Even so, don't be tempted to fib and claim to enjoy hobbies you don't. Focus on activities that
indicate some sort of growth: skills you're trying to learn, goals you're trying to accomplish.
Weave those in with personal details. For example, "I'm raising a family, so a lot of my time is
focused on that, but I'm using my commute time to learn Spanish."
While this question has been a long-time favorite, new laws now make asking about salary
history off limits in some cities and states, including California, Massachusetts, and New York.
The aim of the new prohibitions is to end the cycle of pay discrimination.
Even so, it's still OK to ask: Does your current salary really reflect the market rate in your field?
Or, is your current salary what you hope to get in your next job?
Page | 253
For job candidates, this is a tough one. You want to be open and honest, but frankly, some
companies ask the question as the opening move in salary negotiations. Try an approach
recommended by Liz Ryan. When asked, say, "I'm focusing on jobs in the $50K range. Is this
position in that range?" (Frankly, you should already know--but this is a good way to deflect.)
Maybe the interviewer will answer; maybe she won't. If she presses you for an answer, you'll
have to decide whether you want to share or demur. Ultimately your answer won't matter too
much, because you'll either accept the salary offered or you won't, depending on what you think
is fair.
1004. "A snail is at the bottom of a 30-foot well. Each day he climbs up three feet, but at
night he slips back two feet. How many days will it take him to climb out of the well?"
Questions like these are now among the most popular interview questions (thanks, Google) in
recent years. As the interviewer, you're not necessarily looking for the right answer, but instead a
little insight into the job candidate's reasoning abilities.
Listen carefully as they talk through their logic as they try to solve the problem. Who cares if
people get it wrong? The best candidates will laugh at themselves. Assess how the interviewee
deals with failure. Moreover, do they know how to be a good communicator?
A great candidate doesn't waste this opportunity. Smart questions not only signal a great
candidate but also reveal to the candidate whether the company is a good fit for them. After all,
they're being interviewed, but they're also interviewing the company and have a keen sense of
the questions to ask during an interview.
Here goes:
A great job candidate will ask this question if they haven't already gleaned this information at
some point in their interview. Why? High performers want to hit the ground running. They don't
want to spend weeks or months "getting to know the organization." They don't want to spend
huge chunks of time in orientation, in training, or in the futile pursuit of getting their feet wet.
They want to make a difference--and they want to make that difference right now.
1007. "What are the three traits your top performers have in common?"
Great candidates also want to be great employees. They know every organization is different --
and so are the key qualities of top performers in those organizations. Maybe your top performers
work longer hours. Maybe creativity is more important than methodology. Maybe constantly
landing new customers in new markets is more important than building long-term customer
relationships. Maybe the key is a willingness to spend the same amount of time educating an
entry-level customer as helping an enthusiast who wants high-end equipment.
Page | 254
Great candidates want to know, because:
if they do fit in, they want to know how they can be a top performer.
Employees are investments, and you expect every employee to generate a positive return on his
or her salary. (Otherwise why do you have them on the payroll?)
In every job, some activities make a bigger difference than others. You need your HR team to fill
job openings, but what you really want is for them to find the right candidates, because that
results in higher retention rates, lower training costs, and better overall productivity.
You need your service techs to perform effective repairs, but what you really want is for those
techs to identify ways to solve problems and provide other benefits -- in short, to build customer
relationships and even generate additional sales.
Great candidates want to know what truly makes a difference and drives results, because they
know helping the company succeed means they will succeed as well.
1009. "What are the company's highest-priority goals this year, and how would my role
contribute?"
Is the job the candidate will fill important? Does that job matter?
Great candidates want a job with meaning, with a larger purpose -- and they want to work with
people who approach their jobs the same way.
Employees who love their jobs naturally recommend their company to their friends and peers.
The same is true for people in leadership positions -- people naturally try to bring on board
talented people they previously worked with. They've built relationships, developed trust, and
shown a level of competence that made someone go out of their way to follow them to a new
organization.
And all of that speaks incredibly well to the quality of the workplace and the culture.
Page | 255
1011. "What do you plan to do if ...?"
Every business faces a major challenge: technological changes, competitors entering the market,
shifting economic trends. There's rarely one of Warren Buffett's moats protecting a small
business.
So while some candidates may see your company as a stepping-stone, they still hope for growth
and advancement. If they do eventually leave, they want it to be on their terms, not because you
were forced out of business.
Say I'm interviewing for a position at your ski shop. Another store is opening less than a mile
away: How do you plan to deal with the competition? Or you run a poultry farm (a huge industry
in my area): What will you do to deal with rising feed costs?
Great candidates don't just want to know what you think; they want to know what you plan to do
-- and how they will fit into those plans.
00:20
02:19
Page | 256
CUCUMBER
Cucumber is a testing tool based on Behavior Driven Development (BDD) framework. It is used
to run functional tests written in plain text and develop test cases for software functionality. It
plays a supporting role in automated testing.
In other words, we can say that "Cucumber is a software tool used by the testers to develop test
cases for the testing of behavior of the software."
Pause
Unmute
Duration 18:10
Loaded: 1.10%
Â
Fullscreen
1014. What is the main aim of the Behavior Driven Development (BDD) framework?
The main aim of the Behavior Driven Development framework is to make various project roles
such as Business Analysts, Quality Assurance, Developers, etc., understand the application
without diving deep into the technical aspects.
Page | 257
1015. What language is used by the Cucumber tool?
The Cucumber tool uses the Gherkin language, a simple English representation of the application
behavior. The Gherkin language uses several keywords to describe the behavior of applications
such as Feature, Scenario, Scenario Outline, Given, When, Then, etc.
1016. What are the two files required to execute a Cucumber test scenario?
Following are the two files required to execute a Cucumber test scenario:
o Features
o Step Definition
A feature file is used to provide a high-level description of an Application Under Test (AUT).
The first line of the feature file must start with the keyword 'Feature' followed by the description
of the application under test. A feature file may include multiple scenarios within the same file,
and the extension of the feature file must be ".feature."
1018.What are the various keywords used in the Cucumber tool for writing a scenario?
Following are the keywords that are used for writing a scenario in the Cucumber tool:
o Given
o When
o Then
o And
In the Cucumber tool, the Background keyword is used to group multiple given statements into a
single group. The keyword is mostly used when the same set of given statements are repeated in
each scenario of the feature file.
Page | 258
1020. What is the usage of a Scenario Outline in the Cucumber tool?
In Cucumber, a Scenario outline is used as a parameter of scenarios. This is used when the same
scenario needs to be executed for multiple sets of data; however, the test steps remain the same.
Scenario Outline must be followed by the keyword 'Examples', which specify the set of values
for each parameter.
In Cucumber, a step definition is the actual code implementation of the feature mentioned in the
feature file.
The Cucumber tool supports multiple programming languages such as Java, .Net, Ruby, etc. You
can also integrate this tool easily with multiple tools such as Selenium, Capybara, etc.
Although Cucumber and Jbehave are designed for the same purpose, the most distinctive
difference between them is that Jbehave is based on stories while Cucumber is based on features.
A regular expression is a pattern used to describe a certain amount of text. The most basic
regular expression consists of a single literal character.
o Cucumber
o Ruby and its Development Kit
o IDE like ActiveState
o Watir ( To simulate browser)
Page | 259
o Ansicon and RSpec (if required)
Following is the list of advantages of the Cucumber framework that makes Cucumber an ideal
choice for rapidly evolving agile methodology in today's corporate world:
In Cucumber, the test harness allows for separating responsibility between setting up the context
and interacting with the browser, and cleaning up the step definition files. It collects stubs,
drivers, and other supporting tools required to automate test execution in testing.
1028.What is the difference between RSpec and Cucumber? When should we use RSpec and
when to use Cucumber?
RSpec and Cucumber both are the example of testing frameworks. RSpec uses traditional Unit
Testing. It means it uses testing a class or part of the application in isolation from the rest of the
application. So your model does what your model is supposed to do, the controller does what it is
supposed to do, etc. RSpec and Cucumber both are used for Acceptance Testing, also called
ATDD, BDD, etc.
o The main difference between RSpec and Cucumber is the business readability factor.
Page | 260
o RSpec is mainly used for Unit Testing. On the other hand, Cucumber is mainly used for
Behavior-driven development. We can also use it for System and Integration Testing.
o In Cucumber, the specifications or features are separate from the test code, so the product
owners can provide or review the specification without going through the code. These are
the .feature files that you make in Cucumber.
o RSpec also has a similar mechanism, but instead of describing a step with a Describe or
Context, it uses the business specification to execute that statement. This approach is a
little easier for developers to work with but a bit harder for non-technical guys.
o For a core developer, it is the best choice to use RSpec. It is easier to understand for a
technical person and offers a few advantages in keeping things scoped and under control
because you don't have to mess up with RegExs for test steps.
o If you are building this for a client, you should choose Cucumber for Acceptance Testing
and use RSpec for Unit Testing.
1029.What is Selenium?
Selenium is a web browser automation tool widely used for Functional Testing of web-based
applications. Selenium supports different programming languages such as Java, Python, Ruby,
C#, etc.
Selenium and Cucumber are both open-source testing tools, and both are used for functional
testing. But there are some differences between them.
o Selenium is a web browser automation tool for web apps, while Cucumber is an
automation tool for behavior-driven development that can be used with Selenium (or
Appium).
o Selenium is used for automated UI testing, while Cucumber is used for acceptance
testing.
Page | 261
o Selenium is preferred by technical teams (SDETs/programmers), while Cucumber is
typically preferred by non-technical teams (business stakeholders and testers).
o Selenium can work independently of Cucumber. Cucumber depends on Selenium or
Appium for step-definition implementation.
o In Selenium, the script creation is complex, while Cucumber is simpler than Selenium.
Cucumber and Selenium are both testing frameworks and prevalent technologies. Many
organizations use Selenium for functional testing. Along with Selenium, these organizations
integrate Cucumber with Selenium as Cucumber makes it easy to read and understand the
application flow. The most significant benefit of using Cucumber with Selenium is that it
facilitates developers to write test cases in simple feature files easily understood by managers,
non-technical stakeholders, and business analysts. It provides the facility to write tests in a
human-readable language called Gherkin. The Selenium-Cucumber framework supports
programming languages such as Java, .NET, PHP, Python, Perl, etc.
Step definition is used to map the Test Case Steps in the feature files to code. It executes the
steps on Application under Test and checks the results. To execute step definition, it must match
the given component in a feature.
1033. What are the maximum numbers of scenarios that we can includ in the feature file?
In Cucumber, a feature file can contain a maximum of 10 scenarios. This number can vary from
project to project and from one organization to another organization. It is the best practice to
limit the number of scenarios included in the feature file.
1034.What is the purpose of the behavior-driven development (BDD) methodology in the real
world?
Page | 262
Quality Assurance, Developers, Support Teams understand the application without diving deep
into the technical aspects.
1035.What do you understand by TDD, and what are the different processes used in TDD?
TDD is an acronym that stands for Test-Driven Development. This is a software development
technique used to create the test cases first and then write the code underlying those test cases.
Although TDD is a development technique, it can also be used for automation testing
development. TDD takes more time for development because it tends to find very few defects.
The result provided by the TDD development technique has improved the quality of code, and
that can be more reusable and flexible. TDD also helps developers to achieve high test coverage
of about 90-100%. The only disadvantage for developers following TDD is to write their test
cases before writing the code.
1. First, write the test case: You have to write an automated test case according to your
requirements.
2. Run all the test cases: Now, run these automated test cases on the currently developed
code.
3. Develop the code for that test case: In this process, you must write the code to make
that test case work as expected if the test case fails.
4. Run test cases again: Now, you have to rerun the test cases and check if all the test cases
developed so far are implemented.
5. Refactor your code: This is an optional step. But, it is advised to refactor your code to
make it more readable and reusable. That's why it is essential.
6. Repeat steps 1- 5 for new test cases: This is the last step. Here, you have to repeat the
cycle for the other test cases until all the test cases are implemented.
TDD stands for Test-Driven Development, and BDD stands for Behavior Driven Development.
Both are two software development techniques.
BDD and TDD are both very similar as they are both testing strategies for a software application.
In both cases, the developers have to write the test before writing the code to pass the test. The
Page | 263
second main similarity between them is in both cases; the tests can be used as part of an
automated testing framework to prevent bugs.
TDD BDD
TDD stands for Test-Driven Development. It is a BDD stands for Behavior Driven Development. It is a
test-centered development process. This means the Behavior centered development process.
developers have first to write the test cases then
code.
In TDD, writing a test fails because the specified In BDD, creating an executable specification that fails
functionality doesn't exist, then writing the most because the feature doesn't exist, then writing the most
straightforward code that can make the test pass, straightforward code that can make the spec pass. You
then refactoring to remove duplication, etc. repeat this until a release candidate is ready to ship.
TDD tests are written using programming languages BDD tests are written in a human-readable format using
such as Java, .Net, Python, Ruby, etc. Given-When-Then steps. These tests are readable and
understandable by non-technical persons also.
TDD tests are difficult to read by non-programmers BDD tests are readable by non-programmers also as they
as they are written in specific programming are written in a human-readable format.
languages.
The critical difference between TDD and BDD is On the other hand, BDD is a team methodology.
the scope. TDD is a development practice.
In TDD, the developers write the test cases. In BDD, the automated specifications are created by
users or testers then the developers wiring them to the
code under test.
Page | 264
1038. What do you understand by cucumber dry run?
Cucumber dry run is used to compile cucumber features files and step definitions. It is run to find
any compilation errors. If it finds anyone, it will show when we use dry run.
1039.What do you understand by the TestRunner class in the Cucumber testing approach?
Explain with example.
In the Cucumber testing approach, the TestRunner class provides the link between the feature
file and the step definition file. The TestRunner class is generally an empty class with no class
definition.
1. Package com.sample.TestRunner
2. importorg.junit.runner.RunWith;
3. importcucumber.api.CucumberOptions;
4. importcucumber.api.junit.Cucumber;
5. @RunWith(Cucumber.class)
6. @CucumberOptions(features="Features",glue={"StepDefinition"})
7. public class Runner
8. {
9. }
It is advised not to write code under the TestRunner class. It should include the tags @RunWith
and @CucumberOptions.
When Cucumber is integrated with Selenium, the starting point of execution must be from the
TestRunner class.
Page | 265
1042. How can you use the Options tag in the Cucumber framework?
In the Cucumber framework, the Options tag is a part of the TestRunner file and comes in the
form of an annotation called @CucumberOptions. It contains two parameters feature and glue.
o Feature parameter: The feature parameter is used to specify the path of the feature file.
o Glue parameter: The glue parameter is used to specify the path of the step definition
file.
1. import org.junit.runner.RunWith;
2. import cucumber.api.CucumberOptions;
3. import cucumber.api.junit.Cucumber;
4. @RunWith (Cucumber.class)
5. @CucumberOptions (
6. features = "src/test/java/features ",
7. glue = {"stepDefinitions"}
8. )
9. public class TestRunner {
10. }
1043.What is the use of features property under the Cucumber Options tag?
In the Cucumber framework, the features property is used to identify the location of the feature
files.
1044. What is the use of glue property under the Cucumber Options tag?
The Glue property is used to facilitate the Cucumber framework to identify the location of step
definition files.
Page | 266
1045.What are the two build management tools that can be integrated with Cucumber?
Following are the two build management tools that can be integrated with Cucumber:
o Gradle
o Maven
Page | 267
Maven Interview Questions for Beginners
When the project has a large number of dependencies. Then, using Maven, you can easily
manage those dependencies.
When the version of a dependency changes frequently. To update dependencies, simply update
the version ID in the pom file.
Maven makes it simple to handle continuous builds, integration, and testing.
When you need a quick way to generate documentation from source code, this is the tool you
use. It helps in compiling source code, and then packaging it into JAR or ZIP files.
POM Files: Project Object Model (POM) files are XML files that include information about
the project and configuration information used by Maven to construct the project, such as
dependencies, source directory, plugin, goals, and so on. When you want to run a maven
command, you provide it with a POM file to run. To complete its configuration and functions,
Maven reads the pom.xml file.
Dependencies and Repositories: Repositories are folders containing bundled JAR files, and
dependencies are external Java libraries necessary for Project. The local repository is simply a
folder on your computer's hard drive. Maven retrieves dependencies from a central Maven
repository and places them in your local repository if they aren't found in the local Maven
repository.
Build Life Cycles, Phases, and Goals: A build life cycle is made up of a series of build
phases, each of which contains a set of goals. A build lifecycle, phase, or goal is referred to as
a Maven command. When a lifecycle is asked to be run using the maven command, all of the
build steps in that life cycle are likewise run. When a build phase is requested to be executed, it
is followed by all build phases in the given sequence.
Build Profiles: Build Profiles are a set of configuration parameters that allow you to build
your project using a variety of setups. For example, you might need to develop and test your
project on your local computer. You can add different build profiles to your POM files using
its profile elements to enable different builds, which can be triggered in a variety of ways.
Build Plugins: Build Plugins are used to accomplish a certain task. A plugin can be added to
the POM file. Maven comes with various pre-installed plugins, but you can also write your
own in Java.
Page | 268
1048. How does Maven work?
Page | 269
1049. List a few differences between Maven and ANT.
Ant Maven
The ant scripts can not be reused. The maven plugins can be reused.
Page | 270
1051. What are the different types of Maven repositories? Discuss.
Local repository
Central repository
Remote repository
Maven scans these repositories for dependencies. Maven looks in the Local repository first,
then the Central repository, and finally the Remote repository if the Remote repository is
defined in the POM.
Local Repository: Local repository is a directory on the developer's device. The local
repository contains all of Maven's dependencies. Even though several projects rely on
dependencies, Maven only needs to download them once.
Central Repository: The Maven community has built the central Maven repository. Maven
searches this central repository for any dependencies that aren't available in your local
repository. The dependencies are subsequently downloaded into your local repository by
Maven.
Remote Repository: Maven may download dependencies from a remote repository hosted on
a web server. It is frequently used to host internal organization projects. The dependencies are
subsequently downloaded into your local repository by Maven.
1052. What command should one use to install JAR files in the Local Repository?
JAR files are installed in the local repository using mvn install.
The following plugin is used to manually install the JAR into the local Maven repository:
install-file-Dfile = <file path>
1054. What are the different phases of the default life cycle?
Validate: Make sure the project is correct and that you have all of the necessary information.
Test: Test the compiled source code using an appropriate unit testing framework. These tests
should not demand that the code be packed or deployed; instead, take the compiled code and
package it in a manner that can be distributed, such as a JAR.
Compile: Compile the project's source code.
Page | 271
Verify: Perform any necessary checks on integration test findings to ensure that quality criteria
are met.
Install: Adds the package to the local repository, allowing it to be used as a dependency in
other projects.
Deploy: Copies the entire package to the remote repository for sharing with other developers
and organizations, and is done in the build environment.
1055. What are Maven plugins used for? What are the types of Maven plugins?
Build plugins: These plugins are used throughout the build process and are configured in the
pom.xml file's <build/> element.
Reporting plugins: These plugins are configured in the pom.xml's <reporting/> element and
run during stage generation.
Settings
CLI parameters
Parent POM
Project POM
Page | 272
1058. In Maven, what is a snapshot?
A snapshot is a specific version of a project that shows the most recent development copy of
the project being worked on. Maven always checks out a SNAPSHOT of the project in the
remote repository for each build.
As a result, anytime Maven discovers a newer SNAPSHOT of the project, it downloads and
replaces the project's older .jar file in the local repository.
1059. What are the locations where Maven dependencies are stored?
Maven saves all of the JARs, dependency files, and other things it downloads in the Maven
local repository. All of the artifacts are kept locally in the Maven local repository, which is a
folder on the local machine.
1060. What are the different types of Maven build profiles? In what ways can build
profiles of maven be activated?
1061. How would you refer to a property declared in your pom.xml file?
In order to refer to a property declared in your pom.xml, the property name makes use of the
names of the XML components that designate the value, with "pom" being accepted as a
synonym for the project (root) element.
Page | 273
1062. How to generate javadocs in Maven?
Every Maven plain Old Java Object (MOJO) is an executable goal, and a plugin pertains to the
distribution of these MOJOs. MOJO allows Maven to add functionalities that it doesn't already
have. In Maven, a MOJO is a single unit of the task.
Any POM file has the ability to point to its parent POM. There is a system-wide POM file that
is automatically considered as the parent POM file if the parent POM element is absent. The
super POM is the name given to this POM file. Finally, the super POM is used to extend all of
the application POM files. The apex of the POM hierarchy is the super POM file. The super
POM file contains all of the default configurations. All of the configurations defined in the
super POM file will be inherited by even the simplest version of a POM file. You can alter any
option you want by redefining the same section in your application POM file.
Page | 274
1065. What is a 'Dependency Scope'? What are the different types of Dependency
Scopes?
The dependency scope pertains to all dependencies related to the present stage of the build.
Compile- It's the default scope, and it shows which dependencies are available in the project's
classpath.
Page | 275
Provided- It denotes that the dependency is delivered at runtime by the JDK, web server, or
container.
Runtime- This indicates that the dependency is not required during compilation but is
necessary during execution.
Test- It claims that dependencies are only available during the test compilation and execution
phases.
System- It implies that you must specify the system path.
Import- This means that the dependencies in that POM's section should be used instead of the
identified or specified POM.
1066. What do you mean by a Maven Archetype? How will you create a new project
based on an Archetype?
Maven Archetype is a Maven plugin that makes it possible to create a project structure based
on a template. These archetypes are essentially project templates that Maven generates when
you create a new project. Archetype is a Maven project templating toolkit, in a nutshell.
After getting to the directory where the project is located, type the command: – mvn
archetype: generate in the command prompt. This aids in creating a new project based on an
archetype.
In most cases, an archetype is procured from a remote repository. You're ready to go if that
repository can be reached using your Maven configuration. You must add the repository to
your settings.xml if the repository is not managed and you wish to refer to it directly.
1067. What command is used to create a new project from a hard drive?
The Maven clean lifecycle takes care of eliminating all temporary files from the output
directory, including generated source files, compiled classes, and previous JAR files, among
other things.
Page | 276
pre-clean- performs tasks that are necessary prior to actual project cleaning.
clean- delete all files created by the previous build.
post-clean- performs tasks that are necessary to finalize project cleaning.
Everything related to generating documentation for your project is handled by the Maven site
lifecycle.
pre-site- performs tasks that are necessary prior to actual project site generation.
site- develop the project’s site generation.
post-site- performs tasks that are necessary to finalize project site generation, also prepares for
site deployment.
site-deploy- deploy the developed site documentation to the web server of your choice.
1070. Explain the three commonly used plugins: clean, surefire, antrun.
Maven clean is a plugin that, as the name implies, attempts to clean the files and directories
generated by Maven during the build process. The target folder, which contains all of the class
files, documentation, and JAR files, is removed by the plugin.
The Surefire Plugin is used to run an application's unit tests during the test phase of the build
lifecycle. It can generate reports in one of two file formats: plain text files or XML files.
The Antrun Plugin allows you to perform Ant tasks directly from within Maven. Your Ant
scripts can even be embedded in the POM!
A Maven installation is configured using the settings.xml file. It's comparable to a pom.xml
file, but it's either global or user-specific. The Maven settings.xml file provides elements that
define the values required to configure Maven's execution in several ways. These values
include the location of the local repository, authentication information, and alternate remote
repository servers among others.
Let's look at the elements in the settings.xml file that we can change. The settings.xml file's
main element, settings, can include up to nine predefined child elements:
Page | 277
<servers/>
<mirrors/>
<proxies/>
<profiles/>
<activeProfiles/>
</settings>
Proxy configuration
Local repository configuration
Remote repository configuration
Central repository configuration
When multiple versions of an artifact are encountered, Maven determines which version of the
dependency should be used. The earliest declared dependence will be used if two dependency
versions are at the same depth in the dependency tree. This is referred to as "dependency
mediation."
Dependency management allows project authors to declare the versions of artifacts that are to
be utilized when they are discovered in transitive dependencies or dependencies that have no
version specified.
The term "system dependency" refers to the scope system's dependency. These dependencies
are typically used to let Maven know the dependencies the JDK or VM provides. System
dependencies are typically used to resolve dependencies on JDK-provided artifacts. Some
common examples are the Java Authentication and Authorization Service (JAAS) or the JDBC
standard extensions.
When splitting a project into submodules isn't practicable (for some reason), optional
dependencies are employed. The concept is that some of the dependencies are just required for
particular project features and will not be required if those features are not used. Such a feature
should ideally be divided into a sub-module that is dependent on the project's main
functionality. Only non-optional dependencies would be included in this new subproject, as
you'd need them all if you wanted to use the subproject's features.
If a user wants to use functionality associated with an optional dependency, they must
redeclare it in their own project. Optional dependencies save storage and memory. They
prevent troublesome jars from being packed into a WAR, EAR, fat jar, or other formats if they
violate a license agreement or cause classpath difficulties.
Page | 278
1075. What do you understand about ‘Transitive Dependency’ in Maven? What is
dependency exclusion?
The "exclusion" element can be used to exclude any transitive dependency. If X is reliant on Y
and Y is reliant on Z, then X can declare Z as excluded.
1076. What are the elements that must be defined for each external dependency?
You have the opportunity to define your own arbitrary properties in addition to the implicit
properties. A POM or a Profile can be used to define properties. The properties defined in a
POM or a Maven Profile can be referenced in Maven just like any other property. User-defined
properties can be used to filter resources via the Maven Resource plugin, or they can be
referenced in a POM. In a Maven POM, here's an example of defining some arbitrary
properties.
<project>
...
<properties>
<arbitrary.property.x>Text</arbitrary.property.x>
<hibernate.version>3.2.1.ga</hibernate.version>
</properties>
...
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>${hibernate.version}</version>
</dependency>
</dependencies>
...
</project>
Page | 279
arbitrary.property.x and hibernate.version are two properties defined in the preceding example.
In a dependency declaration, hibernate.version is mentioned. It's usual practice in Maven
POMs and Profiles to use the period character as a separator in property names. The following
example demonstrates how to define a property in a Maven POM profile.
<project>
...
<profiles>
<profile>
<id>random-profile</id>
<properties>
<arbitrary.property>Text</arbitrary.property>
</properties>
</profile>
</profiles>
...
</project>
The settings.xml profile element is a trimmed version of the pom.xml profile element. It is
made up of the elements: activation, repositories, pluginRepositories, and properties. These
four components are the only ones included in the profile elements since they deal with the
build system as a whole (which is what the settings.xml file is for), not individual project
object model settings.
If a profile is activated from settings, its values will override any POM or profiles.xml profiles
with the same ID.
Activation: The strength of a profile, like that of the POM's profiles, comes from its capacity
to modify specific values only under certain conditions, which are stated via an activation
element.
Repositories: Repositories are remote collections of projects that Maven utilizes to populate
the build system's local repository.
pluginRepositories: Maven plugins are a unique form of artifact in themselves. Plugin
repositories may be segregated from other repositories as a result of this. Each of the
pluginRepository components specifies a remote source where Maven can look for new
plugins.
Properties: Maven properties, like Ant properties, value placeholders. The notation ${X},
where X is the property, can be used to obtain their values anywhere within a POM.
The maven release plugin is used to automate the build and release process. When maven
executes the maven-release-plugin, the following activities are performed:
Page | 280
mvn release:clean - clears the workspace from the previous build and prepares it for a new
one.
mvn release:rollback - If the previous process failed, it rollbacks the workspace.
mvn release:prepare - It performs the following tasks:
o Checks the local workspace for any uncommitted files.
o Checks for SNAPSHOT dependencies and verifies they aren't present.
o Prepares the final version for release.
o Updates the pom to SCM (SVN/Git/Mercurial/CVS).
o Runs the test cases.
o Executes the ultimate commit to the SCM.
o Tags the script/code.
o Increases the version number and includes the SNAPSHOT as part of the subsequent releases.
mvn release:perform - fetches the code from the repository and executes the maven goal to
develop and deploy the artifacts.
This is primarily to ensure that the dependency graph is predictable, as well as to prevent
inheritance effects from eliminating a dependent that should not be excluded. If you have to
use the method of last resort and add an exclusion, make sure you know which of your
dependencies is causing the undesirable transitive dependency.
The banned dependencies rule can be specified to fail the build if a troublesome dependency is
identified, regardless of path. You'll need to add specific exclusions to each path the enforcer
detects if the build fails.
The default behavior includes merging the content of the configuration element according to
the element name. If a certain element exists in the child POM, that value becomes the
effective value. The parent value becomes the effective value if the child POM does not have
an element but the parent does. It's important to note that this is solely an XML operation, with
no code or plugin settings involved. Only the elements are involved, not their values.
Project Aggregation specifies the modules from the parent POM instead of specifying the
parent POM from the module. As a result, the parent project is aware of its modules, and if a
Page | 281
Maven command is issued against the parent project, the Maven command is also applied to
the parent's modules. For Project Aggregation, you must accomplish the following:
The Maven Wagon Plugin, as its name suggests, allows you to access numerous Maven Wagon
functionalities. To transfer resources to and from Maven repositories, Maven Wagon offers a
layer of abstraction over the core transport protocols. Maven Wagon's unified API includes
implementations for seven transports.
The plugin allows you to use the wagon to upload resources from your build to a remote site,
get resources from a repository and list the contents of a repository. Finally, it may merge a
Page | 282
Maven repository to another in a generic fashion by merging the upload and download
capabilities.
Doxia is a content creation framework that aims to give powerful approaches for creating static
and dynamic content to its users: Doxia can be used to create static web pages in a web-based
publication context, as well as in dynamic content creation systems such as blogs, wikis, and
content management systems.
Maven makes substantial use of Doxia, which powers the project's complete documentation
system. It enables Maven to take any Doxia-supported document and output it in any format.
For instance, 'mvn site' is the command used by Maven to produce javadocs for a specific
project. Maven calls Doxia document generation and other report generating plugins when this
command is run.
1085. How will you run JUnit tests in parallel with a Maven build?
It is now possible to run tests in parallel without utilizing TestNG in junit 4.7. It's been feasible
since 4.6, but 4.7 will include a number of improvements that will make it a realistic
alternative. You may also use spring to execute parallel tests.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6.0</version>
<configuration>
<parallel>classes</parallel>
<threadCount>4</threadCount>
</configuration>
</plugin>
</plugins>
</build>
1086. How can you skip running the tests for a particular project?
Set the skipTests attribute to true to skip the tests for a certain project.
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13.0</version>
Page | 283
<configuration>
<skipTests>true</skipTests>
</configuration>
You may also skip the tests by using the following command from the command line:
You can also use the maven.test.skip option to avoid compiling the tests if you have to.
Surefire, Failsafe, and the Compiler Plugin all recognize maven.test.skip.
You must go through a properties section in the pom if you want to skip tests by default but
have the possibility to re-enable tests from the command line:
<properties>
<skipTests>true</skipTests>
</properties>
And,
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13.0</version>
<configuration>
<skipTests>${skipTests}</skipTests>
</configuration>
This will allow you to run tests with the default tests disabled and execute them with the
following command:
The "skip" parameter and other booleans on the plugin can be used in the same way.
1087. What is the difference between the maven package and the maven install?
package: converts the compiled code into a distributable format, such as a JAR.
install: adds the package to the local repository, allowing it to be used as a dependency in
other projects.
Page | 284
CORE JAVA AND OOPS CONCEPT
1088.Is Java platform independent?
Yes. Java is a platform independent language. We can write java code on one platform and run it
on another platform. For e.g. we can write and compile the code on windows and can run the
generated bytecode on Linux or any other supported platform. This is one of the main features of
java.
Classloader, Class area, Heap, Stack, Program Counter Register and Native Method Stack
Here public is an access modifier, which means that this method is accessible by any class.
static – static keyword tells that this method can be accessed without creating the instance of the
class. Refer: Static keyword in java
String args[] – The args is an array of String type. This contains the command line arguments
that we can pass while running the program.
Page | 285
1092. What is javac ?
The javac is a compiler that compiles the source code of your program and generates bytecode.
In simple words javac produces the java byte code from the source code written *.java file. JVM
executes the bytecode to run the program.
A class is a blueprint or template or prototype from which you can create the object of that class.
A class has set of properties and methods that are common to its objects.
A wrapper class converts the primitive data type such as int, byte, char, boolean etc. to the
objects of their respective classes such as Integer, Byte, Character, Boolean etc. Refer: Wrapper
class in Java
Path specifies the location of .exe files. Classpath specifies the location of bytecode (.class files).
byte – 8 bit
short – 16 bit
char – 16 bit Unicode
int – 32 bit (whole number)
float – 32 bit (real number)
long – 64 bit (Single precision)
double – 64 bit (double precision)
Java uses Unicode to represent the characters. Unicode defines a fully international character set
that can represent all of the characters found in human languages.
Any constant value that is assigned to a variable is called literal in Java. For example –
Page | 286
// Here 101 is a literal
int num = 101
1100. Dynamic Initialization?
When we assign a value of one data type to the different data type then these two data types may
not be compatible and needs a conversion. If the data types are compatible (for example
assigning int value to long) then java does automatic conversion and does not require casting.
However if the data types are not compatible then they need to be casted for conversion.
For example:
1102.What is an Array?
An array is a collection (group) of fixed number of items. Array is a homogeneous data structure
which means we can store multiple values of same type in an array but it can’t contain multiple
values of different types. For example an array of int type can only hold integer values.
break statement is generally used with switch case data structure to come out of the
statement once a case is executed.
It can be used to come out of the loop in Java
int arr[];
int[] arr;
OOPs Interview Questions
Page | 287
1105. Four main principles of OOPS Concepts?
Inheritance
Polymorphism
Data Encapsulation
Abstraction
1106.What is inheritance?
The process by which one class acquires the properties and functionalities of another class is
called inheritance. Inheritance brings reusability of code in a java application. Refer: Guide
to Inheritance in Java.
When a class extends more than one classes then it is called multiple inheritance. Java doesn’t
support multiple inheritance whereas C++ supports it, this is one of the difference between java
and C++. Refer: Why java doesn’t support multiple inheritance?
Polymorphism is the ability of an object to take many forms. The most common use of
polymorphism in OOPs is to have more than one method with the same name in a single class.
There are two types of polymorphism: static polymorphism and dynamic polymorphism. Refer
these guides to understand the polymorphism concept in detail: 1) Java Polymorphism 2) Types
of Polymorphism
When a sub class (child class) overrides the method of super class(parent class) then it is called
overriding. To override a method, the signature of method in child class must match with the
method signature in parent class. Refer: Java – Method Overriding
When a class has more than one methods with the same name but different number, sequence or
types of arguments then it is known as method overloading. Refer: Java – Method Overloading
Page | 288
1112. Does Java support operator overloading?
1113.Can we overload a method by just changing the return type and without changing the
signature of method?
No, We cannot do this. To overload a method, the method signature must be different, return
type doesn’t play any role in method overloading.Is it possible to overload main() method of a
class?Yes, we can overload main() method in Java.
Binding refers to the linking of method call to its body. A binding that happens at compile time
is known as static binding while binding at runtime is known as dynamic binding. Refer: Static
and Dynamic binding in Java.
Wrapping of the data and code together is known as encapsulation. Refer: Java Encapsulation.
An abstract class is a class which can’t be instantiated (we cannot create the object of abstract
class), we can only extend such classes. It provides the generalised form that will be shared by
all of its subclasses, leaving it to each subclass to fill in the details. We can achieve partial
abstraction using abstract classes, to achieve full abstraction we use interfaces.
An interface is used for achieving full abstraction. A class implements an interface, thereby
inheriting the abstract methods of the interface. Refer: Java Interface
1) abstract class can have abstract and non-abstract methods. An interface can only have abstract
methods.
2) An abstract class can have static methods but an interface cannot have static methods.
3) abstract class can have constructors but an interface cannot have constructors.
Page | 289
1120.Name the access modifiers that can be applied to the inner classes?
Constructor is used for creating an instance of a class, they are invoked when an instance of class
gets created. Constructor name and class name should be same and it doesn’t have a return type.
Refer this guide: Java Constructor.
Default: Constructors with no arguments are known as default constructors, when you don’t
declare any constructor in a class, compiler creates a default one automatically.
Yes. A constructor can call the another constructor of same class using this keyword. For e.g.
this() calls the default constructor.
Note: this() must be the first statement in the calling constructor.
Yes. In fact it happens by default. A child class constructor always calls the parent class
constructor. However we can still call it using super keyword. For e.g. super() can be used for
calling super class default constructor.
1127.THIS keyword?
Page | 290
1128.Can this keyword be assigned null value?
In java, arguments can be passed as call by value – Java only supports call by value, there is no
concept of call by reference in Java.
Static variables are also known as class level variables. A static variable is same for all the
objects of that particular class in which it is declared.
A static block gets executed at the time of class loading. They are used for initializing static
variables.
Static methods can be called directly without creating the instance (Object) of the class. A static
method can access all the static variables of a class directly but it cannot access non-static
variables without creating instance of class.
super keyword references to the parent class. There are several uses of super keyword:
Page | 291
1135. What is a Object class?
This is a special class defined by java; all other classes are subclasses of object class. Object
class is superclass of all other classes. Object class has the following methods
objectClone () – to creates a new object that is same as the object being cloned.
boolean equals(Object obj) – determines whether one object is equal to another.
finalize() – Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object. A subclass overrides the finalize
method to dispose of system resources or to perform other cleanup.
toString () – Returns a string representation of the object.
A Package can be defined as a grouping of related types (classes, interfaces, enumerations and
annotations). Refer: Package in Java.
The star form (java.util.* ) includes all the classes of that package and that may increase the
compilation time – especially if you import several packages. However it doesn’t have any effect
run-time performance.
Static import is a feature introduced in the Java programming language that allows members
which have been scoped within their container class as public static, to be used in Java code
without specifying the class in which the field has been defined.
Since objects are dynamically allocated by using the new operator, java handles the de-allocation
of the memory automatically, when no references to an object exist for a long time. This whole
process is called garbage collection. The whole purpose of Garbage collection is efficient
memory management.
1141.How many times does the garbage collector calls the finalize() method for an object?
The garbage collector calls the finalize() method only once for an object.
Page | 292
1142.What are two different ways to call garbage collector?
System.gc() OR Runtime.getRuntime().gc().
No, its not possible. you cannot force garbage collection. you can call system.gc() methods for
garbage collection but it does not guarantee that garbage collection would be done.
1144.What is an exception?
Exceptions are abnormal conditions that arise during execution of the program. It may occur due
to wrong user input or wrong logic written by programmer.
1145.Exceptions are defined in which java package? OR which package has definitions for
all the exception classes?
Java.lang.Exception
This package contains definitions for Exceptions.
Error: Mostly a system issue. It always occur at run time and must be resolved in order to
proceed further.
Exception: Mostly an input data issue or wrong logic in code. Can occur at compile time or run
time.
The throw keyword is used for throwing user defined or pre-defined exception.
Page | 293
1149.What is throws keyword?
If a method does not handle a checked exception, the method must declare it using the
throwskeyword. The throws keyword appears at the end of a method’s signature.
Yes, A static block can throw exceptions. It has its own limitations: It can throw only Runtime
exception (Unchecked exceptions), In order to throw checked exceptions you can use a try-catch
block inside it.
Finally block is a block of code that always executes, whether an exception occurs or not. Finally
block follows try block or try-catch block.
Q) ClassNotFoundException vs NoClassDefFoundError?
1) ClassNotFoundException occurs when loader could not find the required class in class path.
2) NoClassDefFoundError occurs when class is loaded in classpath, but one or more of the class
which are required by other class, are removed or failed to load by compiler.
No, we cannot have a try block without catch or finally block. We must have either one of them
or both.
Yes we can have multiple catch blocks in order to handle more than one exception.
Yes, we can have try block followed by finally block without even using catch blocks in
between.
The only time finally won’t be called is if you call System.exit() or if the JVM crashes first.
Page | 294
1157.Can we handle more than one exception in a single catch block?
Yes we can do that using if-else statement but it is not considered as a good practice. We should
have one catch block for one exception.
A JavaBean is a Java class that follows some simple conventions including conventions on the
names of certain methods to get and set state called Introspection. Because it follows
conventions, it can easily be processed by a software tool that connects Beans together at
runtime. JavaBeans are reusable software components.
It is a process of executing two or more part of a program simultaneously. Each of these parts is
known as threads. In short the process of executing multiple threads simultaneously is known as
multithreading.
1161. What are the main differences between Process and thread? Explain in brief.
1) One process can have multiple threads. A thread is a smaller part of a process.
2) Every process has its own memory space, executable code and a unique process identifier
(PID) while every thread has its own stack in Java but it uses process main memory and shares it
with other threads.
3) Threads of same process can communicate with each other using keyword like wait and notify
etc. This process is known as inter process communication.
yield() – It causes the currently executing thread object to temporarily pause and allow other
threads to execute.
Page | 295
sleep() – It causes the current thread to suspend execution for a specified period. When a thread
goes into sleep state it doesn’t release the lock.
sleep() – It causes the current thread to suspend execution for a specified period. When a thread
goes into sleep state it doesn’t release the lock
wait() – It causes current thread to wait until either another thread invokes the notify() method or
the notifyAll() method for this object, or a specified amount of time has elapsed.
A daemon thread is a thread, that does not prevent the JVM from exiting when the program
finishes but the thread is still running. An example for a daemon thread is the garbage collection.
if you use join() ,it makes sure that as soon as a thread calls join,the current thread(yes,currently
running thread) will not execute unless the thread you have called join is finished.
1) The preemptive scheduling is prioritized. The highest priority process should always be the
process that is currently utilized.
2) Time slicing means task executes for a defined slice/ period of time and then enter in the pool
of ready state. The scheduler then determines which task execute next based on priority or other
factor.
Yes, we can call run() method of a Thread class but then it will behave like a normal method. To
actually execute it in a Thread, you should call Thread.start() method to start it.
Starvation describes a situation where a thread is unable to gain regular access to shared
resources and is unable to make progress. This happens when shared resources are made
unavailable for long periods by “greedy” threads. For example, suppose an object provides a
synchronized method that often takes a long time to return. If one thread invokes this method
frequently, other threads that also need frequent synchronized access to the same object will
often be blocked.
Page | 296
1170.What is deadlock?
Deadlock describes a situation where two or more threads are blocked forever, waiting for each
other.
Serialization is a process of converting an object and its attributes to the stream of bytes. De-
serialization is recreating the object from stream of bytes; it is just a reverse process of
serialization. To know more about serialization with example program, refer this article.
No. In order to make an object serializable we just need to implement the interface Serializable.
We don’t need to implement any methods.
String class is immutable that’s the reason once its object gets created, it cannot be changed
further.
Page | 297
Java collections interview questions
Elements can be inserted or accessed by their position in the list, using a zero-based index.
A list may contain duplicate elements.
Map interface maps unique keys to values. A key is an object that we use to retrieve a value
later. A map cannot contain duplicate keys: Each key can map to at most one value.
1179.What is Set?
Array can hold fixed number of elements. ArrayList can grow dynamically.
1) LinkedList store elements within a doubly-linked list data structure. ArrayList store elements
within a dynamically resizing array.
2) LinkedList is preferred for add and update operations while ArrayList is a good choice for
search operations. Read more here.
1182.For addition and deletion. Which one is most preferred: ArrayList or LinkedList?
Page | 298
1185.What is the difference between Iterator and ListIterator?
1) Iterator allows to remove elements from the underlying collection during the iteration using its
remove() method. We cannot add/remove elements from a collection when using enumerator.
2) Iterator has improved method names.
Enumeration.hasMoreElement() -> Iterator.hasNext()
Enumeration.nextElement() -> Iterator.next().
Unsigned applets are simply not allowed to read or write files on the local file system .
Unsigned applets can, however, read (but not write) non-class files bundled with your applet on
the server, called resource files
1190.What is container ?
Page | 299
1191.On Windows, generally frames are invisible, how to make it visible?
ActionListerner – actionPerformed();
ItemListerner – itemStateChanged();
TextListener – textValueChanged();
FocusListener – focusLost(); & FocusGained();
WindowListener – windowActified(); windowDEactified(); windowIconified();
windowDeiconified(); windowClosed(); windowClosing(); windowOpened();
MouseMotionListener – mouseDragged(); & mouseMoved();
MouseListener – mousePressed(); mouseReleased(); mouseEntered(); mouseExited();
mouseClicked();
Following stage of any applets life cycle, starts with init(), start(), paint(), stop() and destroy().
To display the message at the bottom of the browser when applet is started.
Page | 300
TESTNG
1197. What is TestNG?
Ans. TestNG(NG for Next Generation) is a testing framework that can be integrated with
selenium or any other automation tool to provide multiple capabilities like assertions, reporting,
parallel test execution, etc.
1201. How can we group test cases like separate test cases for the Sanity suite, Regression
suite, etc?
Ans. Using the groups attribute in TestNG, we can assign the test methods to different groups.
//Test method belonging to sanity suite only
@Test(groups = {"sanitySuite"})
//Test logic
Page | 301
}
//Test logic
1202. How can we exclude a Test method from getting executed via the testng.xml file?
Ans. Using the exclude tag in the testng.xml file, we can exclude a particular test method from
getting executed.
<suite name="Test Suite" verbose="1">
<test name="TestName">
<classes>
<class name="TestClassName">
<methods>
<exclude name="testMethodToBeExcluded"/>
</methods>
</class>
</classes>
</test>
</suite>
Page | 302
1203. What are some commonly used TestNG annotations?
Ans. The commonly used TestNG annotations are-
@Test – @Test annotation marks a method as a Test method.
@BeforeSuite – The annotated method will run only once before all tests in this suite
have run.
@AfterSuite – The annotated method will run only once after all tests in this suite have
run.
@BeforeClass – The annotated method will run only once before the first test method in
the current class is invoked.
@AfterClass – The annotated method will run only once after all the test methods in the
current class have been run.
@BeforeTest – The annotated method will run before any test method belonging to the
classes inside the <test> tag is run.
@AfterTest – The annotated method will run after all the test methods belonging to the
classes inside the <test> tag have run.
@BeforeMethod – The annotated method will run before each test method marked by
@Test annotation.
@AfterMethod – The annotated method will run after each test method marked by @Test
annotation.
@DataProvider – The @DataProvider annotation is used to pass test data to the test
method. The test method will run as per the number of rows of data passed via the data
provider method.
1204. What is the order of execution of the test method based on the different annotations?
Ans. The test methods in TestNG follow the Suite->Test->Class->Method sequence combined
with the Before annotations->Test annotations->After annotations sequence. So, the order of
execution is-
@BeforeSuite
@BeforeTest
@BeforeClass
@BeforeMethod
@Test
@AfterMethod
@AfterClass
@AfterTest
@AfterSuite
Page | 303
5. assertNotNull(Object object)
6. fail(boolean condition, String message)
7. true(String message)
@Test(enabled = false)
//Test logic
//Test logic
1207. How can we make one test method dependent on others using TestNG?
Ans. Using dependsOnMethods parameter inside @Test annotation in TestNG we can make one
test method run only after the successful execution of the dependent test method.
@Test(dependsOnMethods = { "preTests" })
Page | 304
1210. How can we run a Test method multiple times in a loop(without using any data
provider)?
Ans. Using invocationCount parameter and setting its value to an integer value, makes the test
method runs n number of times in a loop.
@Test(invocationCount = 10)
//Test logic
//Test logic
1212. What is the difference between soft assertion and hard assertion in TestNG?
Ans. This is one of the most frequently asked TestNG interview questions. Soft assertions
(SoftAssert) allow us to have multiple assertions within a test method, even when an assertion
fails the test method continues with the remaining test execution. The result of all the assertions
can be collated at the end using softAssert.assertAll() method.
@Test
//Assertion failing
softAssert.fail();
Page | 305
System.out.println("Failing");
//Assertion passing
softAssert.assertEquals(1, 1);
System.out.println("Passing");
softAssert.assertAll();
Here, even though the first assertion fails still the test will continue with execution and print the
message below the second assertion.
Hard assertions on the other hand are the usual assertions provided by TestNG. In case of hard
assertion in case of any failure, the test execution stops, preventing the execution of any further
steps within the test method.
1213. How to fail a testNG test if it doesn’t get executed within a specified time?
Ans. We can use the timeOut attribute of @Test annotation. The value assigned to this timeOut
attribute will act as an upper bound. If the test doesn’t get executed within this time frame then it
will fail with timeout exception.
@Test(timeOut = 1000)
Thread.sleep(2000);
if(conditionToCheckForSkippingTest)
//test logic
1215. How can we make sure a test method runs even if the test methods or groups on
which it depends fail or get skipped?
Ans. Using the “alwaysRun” attribute of @Test annotation, we can make sure the test method
will run even if the test methods or groups on which it depends fail or get skipped.
@Test
Assert.fail("Failed test");
@Test(dependsOnMethods={"parentTest"}, alwaysRun=true)
Here, even though the parentTest failed, the dependentTest will not get skipped instead it will
get executed because of “alwaysRun=true”. In case, we remove the “alwaysRun=true” attribute
from @Test then the report will show one failure and one skipped test, without trying to run
the dependentTest method.
1216. How can we pass the parameter to the test the script using TestNG?
Ans. Using @Parameter annotation and the ‘parameter’ tag in testng.xml we can pass parameters
to test scripts.
Sample testng.xml –
<suite name="sampleTestSuite">
Page | 307
<test name="sampleTest">
<classes>
</classes>
</test>
</suite>
@Test
@Parameters("sampleParamName")
@DataProvider(name = "dataProvider1")
Page | 308
return new Object[][] {{"kuldeep","rana"}, {"k1","r1"},{"k2","r2"}};
//This method is bound to the above data provider returning 2D array of 3*2 matrix
//The test case will run 3 times with different set of values
@Test(dataProvider = "dataProvider1")
//test logic
Page | 309
1219. What is the use of @Factory annotation in TestNG?
Ans. @Factory annotation helps in the dynamic execution of test cases. Using @Factory
annotation we can pass parameters to the whole test class at run time. The parameters passed can
be used by one or more test methods of that class.
For example – there are two classes TestClass and the TestFactory class. Because of the
@Factory annotation, the test methods in class TestClass will run twice with the data “k1” and
“k2”
public class TestClass{
//Constructor
this.str = str;
@Test
System.out.println(str);
//The test methods in class TestClass will run twice with data "k1" and "k2"
@Factory
Page | 310
public Object[] factoryMethod() {
In this case, the method will get terminated in 5000 ms (5 seconds) and the test case is
marked as “Failed”.
Page | 311
SELENIUM
1. Selenium is open source and free to use without any licensing cost.
2. It supports multiple languages like Java, Ruby, Python, etc.
3. Selenium supports multi-browser testing.
4. It has vast resources and helping-community over the internet.
5. Using the Selenium IDE component, non-programmers can also write automation scripts.
6. Using the Selenium Grid component, distributed testing can be carried out on remote
machines.
Page | 312
1227. Which browsers/drivers are supported by Selenium Webdriver?
Ans. Some commonly used browsers supported by Selenium are-
1228. What is Selenium 4 and how is it different from other Selenium versions?
Ans. Selenium 4 is the latest version of Selenium that is W3C (World Wide Web
Consortium) compliant. In simple words, this makes the Selenium test suites more stable and
reduces compatibility issues across different Web browsers.
Those who have used Selenium 3 and lower version would know that a Selenium test uses JSON
wire protocol to communicate with web browsers. In the case of Selenium 4 there is no need for
encoding and decoding the API requests using the JSON wire protocol for communication
between browsers and test scripts. This allows the WebDriver to interact directly with the target
browser.
Page | 313
1. Id
2. XPath
3. CSS selector
4. className
5. tagName
6. name
7. link text
8. partialLinkText
1232. How can we inspect the web element attributes in order to use them in different
locators?
Ans. In order to locate web elements, we can use the Developer tool and plugins like Firebug.
We can launch the developer tool by pressing F12 on the browser. Users can easily hover over
any element and find its different HTML properties.
Firebug is a plugin of Firefox that provides various development tools for debugging
applications. From an automation perspective, we use Firebug specifically for inspecting web
elements in order to find their attributes like id, class, name, etc. in different locators.
The main disadvantage of absolute XPath is that even if there is a slight change in the UI or any
element, the whole XPath will fail.
Example – html/body/div/div[2]/div/div/div/div[1]/div/input
In this way, there are different ways of creating robust relative XPaths that have minimal or no
change with the changes in other UI elements.
Example – //input[@id=’username’]
Page | 314
1236. What is the difference between a single slash(/) and a double slash(//) in XPath?
Ans. In XPath, a single slash is used for creating absolute XPaths, beginning from the root node.
Whereas double slash is used for creating relative XPaths.
1237. How can we locate an element by only partially matching the value of its attributes in
Xpath?
Ans. Using contains() method we can locate an element by partially matching its attribute’s
value. This is particularly helpful in scenarios where the attributes have dynamic values with a
certain constant part.
Basically, the above statement will match all the values of the name attribute containing the word
‘user’ in them.
xPathExpression = //*[text()='username']
1241. What is the syntax of finding elements by class using CSS Selector?
Ans. By using .className in the CSS locator, we can select all the elements belonging to a
particular class e.g. ‘.red’ will select all elements having class ‘red’.
Page | 315
1242. What is the syntax of finding elements by id using CSS Selector?
Ans. By using #idValue in the CSS locator, we can select all the elements belonging to a
particular class e.g. ‘#userId’ will select the element having an id – userId.
1243. How can we select elements by their attribute value using the CSS Selector?
Ans. Using [attribute=value] in the CSS locator, we can select all the elements belonging to a
particular class e.g. ‘[type=small]’ will select the element having attribute type of value ‘small’.
1244. How can we move to the nth-child element using the CSS selector?
Ans. Using :nth-child(n) in the CSS locator, we can move to the nth child element e.g. div:nth-
child(2) will locate the 2nd div element of its parent.
1245. What is the fundamental difference between XPath and CSS selectors?
Ans. The fundamental difference between XPath and CSS selector is – using XPaths we can
traverse up in the document i.e. we can move to parent elements. Whereas using the CSS
selector, we can only move downwards in the document.
1. driver.navigate() allows moving back and forward in browser history with the help of
driver.navigate().forward() and driver.navigate().back() commands.
2. In the case of single-page applications (where the URL is appended by ‘#’ to navigate to
different sections of the page)-
driver.navigate().to() navigates to a particular section by changing the URL without
refreshing the page.
Whereas driver.get() refreshes the page.
This refreshing of the page is also the primary reason why history is not maintained in the
case of the driver.get() command.
Reference – Stack overflow
Page | 316
1248. How can we type text in a textbox element using Selenium?
Ans. With the help of the sendKeys() method, we can type text in a textbox-
searchTextBox.sendKeys("searchTerm");
driver.findElement(By.id("elementLocator")).clear();
driver.findElement(By.id("form1")).submit();
Also, we can use the click() method for the same purpose.
driver.switchTo().window(handle);
Page | 317
}
driver.switchTo().frame("{frameIndex/frameId/frameName}");
For locating a frame, we can either use the index (starting from 0), its name, or its Id.
1255. Can we move back and forward in the browser using Selenium?
Ans. Yes, using driver.navigate().back() and driver.navigate().forward() commands, we can
move backward and forward in a browser.
driver.manage().window().maximize();
Page | 318
1259. How can we find the value of different attributes like name, class, and value of an
element?
Ans. Using getAttribute(“{attributeName}”) method, we can find the value of different attributes
of an element e.g.-
String valueAttribute =
driver.findElement(By.id("locator")).getAttribute("value");
driver.manage().deleteAllCookies();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
WebElement element =
wait.until(ExpectedConditions.elementToBeClickable(By.id("elementId")));
It is advisable to use explicit waits over implicit waits because a higher timeout value of implicit
wait (set for handling only some of the slow elements) gets applied to all the web elements. Thus
increasing the overall execution time of the script. On the other hand, we can apply different
timeouts to the different elements in case of explicit waits.
Page | 319
attributeContains(WebElement element, String attribute, String value)
alertIsPresent()
titleContains(String title)
titleIs(String title)
textToBePresentInElementLocated(By, String)
.withTimeout(20, SECONDS)
.pollingEvery(5, SECONDS)
.ignoring(NoSuchElementException.class);
return driver.findElement(By.id("textBoxId"));
Page | 320
}
);
1265. What are the different keyboard operations that can be performed in Selenium?
Ans. The different keyboard operations that can be performed in Selenium are-
1266. What are the different mouse actions that can be performed using Selenium?
Ans. The different mouse events supported in Selenium are-
1. click(WebElement element)
2. doubleClick(WebElement element)
3. contextClick(WebElement element)
4. mouseDown(WebElement element)
5. mouseUp(WebElement element)
6. mouseMove(WebElement element)
7. mouseMove(WebElement element, long xOffset, long yOffset)
WebElement element=driver.findElement(By.id("elementId"));
action.doubleClick(element).perform();
WebElement element=driver.findElement(By.id("elementId"));
Page | 321
action.contextClick(element).perform();
WebElement element=driver.findElement(By.id("elementId"));
action.moveToElement(element).perform();
driver.getCurrentUrl();
Page | 322
1275. What are DesiredCapabilities in Selenium WebDriver?
Ans. Desired capabilities are a set of key-value pairs that are used for storing or configuring
browser-specific properties. For example – the browser’s version, platform, etc in the browser
instances.
Page | 323
1279. How to handle dropdowns in Selenium?
Ans. Using Select class-
dropdown.selectByVisibleText("India");
dropdown.selectByIndex(1);
dropdown.selectByValue("Ind");
dropdown.selectByVisibleText("India");
System.out.println(driver.findElement(By.id("India")).isSelected());
driver.findElement(By locator).isDisplayed();
1282. How can we check if an element is enabled for interaction on a web page?
Ans. Using the isEnabled method, we can check if an element is enabled or not.
driver.findElement(By locator).isEnabled();
Page | 324
1283. What is the difference between driver.findElement() and driver.findElements()
commands?
Ans. The difference between driver.findElement() and driver.findElements() commands is-
findElement() returns a single WebElement (found first) based on the locator passed as a
parameter. Whereas findElements() returns a list of WebElements, all satisfying the
locator value passed.
Syntax of findElement()-
WebElement textbox = driver.findElement(By.id(“textBoxLocator”));
Another difference between the two is – if no element is found then findElement() throws
NoSuchElementException whereas findElements() returns a list of 0 elements.
1284. How can we handle window UI elements and window POP-ups using selenium?
Ans. Selenium is used for automating web-based applications only(or browsers only). If we want
to handle window GUI elements then we can use tools like AutoIT.
AutoIT is a freeware used for automating Windows GUI. The AutoIt scripts follow the simple
BASIC language-like syntax. Also, it can be easily integrated with Selenium tests.
robot.keyPress(KeyEvent.VK_ENTER);
1. Using element.sendKeys(“path of file”) on the web element of ‘input’ tag and type ‘file’
i.e. the elements should be like –
<input type=”file” name=”fileUpload”>
2. With the help of Robot API.
3. Using the AutoIT API.
Page | 325
1287. How to handle the HTTPS website in Selenium or how to accept the SSL untrusted
connection?
Ans. Using profiles, we can handle accepting the SSL untrusted connection certificate. Profiles
are basically a set of user preferences stored in a file.
profile.setAcceptUntrustedCertificates(true);
profile.setAssumeUntrustedCertificateIssuer(false);
.moveToElement(TargetElement)
.release(TargetElement)
.build();
dragAndDrop.perform();
((JavascriptExecutor)driver).executeScript("{JavaScriptCode}");
Page | 326
1290. How to handle alerts in Selenium?
Ans. In order to accept or dismiss an alert box, the alert class is used. This requires first
switching to the alert box and then using accept() or dismiss() command as the case may be.
alert.accept();
alert.dismiss();
(JavascriptExecutor(driver))
.executeScript("document.getElementsByClassName(locator).click();");
Now coming to POM – POM helps to create a framework for maintaining selenium scripts. In
POM for each page of the application, a class is created having the web elements belonging to
the page and methods handling the events on that page. The test scripts are maintained in
separate files and the methods of the page object files are called from the test scripts file.
Page | 327
1294. What are the advantages of POM?
Ans. The advantages are POM are-
1. Using POM, we can create an Object Repository i.e. a set of web elements in separate
files along with their associated functions. In this way, keeping the code clean.
2. For any change in UI(or web elements) only page object files are required to be updated
leaving test files unchanged.
3. It makes code reusable as well as maintainable.
Ans. Page factory is an implementation of the Page Object Model in Selenium. It provides
@FindBy annotation to find web elements. In addition, there is a PageFactory.initElements()
method to initialize all web elements defined with @FindBy annotation.
public class SamplePage {
WebDriver driver;
@FindBy(id="search")
WebElement searchTextBox;
@FindBy(name="searchBtn")
WebElement searchButton;
//Constructor
this.driver = driver;
PageFactory.initElements(driver, this);
Page | 328
//Sample method
searchTextBox.sendKeys(searchTerm);
searchButton.click();
TestNG provides inherent support for data-driven testing using @dataProvider annotation.
In this way, a person of a non-programming background can also write the test steps in a file as
long as all the keywords are present in the framework along with the implementation.
Page | 329
1299. What is a hybrid framework?
Ans. A hybrid framework is a combination of two or more frameworks. For example, a
combination of data-driven and keyword-driven frameworks is also a hybrid framework.
1. It allows running test cases in parallel thereby saving test execution time.
2. Multi-browser testing is possible using the Selenium grid by running the test on machines
having different browsers.
3. Additionally, we can do multi-platform testing by configuring nodes having different
operating systems.
1305. What is the purpose of creating a reference variable- ‘driver’ of type WebDriver
instead of directly creating a FireFoxDriver object or any other driver’s reference in the
statement Webdriver driver = new FirefoxDriver();?
Ans. By creating a reference variable of type WebDriver, we can use the same variable to work
with multiple browsers like ChromeDriver, IEDriver, etc.
Page | 330
1306. Name an API used for reading and writing data to excel files.
Ans. Apache POI API and JXL(Java Excel API) can be used for reading, writing, and updating
excel files.
1309. List out the test types that are supported by Selenium?
For web based application testing selenium can be used
b) Regression
For post release validation with continuous integration automation tool could be used
a) Jenkins
b) Hudson
c) Quick Build
d) CruiseCont
1310.Explain what is assertion in Selenium and what are the types of assertion?
Assertion is used as a verification point. It verifies that the state of the application conforms to
what is expected. The types of assertion are “assert” , “verify” and “waitFor”.
1311. Explain the difference between single and double slash in X-path?
Single slash ‘/ ’
Page | 331
Double Slash ‘// ’
Verify: Verify command will check whether the element is on the page, if it is not then the test
will carry on executing. In verification, all the commands are going to run guaranteed even if
any of test fails.
1315. While using click command can you use screen coordinate?
To click on specific part of element, you would need to use clickAT command. ClickAt
command accepts element locator and x, y co-ordinates as arguments-
1316. Why testers should opt for Selenium and not QTP?
Selenium is more popular than QTP as
Page | 332
Selenium is used specially for testing web based applications while QTP can be used for
testing client server application also
Selenium supports Firefox, IE, Opera, Safari on operating systems like Windows, Mac,
Linux etc. however QTP is limited to Internet Explorer on Windows.
Selenium supports many programming languages like Ruby, Perl, Python whereas QTP
supports only VB script
1317. What are the four parameter you have to pass in Selenium?
Four parameters that you have to pass in Selenium are
Host
Port Number
Browser
URL
Thread.sleep () :
It will stop the current (java) thread for the specified period of time. Its done only once
SetSpeed () :
For specific amount of time it will stop the execution for every selenium command.
Runs each command after setSpeed delay by the number of milliseconds mentioned in
set Speed
This command is useful for demonstration purpose or if you are using a slow web application
Page | 333
1319. What is same origin policy? How you can avoid same origin policy?
The “Same Origin Policy” is introduced for security reason, and it ensures that content of your
site will never be accessible by a script from another site. As per the policy, any code loaded
within the browser can only operate within that website’s domain.
To avoid “Same Origin Policy” proxy injection method is used, in proxy injection mode the
Selenium Server acts as a client configured HTTP proxy , which sits between the browser and
application under test and then masks the AUT under a fictional URL
1321 Mention what is the difference between Implicit wait and Explicit wait?
Implicit Wait: Sets a timeout for all successive Web Element searches. For the specified amount
of time it will try looking for element again and again before throwing a
NoSuchElementException. It waits for elements to show up.
1322.Which attribute you should consider throughout the script in frame for “if no frame
Id as well as no frame name”?
You can use…..driver.findElements(By.xpath(“//iframe”))….
You will need to switch to each and every frame and search for locator which we want.
If you are using Selenium-WebDriver, you don’t need the Selenium Server as it is using
totally different technology
Selenium Server provides Selenium RC functionality which is used for Selenium 1.0
backwards compatibility
Page | 334
Selenium Web driver makes direct calls to browser using each browsers native support
for automation, while Selenium RC requires selenium server to inject Javascript into the
browser
1324. Mention what are the capabilities of Selenium WebDriver or Selenium 2.0?
WebDriver should be used when requiring improvement support for
Handling multiple frames, pop ups , multiple browser windows and alerts
Page navigation and drag & drop
Ajax based UI elements
Multi browser testing including improved functionality for browser not well supported by
Selenium 1.0
1325. While injecting capabilities in webdriver to perform tests on a browser which is not
supported by a webdriver what is the limitation that one can come across?
Major limitation of injecting capabilities is that “findElement” command may not work as
expected.
1326. Explain how you can find broken images in a page using Selenium Web driver?
To find the broken images in a page using Selenium web driver is
Get XPath and get all the links in the page using tag name
In the page click on each and every link
Look for 404/500 in the target page title
Use getCssValue(arg0) function to get the colors by sending ‘color’ string as an argument
Page | 335
1329.Mention 5 different exceptions you had in Selenium web driver?
The 5 different exceptions you had in Selenium web drivers are
WebDriverException
NoAlertPresentException
NoSuchWindowException
NoSuchElementException
TimeoutException
1330. Explain using Webdriver how you can perform double click?
You can perform double click by using
getwindowhandle(): It is used to get the address of the current browser where the control is and
return type is string
Syntax-driver.switchTo().defaultContent();
Page | 336
1335. What is the command that is used in order to display the values of a variable into the
output console or log?
In order to display a constant string, command can be used is echo <constant string>
If order to display the value of a variable you can use command like echo ${variable
name>>
Above is using PHP. If you are using Java, replace echo with System.out.println
1338. How can you prepare customized html report using TestNG in hybrid framework?
There are three ways
Page | 337
1339.From your test script how you can create html test report?
To create html test report there are three ways
TestNG: Using inbuilt default.html to get the HTML report. Also XLST reports from
ANT, Selenium, TestNG combination
JUnit: With the help of ANT
Using our own customized reports using XSL jar for converting XML content to HTML
1340. Explain how you can insert a break point in Selenium IDE?
In Selenium IDE to insert a break point
Select “Toggle break point” by right click on the command in Selenium IDE
Press “B” on the keyboard and select the command in Selenium IDE
Multiple break points can be set in Selenium IDE
Insert a break point from the location from where you want to execute test step by step
Run the test case
At the given break point execution will be paused
To continue with the next statement click on the blue button
Click on the “Run” button to continue executing all the commands at a time
Actions: It is used for performing the operations and interactions with the target elements
Assertions: It is used as a check points
Accessors: It is used for storing the values in a variable
Page | 338
Exceptional handling is not present
Selenium IDE uses only HTML languages
External databases reading is not possible with IDE
Reading from the external files like .txt, .xls is not possible
Conditional or branching statements execution like if,else, select statements is not
possible
1345.In selenium IDE what are the element locators that can be used to locate elements on
web page?
In selenium there are mainly 4 locators that are used
X-path locators
Css locators
Html id
Html name
1346.In Selenium IDE how you can generate random numbers and dates for test data?
In Selenium IDE you can generate random numbers by using Java Script
type
css=input#s
javascript{Math.random()}
And for
type
css=input#s
javascript{new Date()}
1347.How you can convert any Selenium IDE tests from Selenese to another language?
You can use the format option of Selenium IDE to convert tests into another programming
language
Page | 339
1348.Using Selenium IDE is it possible to get data from a particular html table cell?
You can use the “storeTable” command
storeTable
Css=#table 0.2
textFromCell
When a locator has changed and Selenium IDE cannot locate the element
When element Selenium IDE waiting to access did not appear on the web page and the
operation timed out
When element Selenium IDE was trying to access was not created
Insert a break point from the location where you want to execute step by step
Run the test case
At the given break point execution will be paused
To continues with the next step click on the Blue button
To run commands at a time click on run button
Select “Execute this command” by right clicking on the command in Selenium IDE
Press “X” key on the keyboard after selecting the command in Selenium IDE
1352. In which format does source view shows your script in Selenium IDE?
In Selenium IDE source view shows your script in XML format
Page | 340
1353 . Explain how you can insert a start point in Selenium IDE?
In two ways selenium IDE can be set
Press “S” key on the keyboard and select the command in Selenium IDE
In Seleniun IDE right click on the command and the select “Set / Clear Start Point”
1354.What if you have written your own element locator and how would you test it?
To test the locator one can use “Find Button” of Selenium IDE, as you click on it, you would see
on screen an element being highlighted provided your element locator is right or or else an error
message will be displayed
1355. What is regular expressions? How you can use regular expressions in Selenium?
A regular expression is a special text string used for describing a search pattern. In Selenium IDE
regular expression can be used with the keyword- regexp: as a prefix to the value and patterns
needs to be included for the expected values.
1357 How will you handle working with multiple windows in Selenium?
We can use the command selectWindow to switch between windows. This command uses the
title of Windows to identify which window to switch to.
Page | 341
1360. What is selenium RC (Remote Control)?
Selenium IDE have limitations in terms of browser support and language support. By using
Selenium RC limitation can be diminished.
1362. Explain what is the main difference between web-driver and RC?
The main difference between Selenium RC and Webdriver is that, selenium RC injects javascript
function into browsers when the page is loaded. On the other hand, Selenium Webdriver drives
the browser using browsers built in support
Page | 342
1364. Explain what is framework and what are the frameworks available in RC?
A collection of libraries and classes is known as Framework and they are helpful when testers
has to automate test cases. NUnit, JUnit, TestNG, Bromine, RSpec, unittest are some of the
frameworks available in RC .
1366. What are the technical limitations while using Selenium RC?
Apart from “same origin policy” restriction from js, Selenium is also restricted from exercising
anything that is outside browser.
1367.Can we use Selenium RC to drive tests on two different browsers on one operating
system without Selenium Grid?
Yes, it is possible when you are not using JAVA testing framework. Instead of using Java
testing framework if you are using java client driver of selenium then TestNG allows you to do
this. By using “parallel=test” attribute you can set tests to be executed in parallel and can define
two different tests, each using different browser.
1370. Explain how you can capture server side log Selenium Server?
To capture server side log in Selenium Server, you can use command
Page | 343
1371. Other than the default port 4444 how you can run Selenium Server?
You can run Selenium server on java-jar selenium-server.jar-port other than its default port
1372. How Selenium grid hub keeps in touch with RC slave machine?
At predefined time selenium grid hub keeps polling all RC slaves to make sure it is available for
testing. The deciding parameter is called “remoteControlPollingIntervalSeconds” and is defined
in “grid_configuration.yml”file
1374.To enter values onto text boxes what is the command that can be used?
To enter values onto text boxes we can use command sendkeys()
isElementPresent(String locator)
Breakpoints: When you implement a breakpoint in your code, the execution will stop
right there. This helps you to verify that your code is working as expected.
StartpointsStartpoint indicates the point from where the execution should begin.
Startpoint can be used when you want to run the testscript from the middle of the code or
a breakpoint.
Page | 344
1377. Mention why to choose Python over Java in Selenium?
Few points that favor Python over Java to use with Selenium is,
1378 Mention what are the challenges in Handling Ajax Call in Selenium Webdriver?
Using “pause” command for handling Ajax call is not completely reliable. Long pause
time makes the test unacceptably slow and increases the testing time. Instead,
“waitforcondition” will be more helpful in testing Ajax applications.
It is difficult to assess the risk associated with particular Ajax applications
Given full freedom to developers to modify Ajax application makes the testing process
challenging
Creating automated test request may be difficult for testing tools as such AJAX
application often use different encoding or serialization technique to submit POST data.
Page | 345
1382.Mention what is Listeners in Selenium WebDriver?
In Selenium WebDriver, Listeners “listen” to the event defined in the selenium script and behave
accordingly. It allows customizing TestNG reports or logs. There are two main listeners i.e.
WebDriver Listeners and TestNG Listeners.
IAnnotationTransformer
IAnnotationTransformer2
IConfigurable
IConfigurationListener
IExecutionListener
IHookable
IInvokedMethodListener
IInvokedMethodListener2
IMethodInterceptor
IReporter
ISuiteListener
ITestListener
For Selenium,
Page | 346
1386.Mention when to use AutoIT?
1387. Mention why do you need Session Handling while working with Selenium?
While working with Selenium, you need Session Handling. This is because, during test
execution, the Selenium WebDriver has to interact with the browser all the time to execute given
commands. At the time of execution, it is also possible that, before current execution completes,
someone else starts execution of another script, in the same machine and in the same type of
browser. So to avoid such situation you need Session Handling.
1388.Mention what are the advantages of Using Git Hub For Selenium?
The advantages of Using Git Hub for Selenium are
Multiple people when they work on the same project they can update project details and
inform other team members simultaneously.
Jenkins can help you to build the project from the remote repository regularly. This helps
you to keep track of failed builds.
Page | 347
APPIUM
Appium does not necessitate the use of an application's source code or a library.
Appium has a vibrant and engaged community of developers and so help is easily available
from the community.
Appium supports multi-platform testing, which means it can execute the same test cases on
several platforms like iOS mobile, Android mobile, and Windows desktop applications.
Appium allows test scripts to run in parallel with other test scripts.
A minor modification in Appium does not necessitate reinstalling the application.
Appium supports a wide range of languages that use the Selenium client library, including C#,
Python, Java, Ruby, PHP, JavaScript with node.js, and many others.
Page | 348
1390. Mention the advantages and disadvantages of Appium.
Appium is an open-source application, implying that it can be downloaded for free and it is
simple to set up.
It can be used to run automated tests on hybrid, native as well as web applications.
To make Appium compatible with automation, you don't need to integrate any new agents in
your application, unlike other testing solutions. It tests on the very application that will be
uploaded to the App Store.
Appium now has a new feature. Along with mobile application testing, it now supports desktop
application testing for Windows.
Appium is a cross-platform, open-source mobile testing solution that allows us to conduct
cross-platform testing. As a result, you'll be able to test across a variety of platforms (single
API for both Android and IOS platforms).
Simulator: A simulator is used to simulate an environment with all of the software variables
and configurations that will be present in the actual production environment of an application.
Simulators do not try to replicate the actual hardware that will run the application in
production. Simulators can be written in high-level programming languages because they
merely construct software environments. For example, a car racing game application can be
thought of as a simulator as it simulates a real car race.
Emulator: An emulator does try to replicate all of the hardware and software aspects of a real-
world environment. In most cases, you'll need to develop an emulator in assembly language to
accomplish this. Emulators might thus be thought of as occupying a midway ground between
simulators and real-world gadgets. For example, a car simulator racing game can be thought of
as an emulator. It provides the hardware aspects of car racing as well with the help of
emulators.
Page | 349
Emulators replicate both hardware and software features, whereas simulators solely simulate
environment features that may be adjusted or created using the software. Emulators aren't a
replacement for real-device testing since they don't always do a good job of simulating the
hardware and software of a production system. They simply allow you to create an
environment that is more similar to that of a real device.
Emulators are somewhat slower as compared to simulators as emulators need to sense the
movement of hardware devices, convert it into a digital signal, and then process them.
1392. When should you use a simulator and when should you use an emulator?
Case when we should use a Simulator: Simulators are typically used in software testing
situations where the goal is to ensure that the application functions as intended when
interacting with external applications or environments.
For example, you could wish to see if an application can communicate data to another
application. Because the actual hardware configuration is unlikely to have much of an impact
on data transfers for your program, a simulated environment will usually suffice. Simulated
testing environments are also useful for ensuring that an application's interface shows properly
across a range of screen resolutions.
Case when we should use an Emulator: When you need to test how software interacts with
underlying hardware or a combination of hardware and software, emulators come in handy.
For example, if we want to discover if a firmware update will cause issues with our software or
not, we can find out with the help of an emulator. Alternatively, we could want to know how
our program performs when run on multiple CPUs or with varying memory allocations.
Emulators come in handy in these situations as well.
Page | 350
CSS, and JavaScript). Hybrid applications run inside a native container and render HTML and
handle JavaScript locally using the device's browser engine (not the browser). A web-to-native
abstraction layer gives you access to the device features like the accelerometer, camera, and
local storage that aren't available in mobile web applications. A hybrid application is not
limited to a single platform or mobile device. As a result, once constructed, it can run on any
device. Flipkart, Facebook, Twitter, and other hybrid applications are examples.
Usability Testing: Usability testing is one of the sorts of web application testing that is perfect
for assessing how the application makes it easier for users to achieve their goals. During this
test, participants are given particular, realistic circumstances to use the application in. On the
basis of gathering direct input from the end-user, usability testing is also reliable.
As a result, the testing procedure is free of prejudice while simultaneously guaranteeing that
highlighted areas improve. Usability testing also ensures that the design is intuitive and
prioritises usability and customer experience.
Performance Testing: Performance testing is a critical subset of mobile application testing
that examines an application's performance, stability, and responsiveness under various
workload situations. A performance test's main goal is to ensure that an application is
completely aligned with the performance objectives.
Additionally, it addresses performance constraints prior to launching an application.
Bottlenecks are processes inside a system's overall functions that cause the system's overall
performance to slow or stall. Load testing, volume testing, soak testing, spike testing, and
stress testing are all popular forms of performance assessments.
Security Testing: In today's world, security is a major worry for practically every mobile
application developer. According to reports, 80% of users are more likely to delete an
application because of security concerns. As a result, it is critical to concentrate on mobile
application security testing.
Users' personal information is required by certain programs, such as travel applications, for
various transactions. If your application requires something similar, it's critical that you
provide assurances about the application's confidentiality, integrity, and authenticity. You
should have strong tests run on your application that assure that no one can break into someone
else's account by unfair means.
Interruption Testing: Interruption testing is important for determining how an application
behaves when it is interrupted before returning to its former state. Incoming phone calls or
SMS, alarms, push notifications from mobile applications, battery low or full, network
connection loss and recovery, and plugged in or out while charging are all examples of
interruptions. In the event of an interruption, an application should normally run in the
background and return to its prior state.
Manual Testing: Manual testing is a tried and true method for thoroughly traversing the
complexity of mobile application testing. Manual testing ensures that the finished product
performs optimally in accordance with the planned expectations. It's especially useful in
situations where the use case isn't immediately evident. Professional QA testers could work in
short bursts to assess an application and ensure that it produces accurate results.
Page | 351
Compatibility Testing: Compatibility testing is one of the most important types of mobile
application testing. It's a form of non-functional testing that ensures a mobile application's
functionality across a variety of operating systems, applications, devices, internal hardware
specs, and network conditions. Compatibility testing determines whether a mobile application
is compatible with various operating systems and versions.
It also tests a mobile application's compatibility with various devices, browsers, networks, and
other characteristics. Backward compatibility testing and forward compatibility testing are the
two types of compatibility testing.
Localisation Testing: Localization testing is a must for mobile applications that are targeted at
a certain geographic location. It's crucial to test the mobile application's responsiveness to the
region's distinct language and cultural aspects. Local currency, use of suitable time zone date
and time formats, numerous local legislation needs, and the text and user interface are only a
few of the important areas that localization testing evaluates.
Functional Testing: Functional mobile application testing ensures that the application's
functionalities meet the specified requirements. This form of testing focuses mostly on the
mobile application's main goal and flow. Functionality testing determines if an application can
properly launch and install. It also tests the simplicity of sign-up and login, as well as the
presentation of push notifications and the proper operation of text boxes and buttons.
Installation Testing: Installation testing, also known as implementation testing, is a good way
to ensure that a mobile application is installed and removed correctly. Furthermore, installation
testing is necessary to ensure that updates are seamless and error-free. Installation testing also
examines what happens if users fail to update a mobile application.
Automated Testing: Certain mobile application quality assessments are overly complicated
and time-consuming. In such instances, Mobile application Test Automation Services come
into play, providing optimally prepared and effectively conducted automated testing as well as
manual testing, which can aid in assuring quality while also allowing for the speedier release
of superior goods. As a result, automated testing is a solid source of time and cost savings
when it comes to mobile application testing. There are various tools to perform automated
testing. Appium is one of them.
No, we do not need a server machine to run tests on Appium. Appium encourages a two-tier
architecture, in which a test machine connects to a test server that runs Appium, automating the
entire process. This setting is optional; you can run Appium on the same system as your tests.
Instead of connecting to a remote host, your test will use the loopback address to connect to
Appium.
There are many scenarios that can be tested when it comes to testing, especially for web
applications, depending on the feature coverage you want to assure. Appium comes in helpful
when it comes to testing scenarios that users will encounter when using your app.
Appium, on the other hand, becomes a restriction if you need to test more than UX simple
interactions. Consider features such as keyboarding. When sophisticated touch/keyboard mixed
Page | 352
circumstances are involved, the likelihood of a false failure is significant. Exchanging data is
another minor pain with Appium. You'll need to use various strategies when your test needs to
exchange data with your app. So keep in mind that sending and receiving information isn't
always simple. It's not Appium's fault; the WebDriver specification was created to automate
processes, not data exchange.
1397. What are the major advantages of using Appium on Sauce Labs rather than using
Appium locally?
Following are the advantages of using Appium on Sauce Labs rather than using Appium
locally:
It saves us the time that it takes to set up the Appium server locally.
We do not need to install the mobile emulators and simulators offline in our system. We can
directly use it on Sauce Labs (an American cloud-hosted web and mobile application
automated testing platform company based in San Francisco, California).
It lets us scale our application instantly.
We do not need to make any modifications to the source code of our application as is the case
while using Appium locally.
1398. Explain the general responsibilities of a mobile application testing framework. Also
explain the general structure of a mobile application testing framework.
The general structure of a mobile application testing framework consists of the following
segments :
Application Package: This refers to the target application which needs to be run and tested.
Instrumentation TestRunner: A test case runner that executes test cases against the target
application. It includes an SDK tool for creating tests as well as an API tool, such as
MonkeyRunner, that gives APIs for designing a program that controls an Android device.
Test Package: Two classes, Test case classes, and Mock objects are included in the Test
Package. The mock object contains mock data that will be used as sample input for test cases,
while the test case classes contain test methods to run on the target application.
Page | 353
Page | 354
In the above figure, we can see that a mobile application testing framework consists of three
segments: Application package, InstrumentationTestRunner, and Test package. The test
package consists of mock objects, test case classes, and Instrumentation and JUnit classes.
1399. List out the prerequisites required to run tests on an android application in
Appium locally.
Appium offers an "Inspector" to record and playback, similar to Selenium IDE's record and
playback tool. It inspects the Document Object Model to record and play native application
behaviour and provides test scripts in any preferred language. You can use the Inspector in
Appium Desktop to look up or locate elements of an application.
To find elements by id
To find elements by class name
To find elements by accessibility id
To find elements by xpath.
Appium Inspector does not support Windows and instead uses the UIAutomator viewer as an
option.
Page | 355
Test scripts produced by the tester are sent to the Appium server as requests, which are then
executed on the emulator or device. Each vendor has its own technique and methodology for
executing test cases on the device, such as IOS or Android. As a result, the test case runs after
the Appium server receives commands. To transmit command requests to the Appium server,
Appium uses JSON (Javascript Object Notation) wire protocol. Here, JSON is used to transmit
data between the server and the client.
Page | 356
1402. What do you understand about end-to-end mobile testing automation? What things
should be kept in mind while performing end-to-end mobile testing automation?
End-to-end mobile application test automation is a method of testing a software product from
beginning to end to ensure that the application flow is as planned. It establishes the product's
system mandates and ensures that all integrated components perform as expected.
The goal of end-to-end (E2E) mobile application test automation is to test from the perspective
of the end-user by replicating a real-world situation, in which a user uses the application, and
confirming the system under test and its components for data integrity and integration.
These days, software systems are sophisticated and integrated with numerous subsystems. The
entire software system could fail if one of the subsystem fails. We employ end-to-end mobile
application test automation to eliminate this big risk.
Following things should be kept in mind while performing end-to-end mobile testing
automation :
Page | 357
The installation of the application
Launching the application for the first time without having network access.
The uninstallation of the application.
If the application is supported in horizontal mode, the orientation of the application.
Testing the performance of an application on a variety of devices and network conditions.
Testing the application's response and how it reacts when a user credential is provided that is
invalid.
1403.What is mobile application testing and how does it differ from mobile testing?
The practice of testing application software produced for handheld mobile devices for
functionality, usability, and consistency is known as mobile application testing. Mobile
application testing can be done in two ways: automated or manually.
It differs from Mobile Testing, Mobile Testing focuses on native application functionalities of
mobile devices such as call, SMS, and media player, among others. Meanwhile, in Mobile
Application Testing, we concentrate solely on a specific application's operation and end-to-end
features.
The JSON Wire Protocol is the method by which client and server data are exchanged. It was
created by WebDriver's developers. The protocol, according to them, consists of a set of
standardised endpoints that are offered to clients via a RESTful API. This enables the
webdriver to communicate with a server and a client in order to automate tasks. In this
protocol, JSON is used to transmit data between the server and the client. Before delivering an
object to a server, a client (or the computer running the WebDriver API) turns it into a JSON
object. The JSON object is parsed by the server and converted back to a JavaScript object. The
response object is converted to a JSON string by the server and returned to the client. For use,
the client transforms the JSON string to a JavaScript object.
Page | 358
In the above image, we can see the client and the server communicates with each other via
JSON wire protocol. The server sends a request to the appium server for running tests and the
appium server sends back the response to the main server.
The mobile JSON Wire Protocol, which is an extension of the Selenium JSON Wire Protocol,
is used by Appium. Other than establishing up a communication stream, it's used to regulate
other mobile phone behaviours.
Appium session is a medium to send commands to a specific test application. Commands are
always executed within the context of a session. Before performing any command, a client
utilizes the session identifier as the sessionId parameter. A session is requested by the client
library from the server. After that, the server will return a sessionId endpoint, which can be
used to submit additional commands to interact with the application(s) being tested.
Every 'testing' is included within a session. Given that Appium is a simple client and server-
based method, this is self-evident. Post requests, also known as session requests, are sent by
the client to the server. These queries use the JSON Wire Protocol to communicate and convey
information in JSON Object format.
Page | 359
1406. Explain Desired Capabilities in the context of Appium.
Page | 360
Desired Capabilities are key-value pairs of data that separate the establishment of an Android
app testing session from that of an iOS app testing session. With arguments such as
platformName, deviceName, appPackage, and appActivity, the server will be able to tell the
difference between the two operating systems very quickly.
Page | 361
1407. Can a tester run tests in a multi-threaded environment while using Appium?
Yes, Appium allows testers to execute tests in a multithreaded environment. The only thing
they have to worry about is that no more than one test runs against the same Appium server at
the same time.
1408. Is it possible to use JavaScript to interact with applications while running Appium
tests?
Yes, we can use javascript to interact with applications while running Appium tests. When we
perform the instructions on Appium, the server transmits the script wrapped in an anonymous
function to our app, which is then executed.
1409. What do you mean by Appium Package master? How would you create a package?
Appium Package master refers to a set of tools that are used to create and manage Appium
packages.
To create a new Appium package, we can use the following lines of code:
In the above code, we use Gulp (a streaming build system) and the command “create-package”
to create a new package. -n signifies a new package has to be created and <package-name>
signifies the name of the package to be created.
In the above code, we mention --nobabel so as to specify that the command is for regular es5.
When we install Appium on our PC, it also installs a server that exposes the REST API. It
accepts commands and connection requests from the client and executes them on iOS or
Android devices. It responds to HTTP requests with HTTP responses. It runs the user interface
of the app using a mobile test automation framework to perform requests. As an example -
UIAutomator is used for Android API 16 or higher, while Selendroid is used for Android API
15 or below. Apple Instruments is used for iOS.
Page | 362
Working of Appium on Android:
Appium sends the command to a UIAutomator script running on the device on Android.
UIAutomator is an Android native UI automation framework that allows you to run Junit test
cases straight from the command line on the device. Despite the fact that it is written in Java,
Appium can be run from any WebDriver enabled language.
Android makes use of bootstrap.jar, a TCP server. It's used to deliver test commands to an
Android device, which UIAutomator then executes.
In the above image, we can clearly see the architecture of Appium used for running on Android
devices.
As Android uses UIAutomator, iOS uses UIAutomation. Similar to the Android, Appium
proxies the command to a UIAutomation test case running on the Mac instruments
environment. Apple provides this application "instrument" that performs various activities
like building, profiling, and controlling iOS apps. On the other hand, it also has an automation
component where you can write commands in JavaScript. It uses UIAutomation API to interact
with Application UI. Appium uses the same libraries to automate iOS Apps.
Page | 363
In the above image, we can clearly see the architecture of Appium used for running on iOS
devices.
Selendroid: Selendroid is a cutting-edge test automation framework for testing native and
hybrid Android mobile apps. The test is created using the Selenium 2 client API and is driven
by the user interface of a mobile or web app. Selendroid is a dynamic mobile testing
framework that can be used on emulators as well as real Android smartphones, with the option
of integrating as a node in Selenium Grip for parallel testing and scaling.
Page | 364
Appium is an open-source automation solution that works on both iOS and Android, whereas
Selendroid is an Android-only test automation framework.
A minor modification in Appium does not necessitate reinstalling the application. However,
Selendroid requires the application to be reinstalled even after a minor modification..
Appium has a large and active community of active developers, whereas Selendroid does not
have one.
Appium is compatible with a wide range of frameworks and languages. Selendroid, on the
other hand, works with Jenkin and Selenium.
Appium does not necessitate the use of application source code or libraries, unlike Selendroid
does.
Appium supports all Android APIs. Appium uses UIAutomator for tests that run on APIs
greater than or equal to 17, and Selendroid for tests that run on older APIs. Selendroid, on the
other hand, has different versions corresponding to the different versions of the Android APIs.
Page | 365
1412. Differentiate between Appium and Robotium.
Robotium: Robotium is a testing framework for Android that automates test cases for native
and hybrid apps. The developer can use Robotium to construct robust automatic Graphical
User Interface (GUI) testing cases for Android applications. A developer might also design a
functional, system, and acceptability test scenario, which would cover a wide range of Android
activities.
Appium is a cross-platform testing tool that works on both iOS and Android devices.
Robotium, on the other hand, is limited to Android.
Robotium only supports the Java programming language, but Appium supports a variety of
languages.
The Appium tool does not require any application source code or libraries, whereas the
Robotium tool does.
Page | 366
Appium can test native, web, and hybrid mobile apps, whereas Robotium can only test native
and hybrid mobile apps.
Many frameworks, such as Selenium, are supported by Appium. Robotium, on the other hand,
is incompatible with Selenium and many other frameworks.
You don't have to reinstall Appium every time you make a little modification. However, a
simple change in Robotium code necessitates a complete rebuild.
1413. Differentiate between open source tools, vendor tools and in house tools.
Open Source Tools: Open source tools are frameworks and apps that are free to use.
Engineers construct this tool and give it free on the internet for other engineers, developers, or
enthusiasts to develop and use, which is incredibly beneficial for aspiring developers.
Vendor Tools: Vendor tools are created by companies that have a license to utilize their tools
and codes. Technical support is accessible via the internet for these tools.
In House Tools: In-house tools are the tools that a corporation develops for its own usage and
self-development. They are never made available to the general population.
Page | 367
Basic Appium Calabash
Selenium: Selenium is an open-source (free) automated testing framework for validating web
applications across multiple browsers and platforms. Selenium Test Scripts can be written in a
variety of programming languages, including Java, C#, Python, and others.
Based on Usage:
Based on Design:
Appium - Appium is primarily intended as an HTTP server because it will handle any type of
mobile app. However, it is primarily following or developing the same in node JS, rather than
utilising standard Java or JS code. As a result, developers who want to utilise Appium for
automated testing in any type of mobile app must first install Node JS on their system before
using the Appium tool.
Selenium - Selenium is primarily used for maintaining automation logic on web applications
or webpages. It is created in such a way that it may interact with the application quickly and
easily by using browser activities.
Page | 368
1416. Do you think that automation testing can be a complete replacement for manual
software testing?
No, automation testing cannot be a complete replacement for manual software testing. This is
because the tools used are meant to execute tests once they are set up and proper automation
requires as little human participation as feasible. As convenient as it is, it should not be used to
replace manual testing; rather, it should be used for repetitive activities such as load testing,
which requires thousands of virtual users. Engineers should not automate test scripts if they are
only intended to run on a periodic basis, nor should they automate code reviews or bug testing
for new software builds that may require human engagement to detect errors. To sum up, we
can say that large-scale, repetitive jobs are better suited to automation.
1417. Mention the tests which you cannot do with an emulator but can do it with a real
device.
Following are a list of tests that we may conduct on a real device but is not possible in an
emulator:-
1418. What are the basic requirements for writing Appium tests?
Driver Client: Appium's driver client simulates the behaviour of a user in mobile applications.
Appium tests can be built with the aid of a client library, which wraps the stages of a test and
sends it to Appium over HTTP.
Appium Session: Because appium tests are run within a session, it's crucial to set up an
appium session first. Once the automation of a session has come to an end, it will be
terminated and the user will have to wait for the next session.
Desired Capabilities: In order to start an appium session, it's critical to design some
parameters known as desired parameters. Platform version, platform name, device name, and
many others are among these parameters. This also aids in defining the type of automation that
the Appium server is expected to provide.
Driver Commands: Appium provides the ability to build tests using a large and expressive set
of commands.
Page | 369
1419. What are the tools used in Appium for debugging?
We generally use log data ( a log file is maintained wherein whenever an error occurs, it is
logged into this file) to see the cause of the issue, where the failure is occurring. So for iOS –
iPhone configuration utility & for Android Monitor.bat, etc can be used. If you give the
developer the logs from these tools, they'll be able to figure out what's causing the problem
quickly.
Page | 370
1422. What are the similarities between Appium and Selenium Webdriver?
There are a lot of similarities between Appium and Selenium Webdriver testing tools. So, if you
already know Selenium Webdriver, you can quickly learn Appium.
Appium doesn't have any dependency on mobile devices OS because its framework converts the
Selenium Webdriver commands to UIAutomator, and UIAutomation commands for Android and
iOS, respectively, according to the device type rather than the OS type.
Advantages of Appium
o Appium is an open-source tool, which means it is freely available. So, we don't have to
pay for installing it.
o If you are aware of Selenium Webdriver, you can quickly learn Appium because there are
many similarities between them. So, it is easy to install.
o It allows the automated testing of hybrid, native, and web applications.
o Appium is fully compatible with automation. We don't need to include any additional
agents in our App like other testing tools to make it compatible with automation. It tests
the same App, which is going to upload to App Store.
o Along with the mobile application testing, it would also support desktop application
testing for windows.
o This is a cross-platform, freely available mobile testing tool. We can test it on multiple
platforms (single API for both Android and IOS platforms).
Disadvantages of Appium
Appium has some great features and advantages, but it has some drawbacks too, which are as
follows:
Page | 371
o It is not a limitation, but an overhead that Appium uses UIAutomator for Android
supports Android SDK, API 16, or higher. However, Appium supports older APIs, but
not directly. It uses another open-source library Selendroid to support older APIs.
o In iOS, it supports only one instance (iOS Script) to run on one Mac OS device. It means
one test can be executed at a time per Mac. If you want to run your tests on multiple iOS
devices simultaneously, you need to arrange the same number of Mac machines. But it
would be costly to set various Mac machines.
Appium can test all types of applications, i.e., native, hybrid, and web. Let's see them in detail:
Native Applications: The native applications are software programs that are developed using a
specific software development kit. Native apps are designed for use on a particular device and
installed from the App Store, such as Google Play Store or Apple's App Store. These
applications can work offline and can also use the device notification system.
Web Applications: Web applications are websites that run on browsers. These applications are
developed using HTML, CSS, and JavaScript, unlike Android and iOS apps. They do not require
a Software Development Kit (SDK) for developers to work with. Web applications run on web
browsers so, they don't need any installation.
Hybrid Applications: Hybrid applications are a combination of native and web applications.
Like native applications, you can download them from the App Store, but actually, they are web
applications inside. These applications are developed using web development languages such as
HTML, CSS, JavaScript, etc., which allows them to run on any platform.
You must have the following things on your system to use Appium. You must have installed the
following software:
Page | 372
o Android Studio
o js
o Additional Android SDK tools
o Appium jar file
o Appium Desktop Client
o Eclipse IDE for Java
o TestNG
o Eclipse
o Selenium Server JAR
o Webdriver Language Binding Library
o APPIUM for Windows
o APK App Info On Google Play
o js
Note: The js by default comes with "node.js" and "NPM" whenever you install the Appium
server. So, you don't need to install node.js and NPM separately. It is already included in the
current version of Appium.
1426. Explain the working principle of Appium as how it works on your system.
Appium is an "HTTP Server" written using Node.js platform and drives iOS and Android
sessions using Webdriver JSON wire protocol. So, before initializing the Appium Server, you
must have preinstalled Node.js on your system.
When we download and install Appium on our system, it installs a server and it on the machine
that exposes the REST API. When the clients send the command and connection requests, it
executes that command on devices like iOS or Android and replies with the HTTP responses. To
execute the requests, it uses a mobile test automation framework to run the app's user interface.
For Example, it uses Apple instruments for iOS, Selendroid for Android API 15 or lesser
version, and Google UIAutomator for Android API 16 or higher versions.
Note: Appium uses the open-source library Selendroid to support older APIs because
UIAutomator only supports API 16 or higher.
Page | 373
1427.What do you understand by Appium Inspector?
Appium Inspector is similar to Selenium IDE record and Playback tool. It is also is used for
record and playback tasks. It is used to record and play the native application behavior by
inspecting DOM and generate the test scripts in any desired language.
Appium Inspector does not support Windows and uses UIAutomator viewer as its option.
Appium Selendroid
Appium is an open-source automation tool that supports Selendroid is a test automation framework that only
both iOS and Android. supports Android.
Appium is easy to use as a small change does not On the other hand, In Selendroid, when you do
require reinstallation of the application. changes, it requires reinstallation of the application.
Appium has a strong and active community. Selendroid does not have a strong community like
Appium.
Appium supports many frameworks and languages such On the other hand, Selendroid is compatible with
as Java, Python, C#, Ruby, JavaScript, PHP, etc. Jenkins and Selenium only.
It doesn't require application source code or library in In Selendroid, The application source code or library
Appium. is required.
Page | 374
1429. What are the basic requirements for writing Appium tests?
o Driver Client: Appium drives mobile applications such as a user. It needs a Driver
Client library to write your Appium tests, which wraps test steps and sends them to the
Appium server over HTTP.
o Appium Session: We have first to initialize a session so that the Appium test can take
place in the session. Once the Automation is done for one session, it can be ended and
wait for another session.
o Desired Capabilities: Desired Capabilities are certain parameters such as PlatformName,
PlatformVersion, and Device Name, etc., which are required to initialize an Appium
session. It specifies the kind of automation one requires from the Appium server.
o Driver Commands: Driver Commands are used to write test steps using a large and
expressive vocabulary of commands.
Appium Robotium
Appium is an open-source, cross-platform testing tool that is Robotium is only used with Android.
used with both iOS and Android.
Appium supports many frameworks and languages such as Robotium only supports Java programming
Java, Python, C#, Ruby, JavaScript, PHP, etc. language.
Appium does not need application source code or library. Robotium tool requires application source code
Page | 375
or library.
We can use Appium to test native, web, and hybrid mobile Robotium is only used to test native and hybrid
applications. applications.
Appium supports many frameworks, such as Selenium. Robotium is not compatible with Selenium at
all.
In Appium, a small change does not require reinstallation of In Robotium, you have to completely rebuild
the application. the code, even for a small change.
1431. What are some possible errors that a developer can face while using Appium?
Following is the list of some possible errors a developer can face using Appium:
o Error 1: The following desired capabilities are needed but not provided: Device Name,
platformName
o Error 2: Could not find adb. Please set the ANDROID_HOME environment variable
with the Android SDK root directory path.
o Error 3:selenium.SessionNotCreatedException: A new session could not be created
o Error 4: How to find DOM element or XPath in a mobile application?
o Usability testing
o Compatibility testing
o Performance testing
o Interface testing
o Services testing
o Low-level resource testing
Page | 376
o Operational testing
o Installation testing
o Security testing etc.
1433. What is Mobile Application Testing (MAT), and how is it different from Mobile Testing
(MT)?
The data exchange is the most challenging scenario to test with Appium.
A simulator creates an environment that mimics the behavior and configurations of an actual
device. On the other hand, an emulator is used to duplicate all the device's hardware and software
features. Emulation and simulation processes are both used in mobile app testing in addition to
real devices.
No. There is no need for a server machine to run tests on Appium. Appium provides a 2-tier
architecture where a test machine connects to a test server running Appium and automating the
whole thing. We can run Appium on the same machine where we run our test.
There are mainly three segments used in Mobile Application Testing frameworks:
Page | 377
o Application Package: the Application Package is the target application that we have to
test.
o Instrumentation TestRunner: The Instrumentation TestRunner can be defined as a test
case runner that runs test cases on the target application. It consists of an SDK tool for
building tests and a tool that provides APIs for writing a program that controls an
Android device, for example, MonkeyRunner.
o Test Package: The Test Package contains two classes, Test case classes and Mock
objects. The Test case classes include test methods to perform on the target application,
while the mock object has mock data that will be used as sample input for test cases.
1438.Is it possible to interact with apps using JavaScript while testing with Appium?
Yes. We can easily interact with Apps while using JavaScript. When we run the commands on
Appium, the server sends the script to our app wrapped into an anonymous function to be
executed.
1439. What is the full form of iPA, APK, .exe, jad, and prc?
The desired capabilities are keys and values such as a map or hash sent by the client to the
server. The client sends these to tell the server what kind of automation session they want.
Page | 378
1441.Can a tester run the tests in a multithreaded environment while using Appium?
Yes, testers can run the tests in a multithreaded environment while using Appium. The only thing
that they have to care about is to ensure that no more than one test runs at the same time against
the same Appium server.
1442. How can you inspect elements of the Native Android App?
It is easy to inspect the elements of the Native Android App using the UIAutomator tool in
Android SDK. You can also get access to the object locators of the Android Native Apps.
1443. What do you understand by Appium package master? How would you create a package?
Appium package master is a set of tools used to manage and create Appium packages. We can
use the following code to create a package:
# using es7/babe1:
#regular es5:
1444.What are some critical issues you faced with cross-platform testing?
Generally, cross-platform testing is compatible with multiple platforms, but one can face cross-
platform testing issues. The issues depend upon the different OS/device versions. You can see
that the same application works on one OS while it might not work on another version.
For example, we have faced an issue that our application was working fine on iOS 6.x version
devices but on tapping a few modules on iOS 5.x devices, the application crashes. The same
thing happened with 2.3.5 Vs.
Page | 379
1445. What do you need to automate using Appium in Android? An app's .apk or you also need
the app in my workspace?
Appium does not support test frameworks because there is no need to keep them. We can use
Appium with any frameworks that we want.
Supporting Languages Appium supports Java, Python, JavaScript, Calabash only supports the
.Net, Ruby, and all major available Ruby programming language.
programming languages.
iOS mobile web page It requires a custom safari app for automation. This is not well supported.
Hybrid iOS app It requires custom UI commands & iOS UI It requires custom UI
Automator. commands & an iOS
framework.
Native iOS app Only the iOS UI Automator iOS instrumentation - calabash
iOS
Android Mobile web app It only automates chrome browser. It is not well supported.
Native Android app It requires.s both android UI Autometer & It requires Android
instrumentation - calabash
Page | 380
Selendroid android.
Internal tools It requires Android, iOS UI Autometer & It requires an Android & iOS
Selendroid. instrumentation framework.
Those Apps which are written by using Android SDKs and iOS are known as Native Apps.
The mobile web pages that can be accessed with mobile browsers are known as Mobile Web
Apps. In the case of the iOS platform, Appium supports the Safari browser, and for the Android
platform, it uses Chrome or any other built-in browser.
The apps equipped with a wrapper around the web view are known as Hybrid apps.
The time to write a test in Appium depends on the test. If your test runs a scenario, it will take as
many commands as the number of interactions needed to be performed (thus very few lines),
then it will take less time. If you are trying to exchange data, your test will take more time for
sure, and the test will also become challenging to read.
1452. How is the data exchanged between your test and the app while testing the app?
In Appium, the Web driver doesn't require to exchange data with the app. But it is not impossible
to exchange data. You can quickly achieve this by building more layers of testability.
Page | 381
1453.Is debugging a problematic task in Appium?
No, debugging is not much tricky in Appium. Appium is a Node.js application; thus, the code is
written in JavaScript. You can find the code on GitHub and downloaded it in a few seconds as it
is small and not so complex. The complexity also depends on what you have to debug.
We can quickly inspect elements on the iOS apps by using an Appium inspector. It is a GUI-
based tool used to identify elements on iOS apps. This is quite similar to that of selenium IDE.
Test Web
Provides cross-platform for Native and Hybrid mobile automation
Support JSON wire protocol
It does not require recompilation of App
Support automation test on physical device as well as similar or emulator both
It has no dependency on mobile device
ANDROID SDK
JDK
TestNG
Eclipse
Selenium Server JAR
Webdriver Language Binding Library
APPIUM for Windows
APK App Info On Google Play
js
Appium does not support testing of Android Version lower than 4.2
Limited support for hybrid app testing. E.g., not possible to test the switching action of
application from the web app to native and vice-versa
Page | 382
No support to run Appium Inspector on Microsoft Windows
Appium is an “HTTP Server” written using Node.js platform and drives iOS and Android
session using Webdriver JSON wire protocol. Hence, before initializing the Appium
Server, Node.js must be pre-installed on the system
When Appium is downloaded and installed, then a server is setup on our machine that
exposes a REST API
It receives connection and command request from the client and execute that command
on mobile devices (Android / iOS)
It responds back with HTTP responses. Again, to execute this request, it uses the mobile
test automation frameworks to drive the user interface of the apps. Framework like
Apple Instruments for iOS (Instruments are available only in Xcode 3.0 or later with OS
X v10.5 and later)
Google UIAutomator for Android API level 16 or higher
Selendroid for Android API level 15 or less
For programmer irrespective of the platform, he is automating ( Android or iOS) all the
complexities will remain under single Appium server
It opens the door to cross-platform mobile testing which means the same test would work
on multiple platforms
Appium does not require extra components in your App to make it automation friendly
It can automate Hybrid, Web and Native mobile applications
Cons:
Running scripts on multiple iOS simulators at the same time is possible with Appium
Page | 383
It uses UIAutomator for Android Automation which supports only Android SDK
platform, API 16 or higher and to support the older API’s they have used another open
source library called Selendroid
1462. Mention what are the basic requirement for writing Appium tests?
For writing Appium tests you require,
Driver Client: Appium drives mobile applications as though it were a user. Using a
client library you write your Appium tests which wrap your test steps and sends to the
Appium server over HTTP.
Appium Session: You have to first initialize a session, as such Appium test takes place in
the session. Once the Automation is done for one session, it can be ended and wait for
another session
Desired Capabilities: To initialize an Appium session you need to define certain
parameters known as “desired capabilities” like PlatformName, PlatformVersion, Device
Name and so on. It specifies the kind of automation one requires from the Appium server.
Driver Commands: You can write your test steps using a large and expressive
vocabulary of commands.
1463. Mention what are the possible errors one might encounter using Appium?
The possible errors one might face in Appium includes
Error 1: The following desired capabilities are needed but not provided: Device Name,
platformName
Error 2: Could not find adb. Please set the ANDROID_HOME environment variable
with the Android SDK root directory path
Error 3: openqa.selenium.SessionNotCreatedException: A new session could not be
created
Error 4: How to find DOM element or XPath in a mobile application?
Page | 384
1464. Do you need a server machine to run tests on Appium?
No, you don’t need server machine to run tests on Appium. Appium facilitates a 2-tier
architecture where a test machine connects to a test server running Appium and automating the
whole thing. You can have Appium running on the same machine where your test runs.
1465.Is it possible to interact with my apps using Javascript while I am testing with
Appium?
Yes, it is possible to interact with App while using Javascript. When the commands run on
Appium, the server will send the script to your app wrapped into an anonymous function to be
executed.
1466. Mention what are the most difficult scenarios to test with Appium?
The most difficult scenario to test with Appium is data exchange.
1468.In Android, do you need an app’s .apk to automate using Appium or you also need
app in my workspace?
In Android, you only need .apk file to automate using Appium.
# using es7/babe1
#regular es5
Page | 385
Gulp create-package ---nobabe1 –n <package-name>
Page | 386
Siku li Inte rvi ew Que stion s And An sw e rs
1471. Explain What Is Sikuli?
Answer :
Sikuli is a tool that uses “Visual Image Match” method to automate graphical user
interface. All the web elements in Sikuli should be taken as an image and stored inside the
project.
Page | 387
1475.Explain What Exactly Does Sikuli Script Consist Of?
Answer :
Sikuli Script is a combination of Jython and Java library that automates GUI interaction using
image pattern to direct mouse or keyboard events.
The main segment of Sikuli Script is a Java library which contains two parts:
o awt.Robot: It delivers mouse and keyboard events to appropriate locations
o C++ engine based on OpenCV: It searches given pattern on the screen sikuli-logo
o
1476. Explain How Sikuli Script Works?
Answer :
To run a Sikuli Script, Sikuli IDE creates an org.python.util.PythonInterpreter and passes a
few lines of headers to the interpreter automatically. Once these headers are defined or set, the
.py script is simply executed by PythonIntepreter.execfile().
1477. Explain How You Can Retrieve The Name Of The Image On Pop-up?
Answer :
You can retrieve the name of the image on pop-up in two ways
Method: 1
query = capture()
gotit = Filename [query] [0]
popup(gotit)
Method: 2
popup(“select a icon in the”)
query = capture()
Result = Filename [query]
If result:
Popup(Result[0])
else:
popup (“unknown image”)
1478. Explain How You Can Create An Object For Screen Class And Why Screen Class
Is Important?
Answer :
In Sikuli, screen is a base class, for this screen class we have to create an object first only then
we can access all the methods provided by Sikuli. Syntax for sikuli includes
Syntax for creating an object in Sikuli: Screen s=new Screen()
Page | 388
1480. Mention What Is The Command That Is Used To Find Whether A Particular
Element Present On The Screen?
Answer :
To find a specific element on the screen you use the syntax
s.find(“<<image name>>”);
Page | 389
1487. Mention What Is The Command Used To Type A String On A Text Box?
Answer :
To enter particular text on the text box this method is used and command is
s.type(“<<image name>>” , “String to be typed”);
Syntax:
Screen s=new Screen();
#2) Click On An Element
This method used to Click on the specific image present on the screen.
Page | 390
Syntax:
s.click(“<<image name>>”);
For Example,
s.click(“test.png”);
#3) Right Click On An Element
This method used to right-click on the specific image present on the screen.
Syntax:
s.rightClick(“<<image name>>”);
For Example,
s.rightClick(“test.png”);
#4) Find An Element
This method used to find a specific element present on the screen.
Syntax:
s.find(“<<image name>>”);
For Example,
s.find(“test.png”);
#5) Double Click on An Element
This method used to trigger a double click event on a specific image present on the screen.
Syntax:
s.doubleClick(“<<image name>>”);
For Example,
s.doubleClick(“test.png”);
#6) Check whether an Element present on the Screen
This method is used to check whether the specified element is present on the screen.
Syntax:
s.exists(“<<image name>>”);
For Example,
s.exists(“test.png”);
#7) Type a string on a Textbox
This method is used to enter the specified text on the Text box.
Syntax:
s.type(“<<image name>>”,”String to be typed”);
For Example,
s.type(“test.png”,”HI!!”);
#8) Wheeling on a particular image
This method is used to perform wheeling action on the element image.
Syntax:
s.wheel(“<<image name>>”,<<int position>>,<<int direction>>);
Page | 391
For Example,
s.wheel(“test.png”,25,0);
#9) Drag and Drop a Image/Element
This method is used to drag and drop a specified image from source position to target position.
Syntax:
s.dragDrop(“<<source image name>>”,”<<target image name>>”);
For Example,
s.dragDrop(“test.png”,”test1.png”);
#10) Roll Hover on a particular image
This method is used to perform roll hover event on the specified image.
Syntax:
s.hover(“<<image name>>”);
For Example,
s.hover(“test.png”);
#11) Paste Copied String
This method used to paste text on the specified textbox.
Syntax:
s.paste(“<<image name>>”,”test”);
For Example,
s.paste(“test.png”,”test”);
1493.WHAT IS SIKULI?
Sikuli is an open source automation testing tool which is used for test automation of web
application as well as a desktop application.
Page | 392
1495. Mechanism of Sikuli with Selenium?
The object, if we want to automate, should be captured and placed in a specific folder and pass
the path of the appropriate image into our Selenium script. At the time of execution, if the image
which we passed is matched with the image on the screen then the desired action will be
performed on that object.
Page | 393