Interview-Questions With Answer Vcentry Anandaraj
Interview-Questions With Answer Vcentry Anandaraj
Abstract Class: A class that is declared using the “abstract” keyword is known as an
abstract class. The main idea behind an abstract class is to implement the concept
of Abstraction. An abstract class can have both abstract methods (methods without
body) as well as the concrete methods (regular methods with the body). However, a
normal class (non-abstract class) cannot have abstract methods.
ABSTRACTION
In Page Object Model design pattern, we write locators (such as id, name,
xpath etc.,) in a Page Class. We utilize these locators in tests but we can’t see these
locators in the tests. Literally we hide the locators from the tests.
Abstraction is the methodology of hiding the implementation of internal details and
showing the functionality to the users.
INTERFACE
Basic statement we all know in Selenium is WebDriver driver = new
FirefoxDriver ();
An interface in Java looks similar to a class but both the interface and class are two
different concepts. An interface can have methods and variables just like the class
but the methods declared in interface are by default abstract. We can achieve 100%
abstraction and multiple inheritance in Java with Interface.
INHERITANCE
We create a Base Class in the Framework to initialize WebDriver interface,
WebDriver waits, Property files, Excels, etc., in the Base Class.
We extend the Base Class in other classes such as Tests and Utility Class.
Extending one class into other class is known as Inheritance.
POLYMORPHISM
Combination of overloading and overriding is known as Polymorphism. We
will see both overloading and overriding below.
Polymorphism allows us to perform a task in multiple ways.
METHOD OVERLOADING
We use implicit wait in Selenium. Implicit wait is an example of overloading. In
Implicit wait we use different time stamps such as SECONDS, MINUTES, HOURS
etc., A class having multiple methods with same name but different parameters is
called Method Overloading.
METHOD OVERRIDING
We use a method which was already implemented in another class by
changing its parameters. To understand this, you need to understand Overriding in
Java. Declaring a method in child class which is already present in the parent class is
called Method Overriding. Examples are get and navigate methods of different
drivers in Selenium.
ENCAPSULATION
All the classes in a framework are an example of Encapsulation. In POM
classes, we declare the data members using @FindBy and initialization of data
members will be done using Constructor to utilize those in methods.
Encapsulation is a mechanism of binding code and data together in a single unit.
9. Explain the difference between Array and Collection
Answer:
ARRAYS COLLECTION
Arrays are fixed in size that is once we create an Collection are growable in nature that is based
array we cannot increased or decreased based on on our requirement. We can increase or decrease
our requirement. of size.
With respect to memory Arrays are not With respect to memory collection are
recommended to use. recommended to use.
With respect to performance Arrays are With respect to performance collection are not
recommended to use. recommended to use.
Arrays can hold only homogeneous data types Collection can hold both homogeneous and
elements. heterogeneous elements.
There is no underlying data structure for arrays Every collection class is implemented based on
and hence ready-made method support is not some standard data structure and hence for
available. every requirement ready-made method support
is available being a performance. we can use
these method directly and We are not
responsible to implement these methods.
Arrays can hold both object and primitive. Collection can hold only object types but
primitive.
Instance Variables: Instance variables are non-static variables and are declared in a
class outside any method, constructor or block.
As instance variables are declared in a class, these variables are created when
an object of the class is created and destroyed when the object is destroyed.
Unlike local variables, we may use access specifiers for instance variables. If
we do not specify any access specifier, then the default access specifier will be
used.
Initialization of Instance Variable is not Mandatory. Its default value is 0
Instance Variable can be accessed only by creating objects.
Code :
while(result.next()) {
System.out.println(result.getString(2));
}
}
}
46. what is the return type of constructor?
Answer: No, constructor does not have any return type in Java. ... It does not
have a return type and its name is same as the class name. Mostly it is used to
instantiate the instance variables of a class. If the programmer
doesn't write a constructor the compiler writes a constructor on his behalf.
6. When Using findElement and findElements but element no found, what exception will
throw.
Answer:
ByfindElement - Throws NoSuchElementException if the element is not found
ByfindElements - Returns an empty list if no matching element is found
7. WebDriver is class or interface
Answer: Selenium WebDriver is an interface that defines a set of methods.
However, implementation is provided by the browser specific classes. Some of the
implementation classes are AndroidDriver, ChromeDriver FirefoxDriver,
InternetExplorerDriver SafariDriver etc.
The client libraries serve as a Remote WebDriver client. The client translates test
script requests to JSON payload and sends it across to the Remote WebDriver
server using the JSON wire protocol. The diagram below depicts the remote
webdriver architecture.
Browser commands,
Get commands,
Navigation commands,
Webelement commands,
Action commands and
Result commands.
List of 25 More Popular WebDriver Commands & Examples
1. Get ()
2. GetCurrentUrl ()
3. GetTitle ()
4. GetText ()
5. FindElement ()
6. FindElements ()
7. isEnabled ()
8. SendKeys ()
9. Submit ()
10. Size ()
11. ImplicityWait ()
12. Untill ()
13. Navigate ()
14. MoveToElement ()
15. Click ()
16. Close ()
17. SwtichTo ()
18. Accept ()
19. Dismiss ()
20. GetWindowHandel ()
21. GetWindowHandels ()
22. GetConnection ()
23. Quit ()
12. How will you handle drop down without using Select class.
Answer:
If you want to select an option directly without using the Select class, you
can achieve it by using Xpath [get the tag 'select' and then it's child tag 'option'], as.
26. What is different method to launch the web browser and explain?
1. implicitlyWait ()
2. setScriptTimeout ()
3. pageLoadTimeout ()
4. Thread. Sleep ()
41. How will you create generic methods for object creation?
Answer: To create objects of generic class, we use following syntax. //
To create an instance of generic class BaseType <Type> obj = new BaseType
<Type>() Note: In Parameter type we can not use primitives like 'int','char' or 'double'.
We can also pass multiple Type parameters in Generic classes.
2. Advantages of TestNG
Answer:
o It gives the ability to produce HTML Reports of execution.
o Annotations made testers life easy.
o Test cases can be Grouped & Prioritized more easily.
o Parallel testing is possible.
o Generates Logs.
o Data Parameterization is possible.
11. How will you retry the failed test cases in TestNG?
Answer:
1. After the first run of an automated test run. Right click on Project – Click on
Refresh.
2. A folder will be generated named “test-output” folder. Inside “test-output” folder,
you could find “testng-failed. xml”
3. Run “testng-failed. xml” to execute the failed test cases again.
12. Explain about TestNG.xml file?
Answer:
TestNG. xml file is a configuration file that helps in organizing our tests. It
allows testers to create and handle multiple test classes, define test suites and tests.
It makes a tester's job easier by controlling the execution of tests by putting all the
test cases together and run it under one XML file.
classes All the test cases inside a Java class will run parallel
methods All the methods with @Test annotation will execute parallel.
instances Test cases in same instance will execute parallel but two methods of two
different instances will run in different thread.
BDD - BDD stands for Behaviour Driven Development. BDD is an extension to TDD
where instead of writing the test cases, we start by writing a behaviour. Later, we
develop the code which is required for our application to perform the behaviour.
The scenario defined in the BDD approach makes it easy for the developers,
testers and business users to collaborate.
BDD is considered a best practice when it comes to automated testing as it
focuses on the behaviour of the application and not on thinking about the
implementation of the code.
The behaviour of the application is the center of focus in BDD and it forces
the developers and testers to walk-in the customer’s shoes.
5. Explain about Features file, step definition file and cucumber runner class?
Answer:
Feature File:
Features file contain high level description of the Test Scenario in simple language. It
is known as Gherkin. Gherkin is a plain English text language.
Step Definition:
Step definition maps the Test Case Steps in the feature files (introduced by
Given/When/Then) to code. It which executes the steps on Application Under Test
and checks the outcomes against expected results. For a step definition to be
executed, it must match the given component in a feature. Step definition is defined
in java files under "features/step_definitions/*_steps.java".
Runner Class:
The test runner class also acts as an interlink between feature files and step
definition classes. It is in test runner class, that you provide the path for both
feature file and step definition class.
6. Explain about Gherkin syntax
Answer: Gherkin is the format for cucumber specifications. It is a domain specific
language which helps you to describe business behavior without the need to go into
detail of implementation. This text acts as documentation and skeleton of your
automated tests.
Feature: A feature would describe the current test script which has to be executed.
Scenario: Scenario describes the steps and expected outcome for a particular test
case.
Scenario Outline: Same scenario can be executed for multiple sets of data using
scenario outline. The data is provided by a tabular structure separated by (I I).
Given: It specifies the context of the text to be executed. By using data tables
"Given", step can also be parameterized.
When: "When" specifies the test action that has to performed
Then: The expected outcome of the test can be represented by "Then"
8. Keywords in cucumber?
Answer:
Primary Keywords are:
Feature, Rule, Example, Scenario, Given, When, Then, And, But, Background,
Scenario Outline, Scenario Template and Examples
Secondary Keywords are:
(“”) Doc String, (||) Data Tables, (@) Tags, (#) Comments
4. Advantage of POM
Answer: Page Object Model (POM) is a design pattern, popularly used in test
automation that creates Object Repository for web UI elements. The advantage of
the model is that it reduces code duplication and improves test maintenance
Maven
1. What is Maven
Answer:
Maven is an automation and management tool developed by Apache
Software Foundation. It was initially released on 13 July 2004. In Yiddish language
the meaning of Maven is "accumulator of knowledge".
It is written in Java Language and used to build and manage projects written
in C#, Ruby, Scala, and other languages. It allows the developer to create projects
using Project Object Model and plugins.
It helps to build projects, dependency, and documentation. Its development
process is very similar to ANT. However, it is much advanced than ANT.
Maven is also able to build any number of projects into desired output such as
jar, war, metadata.
2. Advantage of Maven
Answer:
Maven can add all the dependencies required for the project automatically by
reading pom file. One can easily build their project to jar, war etc. Maven makes easy
to start project in different environments and one doesn't needs to handle the
dependencies injection, builds, processing, etc.
2. What is CI and CD
Answer: Continuous integration (CI) and continuous delivery (CD) embody a culture,
set of operating principles, and collection of practices that enable application
development teams to deliver code changes more frequently and reliably. The
implementation is also known as the CI/CD pipeline.
GITHUB
1. What is git.
Answer: Git is the most commonly used version control system. Git tracks the
changes you make to files, so you have a record of what has been done, and you
can revert to specific versions should you ever need to. Git also makes collaboration
easier, allowing changes by multiple people to all be merged into one source.
2. What is GitHub.
Answer: GitHub is a code hosting platform for version control and collaboration. It
lets you and others work together on projects from anywhere.
GitHub essentials like repositories, branches, commits, and Pull Requests.
6. Git push, git fetch, git conflict, git stash, git revert, git reset, git clean, git squash, git
merge, working tree
Answer:
Git revert - The git revert command is a forward-moving undo operation that offers
a safe method of undoing changes. Instead of deleting or orphaning commits in the
commit history, a revert will create a new commit that inverses the changes
specified. Git revert is a safer alternative to git reset in regards to losing work.
Git Merge - The git merge command lets you take the independent lines of
development created by git branch and integrate them into a single branch. Note that
all of the commands presented below merge into the current branch.
Git Clean - To recap, git clean is a convenience method for deleting untracked files
in a repo's working directory. Untracked files are those that are in the repo's directory
but have not yet been added to the repo's index with git add.
Git Reset - git reset is a powerful command that is used to undo local changes to
the state of a Git repo. Git reset operates on "The Three Trees of Git". These trees
are the Commit History (HEAD), the Staging Index, and the Working Directory. There
are three command line options that correspond to the three trees.
Git Push - The git push command is used to upload local repository content to a
remote repository. Pushing is how you transfer commits from your local repository to
a remote repo.
Git Fetch - The git fetch command downloads commits, files, and refs from a
remote repository into your local repo. Fetching is what you do when you want to
see what everybody else has been working on. When downloading content from a
remote repo, git pull and git fetch commands are available to accomplish the task.
Git Conflict – Git can handle most merges on its own with automatic merging
features. A conflict arises when two separate branches have made edits to the
same line in a file, or when a file has been deleted in one branch but edited in the
other. Conflicts will most likely happen when working in a team environment.
Git stash - git stash temporarily shelves (or stashes) changes you've made to your
working copy so you can work on something else, and then come back and re-apply
them later on.
Manual
1. Explain about SDLC process
2. Explain about STLC process
3. Principle of Software Testing
4. What is regression, integration, system, module, user acceptance testing
5. What is exploratory, adhoc, buddy, pair testing
6. What is smoke and sanity testing
7. What is alpha and beta testing
8. Explain about defect life cycle
9. What is latent bug
10. What is show stopper bug
11. What is entry and exit criteria
12. Difference between QA and QC
13. Difference between verification and validation
14. What is RTM
15. What is test plan
16. What is test strategy
17. Explain about test execution report and test summary report
General Questions
1. Self Intro
Answer:
I am Raj Mohammed, currently work as software test analysis in Accelerated
Development Machine, I got nearly 4.5 years of experience in testing, where as one
year in manual testing and three years in automation testing using selenium web
driver in java.
I graduated with master of computer application in 2013 and was offered as
data analyst position in data matrix work till 2015 and the started my carrier as tester
in Accelerate development machine. During this time, I completed my ISTQB
certification too.
Gird Collection – Path Plastics, south Africa (Scrum Call – 12.30pm ITS)
Structure of Framework:
Test-Base Class: Every framework has a Base Class; we do initialize
WebDriver and implicit waits and bloggers, reports, etc in the test base
class.
Page Object Model: Do your tests independent of element locators. You
have to specify where you store all your element your locaters such as ID
XPath CSS whatever, if you are using a Page Object model to separate
element locators with tests then clearly explain that. Nowadays everyone is
using the Page Object design model to do this. We can also keep Element
locators in property files.
Functions Library: Every project has some Functions Library but in most
of the cases, we do use separate Functions as Generic Functions and
Project-Specific functions also called Business functions. Sometimes asked
in an interview, what is the difference between Generic and Business
Function?
Don't get confuse and reply Generic Functions are related to Operations we
do perform like Click, select etc., of an Element and Business Functions are
more related for B2B Business to Business applications nature. Example
Transfer Funds Functionality is more related to Banking Application,
whereas Order Booking Functionality more over related to Retail Business
applications like Amazon and Flipkart. If you call Test data from the excel
sheet comes under Generic Function and more technically we call it as
Utility functions property.
Property Files: Details such as browser type URL could be placed in
property files and also specify what are the Test NG Annotations that you
have used in your Framework.
Test NG: In case if you are using Test NG Annotations you can explain how
you do use Test NG Annotations into your Framework.
@BeforeSuite
@BeforeTest
@BeforeClass
@BeforeMethod
@Test
@AfterMethod
@AfterClass
@AfterTest
@AfterSuite
Parameterization: You can explain how you do Parameterize Test cases
using Excel files or Test NG Annotations.
Screenshots: Explain how you captured Error screenshots image into
Screenshot folder for the Pass or Failed Test Cases.
Test Reports: Explain how you Generate Reports like HTML, Extent
Reports etc. in your Test Reports Folder and how you send those Reports
to your peers like sending that email to your leads or related Peers.
Version Control: Mention what is the Version Control you have used as a
GIT Repository or SVN.
Continuous Integration Tool: Mention continuous-integration tools like
Jenkins if you use the same into your Project.
Sample:
Let's get started with the language you can tell that in our selenium
project. Like we are using Java language in our project because most of the
Automation developers know selenium with Java type of framework or any
language which you use Python, C# etc.
Types of Framework: In our project, we are using a Data -driven or Keyword-
driven or Hybrid Framework by using the Page Object Model design pattern
with Page Factory.
To continue in detail related Page Object Model you can mention for the
Page Object Model. Under POM we have maintained a Class for Every Web
Page separately under each Web Page has a separate Class and that Class
holds the functionality and members of that Particular Web Page. We have
separate classes for every individual Test case.
Packages: we have separate Packages for pages and Test scripts. All the
web page related Classes comes under Pages Package and all the Tests
related Classes comes under Tests Package. And all the Tests are kept in
the SRC tests Java. Remaining files such as
Config. properties Element Locators Utility Files Test data, etc. are kept in
SRC may in Java.
For Example: Homepage and login page of the Application have a separate
class to store element locators for the login Tests.
There would be a separate class that calls the method from the Homepage
class and login page.
To continue about Test base class, Test base class deals with all the
common functions used by all the pages. This class is responsible for
loading the configurations from property files, Initializing the WebDriver
implicit waits, External reports and to create the Object of a file Input
stream. Which is responsible for pointing towards the file from which the
data should be read?
Test Data, All the historical test data will be kept in the excel sheet by
using this particular Excel Sheet we pass this data and handle Data -driven
testing. We use Apache to point to handle Excel sheets
Test NG, we use Test NG annotations for Assertions, Grouping and parallel
Execution.
Maven, we are using Maven for build execution and dependency purpose.
We integrate the Test NG dependency in POM.XML file and ru nning this
POM.XML file using Jenkins
Extent Reports, For the Reporting purpose, we are using Extent Reports it
generates beautiful HTML reports. We use the Extent Reports for
maintaining logs also to include the screenshots of Faile d Test cases in the
External reports.
Through most of its brief history (since 1999-2000), “Agile” has been
predominantly an approach to software development and IT application development
projects. Since then, however, it now extends to other fields, too, especially in the
knowledge and services industries.
They do this by breaking up the traditionally long delivery cycle (typical of the
legacy “waterfall methods”) into shorter periods, called sprints or iterations. The
iteration provides the cadence for delivering a working product to the customer,
getting feedback and making changes based on the feedback.
Thus, Agile methods have sought to reduce delivery times (delivering early,
delivering often) to ensure that smaller vertical chunks of the product get to the
market, enabling customers to provide feedback early and ensure that the product
they finally get meets their needs.
Agile methods also include technical practices – most of which fall under the
umbrella term DevOps – that enable Test Automation, Continuous Integration/
Continuous Delivery/ Deployment (CI/ CD) and overall, an ever-shrinking delivery
cycle for software and other products and services.
The Agile Manifesto is a statement of core values and principles for software
development. The Agile Manifesto for software development was set up in 2001 and
it is a declaration of 4 vital rules and 12principles that serve as a guide for people
in agile software development. It was created by 17 professionals who already
practiced agile methods such as XP, DSDM, SCRUM, FDD, etc, gathered in the
snowy mountains of the US state of Utah, convened by Kent Beck.
Individuals and interactions over processes and tools – The first value
emphasizes teamwork and communication. We must understand that software
development is a human activity and that the quality of interaction between people is
vital. Tools are an important part of software development, but making great software
depends much more on teamwork, regardless of the tools team may use.
Working software over comprehensive documentation – Documentation has its
place and can be a great resource or reference for users and co-workers alike. The
main goal of software development, however, is to develop software that offers
business benefits rather than extensive documentation.
Customer collaboration over contract negotiation – Development teams must
work closely and communicate with their customers frequently. By listening to and
getting feedback, teams will understand what all stakeholders really want.
Responding to change over following a plan – Changes are a reality in Software
development, a reality that your Software process should reflect. A project plan must
be flexible enough to change, as the situation demands.
Agile is an umbrella term for several methods and practices. Let’s look at some of the
popular methodologies:
Scrum
Extreme Programming (XP)
Adaptive Software Development (ASD)
Dynamic Software Development Method (DSDM)
Feature Driven Development (FDD)
Kanban
Behaviour Driven Development (BDD)
Answer:
Within agile development, Scrum teams are supported by two specific roles.
The first is a Scrum Master, who can be thought of as a coach for the team, helping
team members use the Scrum process to perform at the highest level.
The product owner (PO) is the other role, and in Scrum software
development, represents the business, customers or users, and guides the team
toward building the right product.
During an agile Scrum sprint, the Scrum team takes a small set of features
from idea to coded and tested functionality. At the end, these features are done,
meaning coded, tested and integrated into the evolving product or system.
On each day of the sprint, all team members should attend a daily Scrum
meeting, including the Scrum Master and the product owner. This meeting is time
boxed to no more than 15 minutes. During that time, team members share what they
worked on the prior day, will work on that day, and identify any impediments to
progress.
The Scrum model sees daily scrums as a way to synchronize the work of
team members as they discuss the work of the sprint.
At the end of a sprint, the team conducts a sprint review during which the
team demonstrates the new functionality to the PO or any other stakeholder who
wishes to provide feedback that could influence the next sprint.
This feedback loop within Scrum software development may result in changes
to the freshly delivered functionality, but it may just as likely result in revising or
adding items to the product backlog.
The product backlog is another artifact of Scrum. This is the complete list of
the functionality that remains to be added to the product. The product owner
prioritizes the backlog so the team always works on the most valuable features first.
The most popular and successful way to create a product backlog using
Scrum methodology is to populate it with user stories, which are short descriptions of
functionality described from the perspective of a user or customer.
In Scrum project management, on the first day of a sprint and during the
planning meeting, team members create the sprint backlog. The sprint backlog can
be thought of as the team's to-do list for the sprint, whereas a product backlog is a
list of features to be built (written in the form of user stories).
The sprint backlog is the list of tasks the team needs to perform in order to
deliver the functionality it committed to deliver during the sprint.
Additional artifacts resulting from the Scrum agile methodology is the sprint
burn-down chart and release burn-down chart. Burn-down charts show the amount of
work remaining either in a sprint or a release, and are an effective tool in Scrum
software development to determine whether a sprint or release is on schedule to
have all planned work finished by the desired date.
A good Scrum Master shelters the team from outside distractions, allowing
team members to focus maniacally during the sprint on the goal they have selected.
While the Scrum Master focuses on helping the team be the best that it can
be, the product owner works to direct the team to the right goal. The product owner
does this by creating a compelling vision of the product, and then conveying that
vision to the team through the product backlog.
The product owner is responsible for prioritizing the backlog during Scrum
development, to ensure it’s up to par as more is learned about the system being built,
its users, the team and so on.
The third and final role in Scrum project management is the Scrum team
itself. Although individuals may join the team with various job titles, in Scrum, those
titles are insignificant. Scrum methodology states that each person contributes in
whatever way they can to complete the work of each sprint.
This does not mean that a tester will be expected to re-architect the system;
individuals will spend most (and sometimes all) of their time working in whatever
discipline they worked before adopting the agile Scrum model. But with Scrum,
individuals are expected to work beyond their preferred disciplines whenever doing
so would be for the good of the team.
One way to think of the interlocking nature of these three roles in this agile
methodology is as a race car.
The Scrum team is the car itself, ready to speed along in whatever direction it
is pointed. The product owner is the driver, making sure that the car is always going
in the right direction. And the Scrum Master is the chief mechanic, keeping the car
well-tuned and performing at its best.