Manual Testing and Selenium
Manual Testing and Selenium
Manual Testing and Selenium
1
MANUAL TESTING
SDLC: - software development life cycle
➢ It is standard procedure to develop new software
It has different stages like
REUIREMENT
FEASIBILITY STUDY (OR) ANALYSIS
DESIGN
CODING
TESTING
INSTALLATION
MAINTANANCE
It has different model
➢ Waterfall model
➢ Spiral model
➢ V. model
➢ Prototype model
➢ Derived model
➢ Hybrid model
➢ Agile model
Waterfall model: -
It is step by step procedure (or) A standard procedure
to develop a new software.
REQUIRMENT COLLECTION: -
It is nothing but collection of requirements from
customer’s place. it is done by business analyst or product analyst
where in BA will go to customers place and collect the requirement in
2
the business language and convert into software language and explain
the requirement to developer, test engineer, project manager, architect
etc. this process is called requirement collection.
Here BA acts like bridge between customers and IT companies.
WHO CAN BECOME BA?
Domain expert: -
A person who has worked on the same domain for 10 to 15 years and
has got very good knowledge can be called as domain expert
=>Senior development engineer /senior test engineer:
Who has got more than 6 to 8 years of experience on the same project
and has got very good project knowledge can become BA.
NOTE: -
➢ For 70% to 80% of critical, complex and longform project BA
will be there.
➢ For 20% to 30% of simple and small projects senior developer
or senior test engineer can play the role of BA.
Business Software
Language Language
3
BS (business specification) FS (functional specification)
User stories
Feasibility study:
Once after the requirement collection is completed then only, we go
for feasibility study. This is done by team which consist of project
manager, BA, Architect, Finance team and HR team.
►This is the stage where company will decide whether to take up the
project or not and if we take up the project company will check do we
have sufficient resources, sufficient technology and sufficient lab set
ups.
► This is the stage where company will get to know if they take up
the project do they get profit or not.
Roles of PM: Project manager will interact with Architect, BA,
Finance officer and HR team and gather the information and then PM
will decide to take up the project or not.
► Roles of Architect: Architect will think from technical point of
view and he will decide technology is it possible to implement the
project or not, if yes which technology should be followed all these
decisions will be taken by Architect
►Role of Finance team: Finance team will think from money point
of view, they will see how much should be invested and what is the
operational cost and we invest money do we get profit or not.
►Role of HR: HR team will think from resource point of view. they
will think how many experience engineers and freshers should be
hired to work on the project
Design:
▸ Once after the feasibility study is completed then we go for design
phase. It is done by architect.
► There are 2 types of design
4
1. High level design (HLD).
2. Low level design (LLD).
HLD: The design of Architecture of project. It is done by Senior
Architect.
LLD: The detailed design of smallest feature is called as LLD. It’s
done by senior developer.
Coding:
*It is nothing but writing the programmes. It is done by development
engineers where in they implement the software according to the
Specification, Customer Requirement.
Testing:
once after coding is completed the next phase is testing. It is done by
test engineers, here testers will start testing the application according
to the customers requirement specification in order to find the defects
in the software is called as Testing.
Installation:
Once after the testing is completed and the software is ready, we will
install the software in the customers place so that customers can start
to use the software and run the business.
There are 2 types of installation.
1. Single time installation
2. Multiple installation
Note:
Single time installation can be done by Senior Development egg.
Multiple installation is done by field engineer / installation engineer
/implementation engineer / support engineer.
Maintenance:
5
Once after the Software is installed Customer will the start to use the
Software and own run the business, while using the software. its
customers face any problem or issue then Company will fix the
problem or defects for free and reset the defect and give new Software
to the Customer freely for a period of 6 months to 1 year depending on
the agreement between the customer and the company. this phase is
called as maintenance.
Waterfall model: It is step by step procedure (or) A standard
procedure to develop a new software.
WHY THIS MODEL IS CALLED WATERFALL MODEL?
Here the backtracking is not possible i.e., once after the feasibility study
is completed all the requirement will be freeze and we cannot go back
and change the requirement so this model is called as waterfall model.
DRAWBACK OF WATERFALL MODEL:
1. Cannot adopt the changes in requirements
2. Testing is a small phase which is done only after coding.
3. Rework cost is high
4. For bigger and complex projects, this model is not good as a risk
factor is higher.
5. Not suitable for the projects where requirements are changed
frequently.
ADVANTAGES OF WATERFALL MODEL.
1. Simple and easy to understand and use.
2. it is easy to maintain.
3. Initial investment is less.
4. Since requirements are not going to change, we can expect very good
quality of the product.
6
APPLICATION OF WATERFALL MODEL:
1. To build small application.
2. To build short term application.
3. Whenever we are sure that requirements are not going to change.
WHAT ARE THE DISADVANTAGES OF DEVELOPER
TESTING THE APPLICATION.
1. Developers will utilize the time allocated for testing to build the
application.
2. Developers will be over confident.
3. They will concentrate more on development rather than testing.
4. They will not test the software from negative point of view.
5. Even though bugs are there in the software they may hide it.
6. Lack of End-to-End knowledge.
SPIRAL MODEL:
Spiral model is a step-by-step procedure or standard procedure to
develop the new software. In order to overcome the drawback of
waterfall model we go for spiral model. spiral model is mainly used
when there is dependency between the modules or features or
functionalities.
ADVANTAGES:
►Requirement changes can be done after every cycle.
►Customers get an opportunity to see the software in every cycles.
►Testing is done in every cycle before going to next cycle.
►Spiral model is a controlled model. Ime When one module is
completely stable then only, we develop next module.
Drawbacks:
7
►Requirement collection and design phase are not tested
Is not beneficial for smaller projects.
►Spiral may go infinitely.
►Documentation is more as it has intermediate phases.
►It is costly for smaller projects.
►Why spiral model is called iterative model?
In every cycle same process is repeated so the model is called iterative
model.
►Why this model is called Incremental model?
In every cycle we keep on adding new module, so this model is called
incremental model.
V-MODEL (VERIFICATION MODEL OR
VALIDATION MODEL)
It is step by step procedure or standard procedure to develop a new
software in order overcome the drawback of waterfall model and spiral
model we use v-model here all stages are tested
Verification:
Verification CRS, SRS.HLD, LLD again the requirement and check
whether if it is matching the requirement or not is called verification it
is done by the testers before the software is develop
Here we ensure that are we building software right,
system right product right or application right.
Validation:
Verifying the functionality of an application by
executing test cases is called validation it is done by the testers once
after the software is develop.
Here we ensure that are we building right product.
8
Advantages:
• Total time is less (testing is done from early stage)
• All the stages are tested
• Since testing is done in the early-stage downward flow of defect
will be less.
• Total investment is less (downward flow of defect will be less and
cost of fixing the defects is less)
• Software quality will be good.
• Requirement changes can be done in any stage
Drawback:
• Initial investment is high.
• Documentation is more.
Application:
• The requirement is well defined and not ambiguous.
• Project medium size is to large size.
• When costumers want to quality software which is in short span
of time.
Prototype model:
It is step by step procedure or standard procedure to
develop a new software
• Whenever the customer has no clarity about the requirement, we
will go for prototype model.
• Here we create a dummy software and show to the customer
• Until the customer like the dummy software, we will go for
agreement after successfully completed agreement we go for
actual software.
Advantages:
9
►Customer will get to know how the software looks in the early stage
itself.
►There will be improved communication between customers and
developers.
► Requirement changes are allowed.
►Missing functionalities can be easily figured out.
► Errors can be detected much earlier thereby saving a lot of effort and
cost.
►The developed prototype can be reused by the developer for other
projects in the future.
DRAWBACK :
• Total time take is high
• Total investment is more
• There will be delay in releasing software to customer
• Poor documentation due to continuously changing customer
requirements
APPLICATIONS:
• When the customer are not having the requirement .
• Whenever the customer is new to the software .
• When the developers are new to the domain .
• When the customer gives the requirement in stages .
DERIVED MODEL :
Here we take a basic model or any single model and any single
model and change it according to the project needs to company
standards is called derived model.
10
HYBRID MODEL
The process of combining or merging more than one model into
single model is called hybrid model.
EX:1
Combination of prototype model
• Where the module are dependent and when the customer not
having clarity about requirement
• Not having clarity requirement prototype model
EX:2
We combine prototype +V.model➔customer ,not having clarity
about project and they wants quality of product in tight shedual.
SOFTWARE TESTING
The process of finding the defects in the software is called software
testing.
Or
Testing the functionality of an application according to customer
requirement specification is called software testing .
Or
Executing of programs with the intent to find the defect in software is
called as software testing.
TYPES OF SOFTWARE TESTING :
1. White box testing
2. Black box testing
3. Grey box testing
11
WHITE BOX TESTING :
• Testing each and every line of the program is called white box
testing.
• It's done by the developer in order to reduce the bugs, before
given the software to testing team
• WBT is also called as
➢ Unit testing
➢ Clear box testing
➢ glass box testing
➢ Transparent box testing
➢ Open box testing
➢ Code base testing
BLACK BOX TESTING
• Verifying the functionality of an application according to the
customer requirement specification is called BBT.
• It is done by the test engineer in order to find the defects.
➢ Functional Testing
➢ Specification based testing
➢ closed box testing
➢ Behavioural testing
Difference between WHITE BOX TESTING AND BLACK BOX
TESTING:
12
5 source code is visible source code is not visible
14
• On multiple users access application
• On more revenue generation application
• On banking application (phonpe,gapy,paytm etc)
• The application which will be expected to be very simple
(ex:games)
ACCESSABILITY TESTING(ADA TESTING)
Testing the functionality of an application whether it is
accessible for physically challenge or physically disabled people is
called as accessibility testing.
Some of the examples are:
1. Voice recognition
2. Speech to text
3. Camera gestures
4. Subtility
5. Zoom in zoom out
6. Turn by turn navigation
HOW TO DO ACCESSABILITY TESTING:
Normal test engineer cannot perform accessibility testing so we
depend on automation tools.
Some of tools are:-
1) Wave web accessibility
2) A checker
3) A viewers
4) In focus
The condition which are verified in accessibility testing are colour ,
font, size and style of the application should be according to GUI
standards
ADA: American disability act testing
15
FUNCTIONAL TESTING:
Testing each and every component of an application Thorley or
rigorously (deep testing) again the CRS is called as functional testing
.
It is also called as component testing or field level testing.
FIRST NAME TEXT FIELD:
Application: Gmail
Module name: login /signup page
CRS: 4 to 16 characters accepted
@accpeted
First letter should be capital
Alpha numerical accepted
No blanks ,no spaces
‘_’ accepted
POSITIVE SCENARIOS:
1) It should accept minimum 4 character.
2) It should accept maximum 16 character.
3) It should accept @ symbol only once.
4) It should combination of numbers and alphabets.
5) It should accept only first letter is capital
6) Is should accept only _ symbol
7) It should accept only upper case alphabets also.
8) It should accept only lower case alphabets also.
9) It should accept combination of upper and lower alphabets.
NEGATIVE SCENARIOS:
1) It should not accept below 4 character.
2) It should not accept above 16 character.
16
3) It should not accept only numbers.
4) It should not accept only first letter is lower case.
5) It should not accept only lower case of alphabets.
6) It should not accept @ symbol more the once.
7) It should not accept blanks.
8) It should not accept special characters apart from @ character.
9) It should not accept spaces .
10) It should not accept emoji’s
POINTS TO REMENBER WHILE DOING FUNCTIONAL
TESTING:
i. We must always start testing the application with the valid
data.
ii. If the application is working for valid data only then we must
test for invalid data.
iii. If the application is not working for one of invalid values, we
can continue testing for the other invalid values.
➔In testing ,we should not assume or prepare requirement ,if we have
any queries, talk to the one who knows the requirement very well and
clarify the queries.
➔we must not do ever testing (testing for all possible junk values ) or
under testing (testing for a set of values ) we must only try to do
optimes testing.
➔we must do both positive testing(testing of valid data) and negative
testing (testing for invalid data)
TYPES OF TESTING:
Any testing we can do it in 3ways:
1. Over testing
2. Under testing
3. Optimized testing
17
OVER TESTING:
Testing the application with those scenarios which does not make
sense is called over testing by doing over testing we loose a lot of
time.
UNDER TESTING:
Testing t the application with the insufficient set of data is called as
under testing by doing under testing we miss lots of defects.
OPTIMIZED TESTING:
Testing the application with those scenarios which really make sense
is called optimal testing
ENTRY:
1. White box testing should be done.
2. The software should be installed in proper test environment.
3. Test cases should be ready.
4. Test data should be ready.
5. Resources should be available.
EXIT:
It is based on the following aspects
1. 85% to 90% of the test cases should be executed.
2. 85% to 90% of the test cases should be passed.
3. No critical & blocker bugs are allowed.
Steps to do functional testing:
Prepare functional test plane.
Prepare function test scenarios & test cases.
Execute test cases.
Report the defects.
Track and retest the defects.
Retesting & testing goes on until functional testing is completed.
TEST CASE(template):
18
Test case template (Header)
Test case name/test case ID: Each test case should be represented by
a unique ID.
Project name: Name of the project test case belong to
Release name: Name of the release test case belong to
Requirement ID: Mention the patch of reference documents.
Module name: Name of the module test case belong to.
Pre condition: Any prerequisite that must be fulfilled before the
execution of this test case. List all the pre-condition in order to
execute this test case successfully.
Test data: the data which could be used an input test cases.
Priority: this very useful while test execution. (low, medium ,high)
Test case type:(FT/IT/ST)
Brief description:
BODY OF THE TEST CASE:
Step.no Action/description input Expected Actual Status
result result
FOOTER:
AUTHOR NAME:
CREATED DATA:
REVIEWED :
APPROVED BY:
19
60.0 amount transfer (SBI)
60.1 from accept 12-digit integer
60.1.1 Should accept only those account which are created by
manager
60.2 to account number test field.
60.2.1 should accept 12 digit integer.
60.2.2 should accept only those accounts which are created by
manager.
60.3 amount text field.
60.3.1 should accept only positive integer in the range 100 to 50000.
60.3.2 should not accept more than balance.
POSITIVE SCENARIOS:
It should accept account number 12 digits only.
It should accept account number text field only.
It should accept only the accounts which are create by manager.
It accept account number should be positive integer only.
It should accept range of amount 100 to 50000 only.
NEGATIVE SCENARIOS:
It should not accept more than 12 digit account number.
it should not accept account number any other field.
It should not accept the account which are not created by
manager.
It should not accept negative integers in account number.
It should not accept account number without numbers.
It should not accept less than the amount of 100.
It should not accept more then the amount of 50000.
20
Test case template (header):
Test case name (test case ID:SBI-AMOUNT-TRANSFER-R01)
Project name:SBI
Release date:R01
Requirement ID: CRS -60.0
Model name: amount transfer
Pre condition : test URL, user name & password, account numbers
,basic details
Test data:
s.purushotham,**********,www.SBI.com,9989881194,89858954
84.
Priority :
Test case type: functional testing case.
Brief description : to validate that the amount transfer feature of
SBI BANKING application .
BODY OF THE TEST CASE:
Step.no Action/description input Expected Actual Status
result result
1 Launch a browser www.SBI.com Login
and enter the test page
URL should be
displayed.
2 Login as user ‘A’ s. purushotham Home
with valid ************ page
credentials. should be
displayer.
3 Click on amount N/A Amount
transfer link transfer
page
21
should be
displayed.
22
L Enter negative -8-9886868676 It should
account number not accept
M Enter account N/A It should
number which are not accept
not created by
manager.
INTEGRATION TESTING:
Testing the data flow between dependent module is called as
integration.
NOTE:
We will test the data flow only in one direction or we might test in
both the directions . we might not test the data flow to all the
modules because it varies from module to module.
APPLICATION:(google drive)
1. Login to google drive, click on (+) compose button and select
the file and click on upload button and check weather it is
display in.
2. Login to google drive ,application and delete ,the select file
,check weather the deleted file is displayed in bin.
3. Login to google drive click on bin select a file and restored.
PROCEDURE TO DO INTEGRATION :
I. First we should understand the complete project it mean we
should understand how each & every feature works.
II. We should understand how the feature are dependent.
III. Identify all possible scenarios.
IV. Prioritise the scenarios.
V. Write integration test cases.
VI. Test the application by executing test cases.
VII. While executing if we find out any defects we have to report
them to the development team.
23
VIII. Track and retest the defects.
IX. Tracking and retesting will continue until integration testing is
completed.
TYPES OF INTEGRATION TESTING:
There is two types of integration testing:
1. Incremental integration testing.
2. Non incremental integration testing.
NON-INCREMENTAL INTEGRATION TESTING:
It is a type of integration testing where all the modules are integration
at once and tested as a unit.
➔it is also called as big bang approach.
DISADVANDAGES :
• Identifying the root cause of the defect id difficult.
• We might miss some integration scenarios.
• Chances are there where it may prove to defect.
• We have to wait until the entire application is ready.
• We will have less time to test the application.
INCREMENTAL INTEGRATION TESTING:
Incrementally adding the modules and testing the data flow b/w
the dependent modules is called as incremental integration testing.
There are two types of incremental testing
1. Top-down incremental integration testing
2. Bottom-up incremental integration testing
24
BOTTOM-UP INCREMENTAL INTEGRATION TESTING:
Incrementally adding the modules and testing the data flow between
the dependent modules but make sure that the module we have adding
is the parent module of the previous module.
TOP-DOWN INCREMENTAL INTEGRATION TESTING:
ADVANTAGES:
Fault localization (finding out ) is easier.
DISADVANTAGES:
Needs many study.
BOTTOM-UP INCREMENTAL INTEGRATION TESTING:
ADVANTAGES:
Fault localization (finding out ) is easier.
No time wasted waiting for all module to be developed unlike big
bang approach.
DISADVANTAGES:
Critical modules which control the flow to application are tested last
and may be prone to defects.
DIFFERENCE BETWEEN STUBS AND DRIVERS:
STUBS DRIVERS
Stubs are used in top down Drivers are used in bottom up
integration testing. integration testing.
Stubs are basically known as a Drivers are the “calling
“called program” program”
Stubs are basically used in the Drivers are mainly used in
absence of low level modules absence of high level modules.
Dummy program of lower level Dummy program of high level
modules modules
ENTRY:
25
1. White box testing should be done.
2. The software should be installed in proper test environment.
3. Test cases should be ready.
4. Test data should be ready.
5. Resources should be available.
6. It should have met with exist criteria of functional testing.
EXIT:
1. All test cases should be executed.
2. 90 to 95% of the test cases should be passed.
3. No critical & blocker defects should be there in the software.
SYSTEM TESTING:
It can also defined as, it is an end to end testing where testing
environment should be similar to production environment /
Why it is end to end testing:
Testing navigate through all the feature and check whether the end
feature or latest feature is working as expected or not.
Example for end-to-end testing:
CBO-CRS-1
If any new customer apply overdraft for the first time then the back
should charge 2% rate of interest per month and also they should
charge an activation fees of RS.250
If the same customer apply over draft for second time the bank
should charge only 2% rate of interest per month and bank will not
charge activation fee.
TYPES OF ENVIROMENT:
1. Development environment
2. Testing environment
3. Production environment
DEVELOPMENT ENVIROMENT:
26
In the development environmental develop the software .which is
access to development team . in this development environment
development lead and senior development engineers.
TESTING ENVIRONMENT:
In the testing environment testing the software and finding the bugs
which present in developed software. This is access to testing team. In
test lead and senior tester and testing engineer are there.
PRODUCTION ENVIRONMEN:
In the production environment which is access to the customer .when
software is ready then install to the customer place in production
server to use this run the business by customer.
WORK ALLOCATRION:
Work allocating to the developer or tester based on there work
experience.
Example:
• critical work is given to 5-6 experience persons
• major work given to 3-2 experience persons.
• Miner work given to fresher 1 year experience.
BUILD PROCESS:
Business analyst will collect the requirement and given to project
manager. He will give to development team & testing team.
→development team will develop the application and compile &
compress the source code. White box testing is done. Then build is
ready the development lead inform to test lead as
• Build is ready
• It is in server….(source code)
• Path: D drive/BO1
• Module is ready
• White box testing is ready.
27
→develop team develop the software that time testing will do
understanding the requirement identify the scenarios and write test
cases. Once development lead informs to test lead. Then test lead go
to server which is given by development lead. copy the build (BO1)
and install the software in test server and given URL to engineers
the test the software.
In order to finding the bugs and report to development team as
bug report tools like zira , ALM.
→testing team will testing the module in that time development team
develop another module and bug fix which are reported by
development team and again report to test lead.
→test lead again go to develop server copy the module of built install
in test server. Before install the test server. We may delete old module
so again retest first new module, bug fixes and last we will test old
module. Finding bugs report to development team this process is
called build process.
Why test engineer will find new bugs in the old modules ?
• Adding new module might introduce defect in old module.
• Fixing the defect might introduce mew defect in the old module
• Test engineer might have missed defects in the previous test
cycle.
When do we do system testing?
when minimum bunch of modules are ready.
When the testing environment is like production environment is
available.
When the basic functionalities are working fine.
What is release or first release or 1 release?
Starting from gathering the requirements followed by developing the
software and testing the software. for many cycles and deploying the
software into the production server is called release.
28
When to release the software to the customer?
❖ When all the features requested by the customer are ready
❖ When there are no blocker and critical bugs
❖ When the product is functionally stable
❖ Once after the software is tested in testing server like production
server
❖ When all the end-to-end scenarios are working fine
❖ When we are about to meet deadline or release date given by
customer
TEST CYCLE:
It is an effort or duration to start and complete the testing.
The test cycle duration can be 1 day or 2 days or 3 days its dependent
on size of the application, complexity of the application and size of
the testing team.
EX:
Project 1month=4units
Duration :1year 10months=40units
2months→write test cases test cycle=5days for 1 unit
10months→test execution
Re-spin:
Getting more than one build with in a test cycle is called re-spin.
Whenever tester find blocker bug developer will give re-spin.
Patch:
Set of modifying programs is called patch.
When there are blocker bugs developer will give patch.
Re-spin is referred as patch.
Build:
29
The process of source code file is converted into executed file knowns
as build.
CONTINUOUS INTEGRATION:
Continuous integration (CI) is the practice of automating the
integration of code changes from multiple contributor into a single
software project . it is a primary develop best practice, allowing
developer to frequently merge code change into a central repository
where builds and tests then run.
CONTINUOUS INTEGRATION TOOLS:
• Jenkins
• Circleel
• Team city
• Bamboo
• Gitlab
• Travis CI
• Buddy
• Codeshoe
Who is involved installation of build?
Any body from testing team.
Any body from development team.
Build engineer or release engineer.
Version control tool (source code management tools):
Version control is a way to keep a track of the change in the code so
that if something goes wrong. We can comparisons in different code
version are revert to any previous version that we want. it is very
much required where multiple developers are continuously working
on/change the source code.
Best version control tool:
Git
CVS (concurrent version system)
30
SVN (apache sub version )
Mercuria
Monotone
Bazaar
TFS(team foundation server)
ACCEPTANCE TESTING:
Approach:1
It is an end-to-end testing done by it engineer sitting in customer
place where in they take real time business scenarios and check
whether software is capable of handling it.
Approach:2 UAT(user acceptance testing)
It is an end-to-end testing done by the end users where in they use the
software for the business for a particular period of time and check
whether software is capable of handling real-time business scenarios.
Approach no.3:
It is an end-to-end testing done by test engineer sitting in the
customers place where in they check whether the software is capable
of handling real time business scenarios.
Approach no.4:
It is an end-to-end testing done by test engineer in their own place
where in they check whether the software is capable of handling real
time business scenarios.
Approach no.5:
It is an end to end testing done by customers customers . where in
they check whether the software is capable of handling real time
business scenarios.
The no. of acceptance test cycle might increase because of the
following reason: -
31
1. Test team is not proper testing.
2. Customer might ask more changes once after the software is
delivered to the customer.
3. The requirement which was given in the beginning is not clear it
is lead lot of reworks.
Hot Fix:
The production server while using the S/W, if customer find any
blocker and critical bug then customer will immediately
communicate defect to the company so the developer will
immediately fix the bug test the defect and patch will be given to
production server this process is called hot fix.
Root case analysis/Ishikawa method.
Once hotfix is completed as team we start to identify the root case
of the defect, document the root case, keep it in the common folder
where everybody can access and present the document to the entire
team.
This process is called root case analysis.
Since the solution is given in the form of fish bone. It is also called
as fish bone technique.
32
Alpha Testing Beta Testing
Alpha testing involves both the white Beta Testing typically uses Black Box
box and black box testing Testing
Alpha testing requires a lab Beta testing doesn't require any lab
environment or testing environment environment or testing environment.
The software is made available to the
public and is said to be real time
environment
Long execution cycle may be required Only a few weeks of execution are
for Alpha testing required for Beta testing
Alpha testing is to ensure the quality Beta testing also concentrates on the
of the product before moving to Beta quality of the product, but gathers users
testing input on the product and ensures that the
product is ready for real time users
33
Smoke Testing:
Smoke Testing/Sanity Testing
/Build Verification Testing/
Dry run testing/
Confidence Testing
• Testing the basic and critical features of an application before
going thorough testing is called as smoke testing.
• It is also called Build Verification Testing – because we check
whether the build is broken or not.
• How to do Smoke Testing?
• Here list the features to be tested as part of smoke testing and
list the features are not to be tested as part of smoke testing and
test. In smoke testing, we do only positive testing – i.e, we
enter only valid data and not invalid data.
Project:
• Gmail.
34
2. To check that when user click on signup, signup page should be
displayed
3. To check that when user enters valid data for all the fields in
the signup page and click on submit button account should be created
4.To check that user can login to application with valid login
credentials.
When we do smoke testing:
1.As soon as we get new build from development team we should do
smoke testing
2.Whenever the build comes to the customer, before the customer /
client does Acceptance Testing, they also does Smoke Testing.
3. Release engg/ build engg will do smoke testing to check whether
build is installed properly or not in testing server or production server
4. Developers will do smoke testing after doing WBT and before
giving build to testing team.
Why we do smoke testing?
1. To check whether software is testable or not.
2. First day itself while doing smoke testing if you find defect
communicate to developer so that developer will get sufficient time
to fix the defect.
3. We do smoke testing to ensure that product is installed properly.
4. Developer is giving new build means he will be doing code
changes, chances are there this might affect old basic and critical
features, so in order to find that we do smoke testing.
5. It is like a health check of the product so smoke testing should be
done.
Types of Smoke Testing:
35
Formal Smoke Testing – the development team sends the s/w to the
test lead. The test lead then instructs the testing team to do smoke
testing and send report after smoke testing. Once, the testing team is
done with smoke testing, they send the smoke testing report to the
Test lead.
Informal Smoke Testing – here, the test lead says the product is
ready and to start testing. He does not specify to do smoke testing.
But, still the testing team start testing the product by doing smoke
testing.
Smoke testing can be done both manually and also with the help of
automation tools. But the best and preferred way is to use automation
tools to save time.
Advantages:
Easy to perform.
Reduces the risk.
Defects are identified at a very early stage.
Saves efforts, time and money.
36
Runs quickly if automated.
ADHOC TESTING:
AD-HOC testing also called monkey testing /gorilla testing.
Testing the application randomly is called ad-hoc testing.
Why we do ad hoc testing?
1) End-users use the application randomly and they may see a defect,
but professional TE uses the application systematically so they may
not find the same defect. In order to avoid this scenario, TE should go
and then test the application randomly (i.e, behave like and end-user
and test).
2) Development team looks at the requirements and build the product.
Testing Team also look at the requirements and do the testing. By this
method, Testing Team may not catch many bugs. In order to avoid
this, we do random testing behaving like end-users.
3. In order to increase the bug count we should do adhoc testing
4. In Order to improve the test coverage we do adhoc testing.
5. In order to ensure the application is working according to implicit
requirement we do adhoc testing.
6.the intention of adhoc testing is to some ow break the product.
1.Login to Gmail, click on compose, enter values for all the fields,
click on send button, click on logout, click on browser back button
and check whether login page is displayed.
37
2.Login to Gmail with valid login credentials copy the home page
URL, click on logout, Open the browser and past the URL and check
whether login page is displayed.
39
Testing the old features to make sure that change like adding new
feature, deleting feature, modifying feature and fixing defects, are not
introduced defects in the old feature is called regression testing.
Type of regression testing:
1. Unit regression testing.
2. Regional / partial regression testing.
3. Full/complete regression testing.
Unit regression testing:
Testing only the modified functionalities of the application is called
unit regression testing.
Regional/partial regression testing:
Testing the changes along with the impacted modules of the
application is called regional (or) partial regression testing.
How do you identify impacted or how do you do impact analysis
or how do you pick regression test cases?
• Based on domain knowledge.
• By preparing impact analysis matrix.
• By conducting impact analysis meeting.
Testing team will do impact analysis meeting.
Test lead should communicate with development, team, testing, team,
B.A, customer and prepare consolidated impact list.
40
• When the changes made in the core features of an application.
• Before launching software to the customer the last few cycle we
do full regression testing.
Note: doing functional, integration and system testing on old feature
is called regression.
Progression testing:
Testing new modules of the application is called progression testing.
41
Testing the functionality of the application manually using tools is
called manual testing.
Automation testing (or) test automation:
Testing the functionality of application using tools is called
automation testing.
Drawback of manual testing:
• Manual testing requires more time or more resources,
sometimes both time and resources.
• Less accuracy.
• Performance testing is impractical in manual testing.
• Comparing large amount of data is impractical.
• Executing same tests again and again is time taking process as
well as tedious.
• For every release you most rerun the same set of tests which on
be tiresome.
Advantages of manual testing:
1) No environment limitation.
2) Programming knowledge is not required.
3) Recommendable for dynamically changing GUI design.
4) Manual testing allows for human observations which may be
useful to find potential defects.
Regression testing tools:
• Selenium ,UFT
• Test compete
• Ranorex studio
• Katalon studio
• V test
• Watir
• Actiwate
• Rational functional tester.
42
Advantages of test automation:
1. Fast
2. Reliable
3. Reusable
4. Repeatable
5. Programmable
Drawback of automation:
• It is expensive.
• Lack of expatriation
• Requires constant maintenance.
• We cannot automate all the areas (Either technology may not be
supported or it will be very costly).
When to go for automation:
1. When there are more numbers of test cases.
2. When the product is functionally stable.
3. When there are no blockers and critical defects.
4. Once after the software is manually tested for 1 or 2 releases ,
then we go for automation.
Test scenarios:
The scenarios are the high-level documentation for all the customer
business workflow according to the requirements is called test
scenarios.
Test case:
It is a detailed document which cover all possible scenarios for a
specific requirement.
43
What will happen if you look at the requirement and test the
application?
or
What are the drawback if you test the application by directly referring
the requirement?
Solution:
• There is no consistency in the text execution.
• Test engineer might miss lot of defects.
• Quality of testing varies from person to person
• Testing depends on memory power of the test engineer.
• Chances are there we might test same scenarios again and again.
• Test coverage will not be good.
When do we write test case?
▪ When customer gives new requirement we should write test
case.
▪ When customer wants to add new features or extra features we
should write test case.
▪ When customer wants to do modification on the existing feature
we should write test case.
▪ While testing the software if test engineer come up with creative
scenarios we should write test case.
▪ While testing the software if test engineer finds any defect and if
test case is not present for the defect then we should update test
case for the defect.
44
Test design techniques are the techniques which is applied while
writing test cases in order to improve the test case coverage.
Error guessing:
Here we guess all the passible errors for the given application based
on experience and intuition.
ECP (equivalent class partitioning)
1)pressman method:
Rule1:
If the given input if it is a range of value then derive the scenarios for
1 valid & 2 invalid values.
Rule2:
if the given input if it is a set of values then derive the scenarios for 1
valid & 2 invalid values.
Rule3:
If the given input if it is a Boolean then derive the scenarios for both
true & false value.
2)practice method:
If the given input if it is a range of values divide the range into
equivalent parts and test it for all the values but we should make sure
that we are testing for at least two invalid values.
Note:
When there is a deviation in the given range, we should prefer partice
method.
BVA (boundary value analysis):
If the given input if it’s a range of values between A and B the
derived the scenarios for A,A+1,A-1 & B,B+1,B-1.
Test case template:
45
• In every company test engineer will write test cases in the test
case template only.
• Test case template is not standard, it can varies from project to
project and company to company.
• Test case template will be prepared in the test case management
tool or MS-excel.
Test case review process:
Test case review process is an important process to follow in software
testing. Test case ensures that each and every functionality mentioned
in Software Requirement Specification is covered.
Test case should be effective and also follow the standards to write
test case. To success and completeness of any test cases every test
case should be reviewed. There are different types of test
case review process.
Test Case Reviews can be done in three ways:
1. Self-review: It is done by the tester himself who has written the test
cases. He can verify whether all the requirements are covered or not
by looking into SRS/FRD.
2. Peer review: It is done by another tester who hasn't written those
test cases but is familiar with the system under test. Also known as
Maker and Checker review.
3. Review by a supervisor: It is done by a team lead or manager who
is superior to the tester who has written the test cases and has great
knowledge about the requirements and system under test.
While reviewing, the reviewer checks the following,
1) Template - he checks whether the template is as per decided for
the project
2)Header:
a) Checks whether all the attributes are captured or not
b) Checks whether all the attributes in the header are filled or not
46
c)checks whether all the attributes in the header are relevant or not
3) Body:
a) Check whether all possible scenarios are covered or not
b) Check whether the flow of test case is good or not
c) Check whether the test case design techniques are applied or not
d) The test cases should be organized in such a way that it should less
time to execute
e) Check whether the test case is simple to understand and execute
f) Check whether proper navigation steps is written or not
points to remember / tips while reviewing test cases:
1. While reviewing test case ,it is better to have a copy of
SRS/FRD with you for the reference.
2. If you are not sure about any test case or expected results ,it is
better to discuss with the client or your supervisor before
making any decision.
3. If possible then try to execute test cases on the SUT(system
under test ) to have a better understanding of the results and
execution steps.
4. It is always better to have face to face meeting with the tester to
make him understand all the review feedback properly.
5. It is recommended to follow version numbers in review process.
procedure to write the test case:
SYSTEM STUDY
IDENTIFY SCENARIOUS
PRIORITIZE SCENARIOUS
WRITE TEST CASES
REVIEW TEST CASES
47
FIX THE REVIEW COMMENTS
VERIFY THE FIX
APPROVE TEXT LEAD
STORE THE TEST CASES IN THE TEST CASE REGORSITY
Brainstorming meeting
It is a meeting conducted by testing team, in this meeting they will
discuss about scenarios what they have identified, here each and every
test engg will explain the scenarios what they have identified, where
in other TE will try to understand the scenarios what he is explaining.
If the other test engg finds any defects in the scenarios like wrong,
missing, duplicate scenarios that will be given as a feedback to the
test engg.
The test engg will update the scenarios, This cycle will repeats on
every test engg.
This meeting will be measured by TL once after the meeting
With the help of this meeting we will have a good coverage
in the scenarios.
How do you ensure that your test coverage is good? Or how do
you convince your test manager or customer standing your test
coverage is good?
1. have written test case by applying test case design technique, so my
test coverage is good.
2. I have covered all positive and negative scenarios
3. I have conducted brainstorming meeting, so my lest coverage is
good
4. I have got my test cases reviewed by other test engg.
48
5. I have written test cases by following procedure to write test case
method 6. While test execution found creative scenarios and added
into test case
7. I will do adhoc testing and this will help me to improve test
coverage
8. I have spent more time in doing system study, because of that i got
very good project knowledge which helped me to write more no. of
scenarios
9. I have prepared traceability matrix and ensured each and every
requirement has at least one test case, so my test coverage is good
STLC
(software testing life cycle)
➢ STLC stands for software testing life cycle.
➢ It is standard procedure to test the software.
➢ It is a part of software development life cycle (SDLC).
➢ It has different stage.
SYSTEM STUDY
WRITE TEST PLAN
WRITE TEST CASE
TRACEBILITY MATRIX
TEST EXECUTION
DEFECT TRACKING
TEST EXECUTION REPORT
RETROSPECTIVE MEETING
System study:-
Here tester should try to understand requirement if they have any
queries they should talk to the one who known the requirement very
well and clarify the queries.
49
Test Plan:
50
3. Whenever the requirement changes we will get to know which are
the test cases and automation scripts needs to be change.
Types of Traceability Matrix
1. Forward traceability matrix: It maps requirements to test cases.
2. Backward traceability matrix: It Maps the test case to the
requirement
3. Bidirectional traceability matrix: This traceability matrix ensures
that all requirements are covered by test cases.
Traceability Matrix Template:
It has got following fields.
SL No.
Module Name
High Level Requirement
Detailed Requirement
Test case name
Test Script name
Execution type
Achievements:
• Test case were reviewed by the peers and got many inputs
because of this my test coverage is good.
• We did brainstorming meeting which helped us to improve
scenarios Coverage
• We did impact analysis meeting which helped to identify
impacted areas.
• we swapped modules between the test engineer and did testing
which helped us to find more no. of defects.
51
Test execution:
Test execution is the process of execution the test case and comparing
the expected and actual results.
Defect tracking:
In this section we mention how to communicate. The defects found
during testing to the development team should respond to it.
Test execution report:
Test execution report is prepared after every test cycle and sent to
development team, testing team, management and customer (depends
if it is a fixed big project is over – according to the customer.
Retrospect meeting(also called Post Mortem Meeting/Project
Closure Meeting)
The Test Manager calls everyone in the testing team for a meeting
and asks them for a list of mistakes and achievements in the project
This is done by test lead or test manager. Here, the manager
documents this retrospect meeting and stores it in QMS (Quality
Management System). It is a folder, where inside this folder, there is
another folder called Retrospect folder and here this excel sheet
document is stored. When we get new project, while we write the test
plan- we will open this retrospect file and will try and implement the
good and correct the mistakes
Mistakes
• Dev team didn't fix the blocker defects on time which delayed
our testing
• Requirements were not clear
• TC Review did not happen properly.
52
Defect life cycle
What is a defect?
It is a mismatch in the expected and actual behavior of an application.
Or
It is a deviation from the customers requirement specification.
Example:
1. Unable to create account even after entering valid data to all the
required fields.
2. Added products are not displayed in the cart.
Defect occurs in the application because of the following reasons.
53
Failure: If customers or end-users find a mismatch in the actual and
expected behaviour of an application in the production phase then
they call it a Failure.
Defect Report(Template)
While reporting the bug to developer, your Bug Report should contain
the following information
Defect_ID - Unique identification number for the defect.
(It will be automatically created by the BUG Tracking tool once you
save this bug)
Release Name: Here we should specify the name of the release
Build Id: Version of the application in which defect was found.
Module Name: Specific module of the product where the
defect was detected.
Status: New/Assigned/open/fixed/reopen/closed (Depends on the Tool
you are using)
Severity: Blocker/Showstopper
• Critical
• Major
• Minor
Priority: Urgent
• High
• Medium
• low
Test Environment: Here we should specify test environment details
like the operating system, Browser used etc...
Test data: The data used to find the bug.
Brief Description: Here we should specify the summary of the
defect
54
Detailed Description: Here we should specify the steps to reproduce
the defect
Expected Result:
Actual Result:
Attachment:
Author Name:
Created date:
55
Pending Retest: After fixing the defect, the developer assigns the
defect to the tester for retesting the defect at their end, and till the
tester works on retesting the defect, the state of the defect remains in
'Pending Retest'.
Retest: At this point, the tester starts the task of working on the
retesting of the defect to verify if the defect is fixed accurately by the
developer as per the requirements or not.
Reopen: If the bug persists even after the developer has fixed the bug,
the tester changes the status to "reopened". Once again the bug goes
through the life cycle.
Verified: The tester re-tests the bug after it got fixed by the
developer. If there is no bug detected in the software, then the bug is
fixed and the status assigned is "verified."
Closed: If the bug is no longer exists then tester assigns the
status "Closed."
Duplicate:
If the developer finds the defect as same as any other defect or if the
concept of the defect matches any other defect then the status of the
defect is changed to 'Duplicate' by the developer.
Reason for duplicate:
• Common features
• Dependent features
How to avoid duplicate bugs?
As soon as bug found search in bug repository, if the bug is exist
don't report the bug.
Rejected:
Now, when the TE sends a defect report - the Development Lead will
look at it and reject the bug.
Bug is rejected because,
56
1. Misunderstanding of requirements
2. Referring to old requirements
3. Because of extra features
4. Improper installation of the Product
Test engineer Approach:
Whenever the developer says invalid, first we reconfirm by going
through the requirement once again and update the status accordingly.
i.e.
➢ Close: If really the bug is invalid
➢ Reopen: If the bug is valid
Deferred or Postponed
If the developer feels that the defect is not of very important priority
and it can get fixed in the next releases he can change the status of the
defect as 'Deferred'.
Why do you get postponed status?
• If We find a bug during the end of the release (could be major or
minor but cannot be critical) - developers won't have time to fix
the bug - such a bug will be postponed and fixed in the next
release and the bug status will be "postponed"
• If the tester finds a bug in a feature where in developers are
expecting changes from customers side those defects will get the
status postponed.
• If the bug is minor and it is in feature exposed to internal users.
Cannot be fixed:
Chances are there -test engineer finds a bug and sends it ti
development lead -development lead looks at the bug and sends it
back saying “cannot be fixed”.
Technology itself is not supporting i.e, programming language .
we are using it self is not having capability to solve the problem.
57
Whenever there is a bug in the root of the product if it’s a minor
bug, then development lead says “cannot be fixed “. But ,if it’s a
critical bug , then development lead cannot reject the bug.
If the cost of fixing the bug is more than the cost of the bug
itself – cost of the bug mean loss incurred because of the bug.
Test engineer approach:
If the status is given as cannot be fixed then test engineer checks
whether if it is blocker and critical bug, if it’s a blocker or critical bug
then the test engineer will change the status of the bug to reopen if it
is a minor bug test engineer will give the status as closed.
How to avoid cannot be fixed status as a test engineer.
As a test engineer we can’t avoid this status of the bug as we nothing
to do with the technology or if any problem in the core of the code.
Not reproducible:
Test engineer are able to see the defect bot the same defect is not able
to see by the dev team. Then development lead will change the staud
of the bug as not reproducible.
Why we get “not reproducible “ defects?
• Because of platform mismatch.
• Because of improper defect report.
• Because of data mismatch.
• Because of build mismatch.
• Because of inconsistent defects.
A defect that is not occurring repeatedly in every execution and is
producing only at same instances and whose steps as proof have to be
captured with the help of screenshot, then such a defect is called as a
“inconsistent” defect.
Request for enhancement(RFE):
Test engineer finds a bug and sends it to development team – when
development team look at report sent by the engineer – they known
58
it’s a bug, but they say its not a bug because its not part of the
requirement.
Example for RFE
To add clear button in create customer page.
To add select all checkbox in approve loans page of banking
app.
To provide future scheduling option in appointment module of
health care application.
To provide scheduling message in whatsapp.
To provide auto back up functionality in whatsapp.
To provide option to sync whatsapp contacts with google
contacts.
compatibility testing:
testing the functionality of an application in different software and
hardware environment is called compatibility testing.
Why we do compatibility testing:
1. To check whether software work consistently in all the
platforms.
2. Usually developing team and testing team use the same platfrom
while developing the software , but once after the applicaton is
released in the production server the customer may find bugs in
the application and hence we do compatibility testing.
Type of software compatibility testing:
• Browser compatibility test.
• Hardware compatibility testing.
• Network compatibility testing.
• Mobile devices compatibility testing.
• Operating system compatibility testing.
Hardware:-
59
It is to test the application /software compatibility with the different
hardware configuration.
Test on different processers.
Test different ram.
Test on different motherboard.
Test on different VGA card.
➔version history of android OS.
➔version history of IOS.
➔version history of windows OS.
Network:
it is to check the application in a different network like 3G, 4G, 5G
wifi, etc.
Mobile devices
It is to check if the application is compatible with mobile devices and
their platform like android, ios, windows, etc
Software (operating system):
It is to check if the application is compatible with different operating
system like window, linux, MAC, etc
when do we perform compatibility testing?
When the application is relatively stable on the base platform me
perform compatibility testing
How to do compatibility testing?
Will execute manual test cases as automation scripts fer platforms and
do compatibility testing.
Compatibility testing:
• Scattered content
• Alignment issues
• Broken frames.
60
• Change in look and feel of the application
• Object overlapping.
• Change in font size, style, colour.
PERFORMANCE TESTING:
Verifying the stability & response time of an application by applying
load is called as performance testing.
1. Stability: ability of an application to respond to the users
(efficiency)
2. Response time: over all time taken by the application to respond to
the user.
3. Load: number of users using the application at a time.
61
2. If the application has crashed
3. Is it displaying error message accordingly, if any of these
conditions are missing then raise it as a defect.
3.volume testing:
Verifying the stability & response time of an application by
transferring huge volume of data from once place to another place is
called as volume testing.
Soak testing:
Testing the stability and response time of an application by applying
lead for a continuous period of time is known as soak testing.
Recovery testing:
Verifying how fast the application recovers back from a crash,
disaster, failure without any data loss to the original position is called
as recovery testing.
Ex: application→ chrome
10mb download
5mb
62
• The test engineer will end the process which has caused the
defect and verify if the application is recovering back to the
pervious setting without ant data loss.
Normal settings
Restoring the
Disaster/crash
Previous data
occurrence
Recovery
Testing
cycle
Reliability testing:
Testing the functionality of an application for a continuous period of
time is known as reliability testing.
Reliable:-
House office
8:00am 9:00am
Why we do reliability testing:
• To check whether the application is failing at any point
• To identify why is it failing.
• How many times is it failing.
63
How to do reliability testing:
We use automation tools where the testers write the specific scripts
for the tool to check the application if it is failing at any point of time.
Same of the tools are:
1. Weibull++ - reliability data analysis
2. RGA - reliability growth analysis
3. RCM – reliability cantered maintenance.
When to do reliability testing:
When the application is stable we perform reliability testing.
Some of the real time examples are:
Social media application : facebook ,Instagram ,whatsapp etc.
Gaming application : PUBG,temple run etc:
Media entertainment : hotstar ,reflex etc.
Education domain : BYJU’s
Note: it is not a mandatory testing and is done based on the customer
domain and the type of application.
Priority and severity:
severity is a impact of a defect on the customer business the different
severity levels are.
Blocker:-
This defect indicates complete shot down of the process , nothing can
proceed further.
Critical:
It is a highly severe defect and collapse the system. However ,certain
parts of the system.
64
Major:
It causes some considerable behaviour, but the system is still
functional .
Minor:
it wont cause any major break down of the system.
Priority:
It is defined as the order in which a defect should be fixed higher the
priority the sooner the defect should be resolved.
The different priority levels are.
High: the defect must be resolved as soon possible as it affects
system severely and cannot be used until it is fixed.
Medium :
during the normal course of the development activities defect should
be resolved it can wait until new version is created.
Low:
The defect is an irritant bot repair can be done once .the serious defect
has fixed.
High severity and high priority
1.place order functionality is not working in online shopping
application
2. Unable to select current location and destination location
is ola application
3.join meeting option is not working in skype application
4.send request option is disable in facebook application
5.send message feature is not working in whatsapp
65
6. The user performs adding an item to the cart, the number of
quantities added is incorrect / wrong product gets added
Low severity & low priority
1.spelling mistake in the confirmation message
2.alignment issues in the achieved project page
3.confirmation message is not displayed after logout from gmail
application
4.relatively more time is taken to terminate session in the go to
meeting application
5.color of the text or tab is too dark
6.font size is small
High severity and low priority
1.blank page is displayed on click help link
2.external link provided in the application is not working
3.unable to install whatsapp application for 30th time
4.application crash on multiple click on delete mail button in trash
module of the gmail.
Low severity & high priority
1.spelling mistakes in the name or logo
Test plan:
Test Plan is a document which derives all future testing activities of
the project.
It has following sections:
1. Objective
2. Scope
3. Approach
4. Testing methodologies
66
5. Assumption
6. Risks
7. Backup plan
8. Schedule
9. Roles and responsibilities
10. Defect tracking
11. Test environmental
12. Entry and exit criteria
13. Test automation
14. Deliverables or test artifacts
15. Templates
16. Effort estimation
Objective:
It gives the aim of preparing test plan i.e why are we preparing this
test plan.
Scope:
In the planning stage, we decide which feature to test and which not
to test due to the limited time available for the project.
2.1 features to be tested
2.2 features not to be tested
Features not to be tested
a) "HELP" is a feature developed and written by a technical writer
and reviewed by another technical writer. So, we'll not test this
feature.
b) Third party modules of the application.
c)The application might be having link to some other application.
Here, our scope of testing is limited to,
Whether link exists
If it goes to homepage of the corresponding application when we
click on the link.
67
3)TESTING METHODOLOGIES
Depending upon the application, we decide what type of testing we do
for the various features of the application.
4)APPROACH
The way we go about testing the product in future,
a) By writing high level scenarios
b) By writing flow graphs
5)Assumptions:
When writing test plans, certain assumptions would be made like
technology, resources etc.
6) RISKS
If the assumptions fail, risks are involved
7) CONTINGENCY PLAN OR MITIGATION PLAN OR
BACK-UP PLAN
To overcome the risks, a contingency plan has to be made. At least to
reduce the percentage from 100% to 20%
Always assumptions, risks, mitigation plan are specific to the project.
The different types of risks involved are,
• Resource point of view
• Technical point of view
• Customer point of view
8) SCHEDULES:-
This section contains - when exactly each activity
should start and end?
9) ROLES AND RESPONSIBILITIES
9.1 Test Manager
Ø.Writes or reviews test plan
68
Ø.Test manager will interact with customer, management,
development team and testing team
Ø.Sign off release note
Ø.Handle issues and escalations
Ø.Test Manager will be involved in the effort estimati
Ø.Approve test case (not always)
Test Engineer 1
Ø.Involved in system study.
Ø.Involved in identifying scenarios.
Ø.Conducting brainstorming meeting and updating scenarios
Ø.Converting test scenarios into test cases
Ø.Involved in reviewing test case
Ø.Giving review comments and fixing the review comments
Ø.Involved in execution the test case
Ø.Involved in identifying the defects and communicate defects to dev
team using defect tracking tool.
Ø.Involved in tracking the defects
Ø.Involved in selecting test case for regression testing
Ø.Involved in updating test case, whenever req are getting changed
ØInvolved in conducting bug triage meeting
Ø.Involved in performing traceability matrix
Test Engineer: (Automation Engg.)
Ø.Set up and install the product
Ø.Identify test cases to be automated
Ø.Automate identified test cases using Automation tool like
Selenium, UFT, etc...
69
Ø.Execute and maintain automation scripts
10) DEFECT TRACKING
In this section, we mention - how to communicate the defects found
during testing to the development team and also how development
team should respond to it.
This section contains
10.1 Procedure to track the defects
10.2 Severity Level
10.3 Priority Level
10.4 Defect tracking tool to be used
11. Test Environment
In this section we mention what are the hardware and software needs
to be used on order to set up test environment
11.1 Hardware:
Server Side: Server:- Sun Starcat 1500
Client: Processor: Intel 2GHz
RAM: 8GB
Hard disk: ITB
11.2 Software:
11.2.1 Server
OS: Linux
Web Server: TomCat
Application Server: Websphere
Database Server : Oracle (or) MS-SQL Server
11.2.2 Client
OS: W7, W8, W10
70
Browser: Chrome, Firefox
11.3 Procedure to install the software
12) Entry and Exit Criteria
72
4) Platforms in which the product is not tested
5)List of bugs fixed in current release which were found in previous
release production
6) Procedure to install the software
7) Version of the software
15 TEMPLATES
This section contains all the templates for the documents which will
be used in the project.
The various documents which will be covered in the Template section
are,
Test Case
Traceability Matrix
Test Execution Report
Defect Report
Test Case Review Template
16.Effort Estimation
Effort estimation is the process of predicting the most realistic amount
of effort (expressed in terms of person-hours or money) required to
develop, testing and maintain software.
To find total engineers required for the project
Total Engg=Total working days/Estimated days
Effort Variance=(Estimated Effort - Actual Effort/
Estimated Effort)*100
73
Globalisation testing:
Developing the software to support multiple language is called
globalization.
Testing the software which is developed to supports multiple
languages is called globalisation testing. There are two types of
testing.
1.internationalistion testing ( I 18 N testing)
2.localistion testing ( L 10 N testing)
Internationalization testing
Here we check whether the content is displayed in right language or
not.
Here we also check the content is displayed in right position or not.
We add prefix to the property file in order to check the content is
displayed in right language.
He add suffix to the property file in order to check the content is
displayed in right position or not.
Adding prefix &suffix to the property file is called pseudo
code translation
Localization testing
Here we check whether the content is changing locally according to
country standards or not
ex: currency format, date format, time format, phone number
format, pin code format
White box testing
Testing each and every line of the program is called white box testing.
It is done by developers before giving the software to the testing team.
In order to reduce the bugs in the software.
74
Types of wbt
1. Path testing
2. Condition testing
3. Loop testing
CONDITION TESTING
Here developers will test all the condition given in the source code for
both true and false conditions
If (condition)
{
True
}
Else
{
False
}
LOOP TESTING
Here developer should test the loops for all the iteration. It can be
done manually or automatically (unit test scripts)
WHILE (I<-5000) TEST SCRIPT
{ {
----------------------- -------------------------
----------------------- -------------------------
} }
75
Unit test scripts are written for checking loops and other programs
automatically.
unit test scripts can be written for doing path, conditional, loop testing
PATH TESTING
Here developers should test each and every independent path of the
application, test all the independent paths whenever the changes made
in the source code, we should check for all the dependent paths.
NOTE
• Wbt testing can be done automatically or manually with the hel
test programs (unit test scripts)
• a set of unit test scripts are known as unit test suit/ unit test
case/ unit test list.
Agile model
What is Agile?
It is a standard procedure or step by step procedure to develop the
new software.
Its an Iterative and incremental Approach.
PRINCIPLE OF AGILE METHODOLOGY
77
EPIC: It is a larger requirement. Epics need to be broken into smaller
deliverables (stories). Or we can also defined as complete set of
requirement is called EPIC
One EPIC consist of multiple stories
User Stories/Stories/Story Cards:
A requirement that the business wants. It is something that is
deliverable within a single sprint(Smaller pieces of requirement). It
can be a feature or modules or functionalities.
Story Point:
It is rough estimation given developer and test engineer to develop
and test individual stories
Ex: 1 story point-9 hours
1 SP-6
1 SP-8
Story point should be in Fibonacci series
QA Story points estimated based on the following aspects:
➢ Time spent on understanding story
➢ Write test scenarios
➢ Write test cases
➢ Review test cases
➢ Test case execution
➢ Defect tracking
Developer Story points estimated based on the following aspects:
➢ Understanding requirements
➢ Design
➢ Coding
➢ Reviewing code
➢ WBT
➢ Time spent on fixing the defects
78
Sprint:
Sprint is the actual time spent by developers and test engineer to
develop and test one or more stories.
Sprint planning:
Sprint planning is an event in scrum that defines what can be
delivered in the upcoming sprint and how that work will be achieved.
Sprint planning is a meeting conducted by scrum master on the first
day every sprint
Explain the requirement
Identify list of task to be done
Assign task to engineer
Scrum Meeting:
It is a meeting conducted by a scrum master on the daily basis.
1. It is also called as daily stand up meeting
2. This meeting is strictly bounded for 15 minutes
3. In this meeting we discuss below mentioned points
1. What you did yesterday
2. What have you planned today
3. Are there any obstacles or impediments
Note: During a sprint, the team checks in during the dally scrum, ,
about how the work is progressing. The goal of this meeting it to
surface any blockers and challenges that would impact The teams
ability to deliver the sprint goal.
sprint review meeting
After a sprint, the team demonstrates what they've completed during
the sprint review. This is your team's opportunity to showcase their
work to stakeholders and teammates before it hits production.
79
Sprint retrospective meeting:
It is a meeting conducted by scrum master on the last day of every
sprint.
In this meeting we discuss the following points
1. What went well
2. What didn’t go well
3. Are there any actions plan
Release retrospective meeting:
it is the meeting conducted by scrum master on the last day of every
release.
➢ In this meeting test engineer list all the open and pending bugs
which are not fixed by the developers in the current and
previous release as a team we will re prioritize the defect from
the customers' business point of view and decide how many
bugs should be fixed as part of a current release and how many
bugs can be move to upcoming release.
80
➢ In this meeting test engineer and developer come up with list all
the pending stories which are not implemented as part of the
current and previous release.
➢ As a team we will re prioritize all the stories from the business
point of view and move the stories to the next upcoming sprint
or releases.
Resume points:
➢ Excellent knowledge about on agile scrum development process
➢ Very good knowledge on sprint planning meeting
➢ Very good knowledge on scrum meeting
➢ Very good knowledge on sprint retrospective meeting
Explain agile process which you are following
• In our scrum team we have scrum master (SM), Product owner
(PO), developers and testers. .
• PO will create the epics and stories and they will be kept in
backlogs.
• Twice in a week we will have the grooming call and in the call,
PO will explain the requirement and based on that we will
estimate the story points.
• Before we start the sprint we will have the sprint planning
meeting and during this meeting we will pick the stories which
we are going to work in the upcoming sprint.
• From the starting of the sprint developers will start coding for
the features and we (testers) will create the test cases and the test
data for the feature.
• Once the development work is completed, developers will
deploy the code to Test environment and then we will execute
the test cases.
• If any test case is failed then we will raise bug and assign to
developers.
• During the sprint, we will have daily stand up call / scrum call in
which we will discuss,
81
1.What did I do yesterday? o What I'm
2. going to do today?
3.Bugs/Blockers and Impediments
• We are following 2 weeks sprints in which 1st 7 days are for
development and functional testing and day 8, 9 and 10 are for
regression testing.
• Once after the sprint ends we will have sprint retrospective
meeting in which we will discuss,
What went well?
What went wrong?
What could have done better?
Type here to search
Different between agile and waterfall model:
s.no WaterFall Agile
1 The waterfall methodology is Agile methodology is incremental and
sequential and linear. iterative.
2 Requirements have to be frozen at Requirements are expected to change
the beginning of SDLC. and changes are incorporated at any
point.
3 The working model of software is The working model is delivered during
delivered at the later phases of the initial phases and successive
SDLC. iteration of the model is delivered to
the client for feedback.
4 It is difficult to scale-up projects Scaling up of products is easy because
based on waterfall methodology. of the iterative approach.
5 Customers or end-user doesn't Frequent customer interaction and
have a say after the requirements feedbacks are involved in agile
are frozen during the initial methodology.
phases. They only get to know the
product once it is built
completely.
6 Testing is performed once the Continuous testing is performed
software is built. during each iteration.
82
S.No Test Scenario Test Case
1 It is high level documentation It is detailed documentation.
2 It tells what to test It tells how to test
3 It is derived from the It is derived from test scenarios.
requirement.
4 It required less to write. It required more time to write.
5 Required less resource to write Required more resource to
and execute camper with test write and execute.
cases.
6 The test scenario does not have The test case has exacted that
data that you need to enter to you need to enter to test an
test application. application.
83
S.No Severity priority
1 Impact of the bug on The order in which the developer
customer business work should resolve defect.
flow.
2 It is categorized as It is categorized as
• Critical • high
• major • low
• minor • medium
3 Severity indicates the Priority indicates how soon the
seriousness defect on bug should be fixed.
product functionally.
4 It is associated with It is associated with scheduling.
functionally.
5 Severity status is based on Priority status is based on
technical aspects of the customer requirement.
product.
84
S.no Quality Assurance Quality Control
1 Set of activities for Set of activities for ensuring the
ensuring the quality in the quality in the product.
process.
2 Ex: Verification. Ex: Validation.
3 It is process oriented. It is product oriented.
4 It is the proactive quality It is the reactive quality process
process (Planning). (Executing).
5 Aim of QA is prevention of Aim of QC is detection of
defects. defects.
6 Everyone's responsibility. Testing team responsibility.
85
→What is test ware?
Collecting of all the martials that is required to test the application is
known as test ware.
Ex: test case, test script and test scenarios.
→What is compliance testing/ regulation testing?
Test the software and check whether software meets government’s
rules, policy and regulation is called compliance testing.
→What is pilot testing?
it is a type of testing done by set of users where they will do a trail run
of the project, to check performance and the end users will be give
feedback to the company before the software is deployed into
production is called pilot testing.
→What is testbed?
Testbed is the environment which is required to test the application.
The environment consists of hardware and software to run the
application.
→What is test data?
The data which is needed to test application with different inputs and
helps to check whether the corresponding output is as per the
expected results or not.
86
Ex: If test engineer finds any bug on 26th and bug is fixed on 30th. So,
this time duration between finding and fixing of bug is known as
defect age.
→What is Fuzz testing?
Fuzz testing is nothing but finding loop holes and code errors of the
application by applying random invalid data to check the software
performance and the application is crashing any point of view.
→What is bucket testing or A/B testing or split test?
Bucket testing is nothing but testing two different versions of same
software and check whether which version is using by more users or
which is more popular is known as bucket testing.
87
Selenium Notes
Type of Application:
➔ We have 4 type of application
1. Stand alone application
2. Mobile application
3. Distribute application
4. Web application
Stand alone application:
→The application which does not required internet connection is
called Stand alone application.
Ex: Ms-Excel, Notepad.
Mobile application:
→The application which we are using in mobile is called mobile
application.
→To develop mobile application, we need J2ME+flutter technology.
Distributed application:
→One application is distributing it is properties to sub application is
called distribute application.
Ex: Google→Gpay, Gmap,Gphotos,Gdrive.
Web Applications:
→The application which required internet is called web application.
1. Front end
2. Back end
Front end:
→To develop front end we are using web technology.
(HTML,CSS,JavaScript)
88
Back end:
→To develop back end we need to use J2EE+Data Base.
Note:
→To connect J2EE+Data Base we need JDBS.
→To connect front end with back end we need to use servlets.
→As an automation test engineer we are going to automate web
application front end.
Automation Testing
89
What are the automation tools we have?
→We have two types of automation tools.
1. QTP→ Quick test process(not open source)
2. Selenium→open source.
What are the 3rd party tools we have?
• Auto IT.
• Sikuli.
Note:
→Automation testing takes place, from the 2nd build.
→Automation testing has to be done in stable application, we cannot
perform automation testing is unstable application.
Selenium
Note:
→Selenium is a community, where all the automation testing tools are
present .
90
→Father of selenium is Jason huggins .
Selenium RC:
→Selenium RC stands for remote control.
→It is developed in the year 2004 by Thought works.
→It is a Script based tool.
→The drawback of the tool is it can not automate stand alone
application as well as secured application (HTTP).
Selenium IDE:
→Selenium IDE is a user interface-based tool develop in the year
2006 by thought works.
→The drawback of the tool was it was unable to automate AJAX
application (Asynchronized java Script XML application).
Selenium web drive:
→It is the most popular selenium tool developed in the year 2009 by
Google.
→It is a script-based tool.
→The drawback of the application is it cannot automate stand alone
application directly.
→To automate Stand alone application it needs 3rd party tools
support.
Selenium grid:
→It is the script based tool develop in the year 2009 by Thought
works and Google.
→Generally, grid used to perform compatibility testing.
91
Winning:
→It is also a script-based tool developed by Google in the year of
2012.
→It can automate stand along application directly because of it is
complexity it is not that much successful.
APPIUM:
→APPIUM is the developed in the year 2014 by the source labs.
→this tool generally used for mobile testing.
Client Library:
→Inside client library we are going to write test scripts with help of
inbuilt classes and interfaces.
→Inside client library one protocol is present named as Jason WIRE
PROTOCAL.
92
→The functional of this protocol is convert java to Jason and Janson
to java.
Browser server:
→Browser server is nothing but collection of all the drivers.
→The functionality of this drivers are access actual browser and carry
the request to actual browser.
→After performing operation in actual browser drives will carry back
the response to the client.
Actual Browser:
→Actual Browser is nothing but stand alone application present in
system where we can perform our script execution.
Configuration of Selenium:
→To configure selenium we need 4 things .
1. JDK 1.8v
2. Selenium web driver JAR FILE.
3. Browser server.
4. Actual Browser.
Scenarios-1:
→Lunch chrome browser and access FilpKart.
→To Lunch browser we need use one method called as setProperty.
→It is the static method present in the system class and it is
arguments of this method we need to pass key and value.
Syntax:
System.setProperty(key,value);
Ex: System.setProperty("webdriver.chrome.driver","D:\\Selenium
Folder\\chromedriver.exe");
93
Example program:
import org.openqa.selenium.chrome.ChromeDriver;
}
}
94
Browser Control Method:
1. getTitle():-
→with the help of this method we can fetch the page.
Syntax:driver.GetTitle():
2. getCurrentUrl():-
→with the help of this method we can fetch the url of a web page.
3. getPageSource():-
→To fetch the frontend source code of a webpage we have to use this
method.
4. close():-
→with the help of this method we can close the parent window.
Syntax: driver.close():
5. Maximize():-
→with the help of this method we can maximize the window.
Syntax: driver.manager().window().maximize():
6. Minimize():-
→with the help of this method we can minimize the window.
Syntax: driver.manager().window().minimize():
7. setSize():-
→with the help of this method we can set customise size of window
Syntax: driver.manager().window().setSize():
8. setPostion():-
→with the help this method we can relocate the window
Syntax: driver.manager().window().setPostion():
95
9. sendKeys():-
→with the help of this method we can send text value in a text box
present in the web page.
Syntax: sendKeys(“value”):
10. Click():-
→with the help of this method we can perform click operation in web
page
Syntax: element.click();
11. Submit():-
→with the help of this method we can perform searching operation in
web page.
Syntax: element.submit();
12. getText():-
→with the help of this method we can fetch any text value from the
web page.
Syntax: String pName=element.getText();
13. quit():-
→with the help of this method we can close both parent and child
window.
Syntax: driver.quit();
14. getAttribute():-
→with the help of this method we can fetch the attribute value of a
particular attribute.
Syntax: element.getAttribute(“title”);
15. getSize():-
→with the help of this method we can fetch the particular size of a
particular web element.
96
Syntax: element.getSize();
16. getLocation():-
→This method will give us the particular location of a web element .
Syntax: element.getLocation():
17. isDispalyed():-
→with the help of this method we can check the element visible or
not.
Syntax: element.isDispalyed():
18. isEnabled():-
→with the help of this method we can check the web element is
enabled or disabled.
Syntax: element.isEnabled():
19. isSelected():-
→with the help of this method we can check the web element is
selected or not.
Syntax: element.isSelected():
20. getTagName():-
→with the help of this method we can check the particular TagName
of a particular web element.
Syntax: element.getTagName();
21. close():
→with the help of close method we can close only parent window.
22. Quit();
→with the help of quit() we can close parent window as well as chil
windows.
97
Scenario:
➔ launch google chrome access flipkart.
➔ Fetch the title of the current window.
➔ Fetch the url of current window.
➔ Fetch the source code of the current window.
Program:
package selenium_program;
import org.openqa.selenium.chrome.ChromeDriver;
}
}
Scenario:
➔ Access acttime.com
➔ Maxmize the window
➔ Minimize the window
➔ Maxmize the window
import org.openqa.selenium.chrome.ChromeDriver;
98
Thread.sleep(4000);
dri.manage().window().minimize();
Thread.sleep(3000);
dri.manage().window().maximize();
Thread.sleep(4000);
}
}
dri.manage().window().setPosition(new Point(600,100));
Thread.sleep(4000);
}
Navigation:
→Navigation is the helper method by which we can perform 4
operations.
1) To(String URL):
99
With the help of this method we can access to a web page.
Syntax ;driver.navigate().to():
2) Back();
With the help of this method we can go back to the previous web
page.
Syntax: driver.navigate().Back():
3) Forward():
To go to the next web page we can use this method.
Syntax: driver.navigate().Forward():
4) Refresh():
To perform refresh operation of current webpage use this method.
Syntax: driver.navigate().refresh():
Scenario:
➔ Access flipkart
➔ Access acttime
➔ Go back to flipkart
➔ Came back to acttime
➔ Refresh
Program:
import org.openqa.selenium.WebDriver.Navigation;
import org.openqa.selenium.chrome.ChromeDriver;
100
nav.forward();
Thread.sleep( 4000);
nav.refresh();
// dri.navigate().back();
}
Scenario:
➔ Access Myntra.com
➔ Access facebook.com
➔ Go back to myntra
➔ Maximize myntra
➔ Again came back to facebook
➔ Print the current webpage title
➔ Minimize the we page
➔ Again maximize
➔ Close the window
Program:
import org.openqa.selenium.WebDriver.Navigation;
import org.openqa.selenium.chrome.ChromeDriver;
nav.back();
Thread.sleep(2000);
dri.manage().window().maximize();
Thread.sleep(2000);
nav.forward();
Thread.sleep(2000);
String title=dri.getTitle();
101
System.out.println(title);
dri.manage().window().minimize();
Thread.sleep(2000);
dri.manage().window().maximize();
Thread.sleep(2000);
dri.close();
HTML
➔ Hyper text makeup language.
➔ It is not a case sensitive language.
➔ Tagname, attribute name, visible text
➔ All WebElement will bw stored in the form of attribute or
visible text.
Rules:
➔ HTML page start with <html>tag
➔ We need to provide <head>
➔ We need to provide <body>
Note: once we close head then only body will start.
Ex:
<html>
<head> </head>
<body>
</body>
</html>
Attribute:-
the information which is present inside the tag is called attribute.
102
Ex:
Visible Text: -
The test value which is present in between same open and closed tag
is called visible text.
EX:
<input type=’text’>login</input>
<tag att=’attvalue’>vibleTX<closetag>
103
HTML Program:
<html>
<head><center><b>
<title>login</title>
</head>
<body>
<h1>Login to Qspider</h1>
<lable>username</lable>
<input type ='text'></input><br></br>
<lable>password</lable>
<input type='password'></input><br></br>
<input type='radio' name='a'></input>
104
<lable>male</lable><br></br>
<input type='radio' name='a'></input>
<lable>female</lable><br></br>
<input type='radio' name='a'></input>
<lable>others</lable><br></br>
<lable>state</lable>
<select>
<option>up</option>
<option>ap</option>
<option>tn</option>
<option>ts</option>
<option>md</option>
<option>od</option>
<option>kn</option>
</select>
<br></br>
<input type ='checkbox'></input>
<lable>accept all the term and condition </lable>
<br></br>
<input type ='button' value='submit'></input>
</body>
</center>
</html>
Note: To create a dropdown we need a tag named select inside this tag
we need to use one more called as option tag.
105
Web Element: -
The element which are present in web page are called web element.
Locators: -
Locators are nothing but static method present in By class.
We have 8 types of locators.
Id()
Name()
Classname()
Linked text()
Partial linked list()
Css selector()
Xpath()
Tagname()
Locator are nothing but used to locate the web element present in the
web page.
1) Id(): -
Searching in the webpage: -
[id=’attributeValue’]
Example: -
[id=”username”]
Syntax:
driver.findElement(By.id("username")).sendKeys("admin
");
106
Note:
Id() will work only with id attribute.
2) Name(): -
Searching in the webpage: -
[name=’nameAttributeValue’]
Example: -
[name=’pwd’]
Syntax:
driver.findElement(By.name("pwd")).sendKeys("manager");
Note: -
Name() will work only with name attribute.
3) ClassName(): -
Searching in the webpage: -
[class=’classAttributeValue]
Example:
[class=’initial’]
Syntax:
driver.findElement(By.className("initial")).click();
Scenario: -
➔ Access actitime
➔ Do the login operation with Id(),Name(),ClassName() locator
➔ After login close the window
107
Note: in b/w every operator provide 4sec time interval.
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
System.setProperty("webdriver.chrome.driver","D:\\Seleniu
m Folder\\chromedriver.exe");
ChromeDriver driver =new ChromeDriver();
driver.get("https://demo.actitime.com/login.do");
driver.manage().window().maximize();
driver.findElement(By.id("username")).sendKeys("admin");
Thread.sleep(4000);
driver.findElement(By.name("pwd")).sendKeys("manager");
Thread.sleep(4000);
driver.findElement(By.className("initial")).click();
Thread.sleep(4000);
driver.close();
}
Scenario: -
➔ Access OrangHRM application
➔ Perform login operation.
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
108
driver.findElement(By.name("username")).sendKeys("Admin");
driver.findElement(By.name("password")).sendKeys("admin123");
driver.findElement(By.className("oxd-form-actions orangehrm-
login-action")).click();
//[class="oxd-button oxd-button--medium oxd-button--main
orangehrm-login-button"]
//class="oxd-form-actions orangehrm-login-action"
//[name='password']
Thread.sleep(4000);
}
CssSelector(): -
Tagname[attributeNmae=’attributeValue’]
driver.findElement(By.cssSelector("input[placehol
der='Username']")).sendKeys("admin");
Get Navigate
1 With the help of get method With the help of navigate we
we can only access to the can perform 4 operation
web page 1. Access
2. Forward
3. backward
4. refresh
2 Get() will wait until unless Navigate will not for web page
web page is fully loaded. to be fully loaded perform the
next operation.
109
Scenario: -
➔ access actitime and perform login operation with the keys of
cssSelector.
Program:
package selenium_program;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
driver.findElement(By.cssSelector("input[placeholder='Username']")).s
endKeys("admin");
Thread.sleep(4000);
driver.findElement(By.cssSelector("input[placeholder='Password']"
)).sendKeys("manager");
Thread.sleep(4000);
driver.findElement(By.cssSelector("a[id=loginButton]"
)).click();
Thread.sleep(4000);
driver.close();
}
}
X-path:
• X-path is the most popular locator we are using in selenium web
driver.
• X-path is the last option because other locator will start
searching it is operation inside ‘DOM’ (document object
module) structure. But X-path will start searching from HTML
tag so the web element will be more unique and change of
failure is less.
• We have two types of X-path
1.Absolute X-path.
2.Relative X-path.
110
Absolute X-path: - Absolute X-path means ‘/’
HTML
input
input div
input
div
input
div
1)html[type=’text’]/div/input[1]/div/div
2)html[type=’text’]/input[2]/div/input/input
• Absolute X-path we are never going to use because it is
completely depends on index and index can be changed any
time so change of failure is more.
• To solve this draw back we are going to use relative X-path.
Basic relative X-path:
➔ X-path by attribute value.
➔ X-path by visible text.
➔ X-path by contains attribute value.
➔ X-path by contains visible text.
111
Advance relative X-path:
➔ X-path by forward traversing.
➔ X-path by backward traversing.
➔ X-path by following sibling.
➔ X-path by preceding sibling.
➔ X-path by surrounding elements.
➔ X-path by start-with.
➔ X-path by descendent.
➔ X-path by relational operator.
➔ X-path by multiple attribute and visible text.
➔ X-path by index.
Relative X-path mean ‘//’:
X-path by attribute value.
Search in webpage: -
//tagname[@attributeName=’attributeValue’]
//div [text()=’login’]
Syntax:
driver.findElement(By.xpath( "//div[text()='Login ']")).click();
112
X-path by contains attribute value.
Contains means partial here it is working with attribute value , this
why attribute value will be partial.
Search of syntax:
Tagname[‘contaons(attributename,’partialAttributreValue’ )]
Scenario:-
➔ Acess actitime perform login operation.
➔ X-path by attribute value ,visible text,contains attribute value.
Program:
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
113
driver.findElement(By.xpath("
//input[contains(@class,'pwdfield')]")).sendKeys("manager");
Thread.sleep(4000);
driver.findElement(By.xpath( "//div[text()='Login
']")).click();
}
Scenario:
➔ Access flipkart ,close the login page
➔ search for iphone 11.
➔ Click on search button
➔ Close the window.
Program:
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
114
X-path by contains visible text:
//tagname[contains(text(),’partial visible text’)]
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
driver.findElement(By.xpath("//button[text()='✕']")).click();
WebElement element=
driver.findElement(By.xpath("//input[@title='Search for
products, brands and more']"));
element.sendKeys("iphone 11");
element.submit();
Thread.sleep(4000);
115
WebElement
element1=driver.findElement(By.xpath("//div[text()='APPLE iPhone 11
(White, 128 GB)']"));
String pName=element1.getText();
System.out.println(pName);
element1.click();
Thread.sleep(4000);
driver.quit();
}
}
Scenario:
➔ Access flipkart
➔ Close the logic page
➔ Search for iphone 11.
➔ Print the result.
➔ Click on price low to high.
➔ Then click on the first product the close the both
windows.
➔ Close both the window.
Program:
package selenium_program;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
//Access flipkart
//close the login page
//search for Iphone 11
//print the result
//click on the price low-high
//click on the first product
//and close both window
116
import org.openqa.selenium.chrome.ChromeDriver;
117
String Tname=element1.getText();
System.out.println(Tname);
Thread.sleep(2000);
driver.findElement(By.xpath("//div[text()='Price -- High to
Low']")).click();
Thread.sleep(2000);
driver.findElement(By.xpath("//div[@class='_4rR01T']")).clic
k();
Thread.sleep(2000);
driver.quit();
}
}
Scenario:
Access flipkart close the login page search for iphone 11
Print all the product.
Close the window.
Program:
package selenium_program;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
118
driver.findElement(By.xpath("//button[text()='✕']")).click();
Thread.sleep(2000);
WebElement element=
driver.findElement(By.xpath("//input[@title='Search for
products, brands and more']"));
element.sendKeys("iphone 11");
Thread.sleep(2000);
element.submit();
Thread.sleep(2000);
java.util.List<WebElement>
Pname=driver.findElements(By.xpath( "//div[@class='_4rR01T']"));
Thread.sleep(4000);
for(WebElement Element:Pname)
{
String allName=Element.getText();
System.out.println(allName);
}
driver.quit();
}
119
//input[@type=’name’]/../../../../following-
sibling::input[2]/div/input[2]/div/div/input[1]
Preceding-sibling:
Input[@type=’name’]/../../../../preceding-
sibling::input[1]/div/input[2]/div/div[1]/div
X-path by surrounding elements:
• To handle dynamic webElement we will go for x-path by
surrounding element.
• To perform x-path by surrounding elements we need to
following few rules.
1. We have to identify the static webElement and dynamic
webElement.
2. Find the common parent for static and dynamic webElement.
3. Find X-path for static webElement and identify /locate the
dynamic webElement.
4. Use forward , backward , following , preceding x-path to
reach to the dynamic webElement.
Scenario:
➔ Access flipkart.
➔ Search for iphone 11.
➔ Print first product name and its price
➔ Close the window
Program:
package selenium_program;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.*;
public class Xpath5_forward_backward
{
120
public static void main(String[] args) throws
InterruptedException
{
System.setProperty("webdriver.chrome.driver",
"D:\\Selenium Folder\\chromedriver.exe");
ChromeDriver driver=new ChromeDriver();
driver.get("https://www.flipkart.com/");
driver.findElement(By.xpath("//button[text()='✕']")).click();
WebElement element=
driver.findElement(By.xpath("//input[@title='Search for
products, brands and more']"));
element.sendKeys("iphone 11");
element.submit();
Thread.sleep(2000);
WebElement
element1=driver.findElement(By.xpath("//div[text()='APPLE iPhone 11
(Black, 128 GB)']"));
String Pname=element1.getText();
WebElement
element2=driver.findElement(By.xpath("//div[@class='_4rR01T']/../fol
lowing-sibling::div[1]/div/div/div"));
String Pri=element2.getText();
System.out.println(Pname+".........."+Pri);
Thread.sleep(2000);
}
Scenario:
Access the flipkart. search for iphone11
Print all product name and its prices and close the window
Program:
package selenium_program;
import java.util.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
121
public static void main(String[] args) throws
InterruptedException
{
System.setProperty("webdriver.chrome.driver", "D:\\Selenium
Folder\\chromedriver.exe" );
ChromeDriver driver=new ChromeDriver();
driver.get("https://www.flipkart.com/");
driver.findElement(By.xpath("//button[text()='✕']")).click();
WebElement element=
driver.findElement(By.xpath("//input[@title='Search for
products, brands and more']"));
element.sendKeys("iphone 11");
element.submit();
Thread.sleep(2000);
List<WebElement> Pname=driver.findElements(By.xpath(
"//div[@class='_30jeq3 _1_WHN1']/../../../preceding-
sibling::div/div[1]"));
List<WebElement> Price=driver.findElements(By.xpath(
"//div[@class='_4rR01T']/../following-
sibling::div[1]/div[1]/div[1]/div[1]"));
//Thread.sleep(4000);
/*for(WebElement Element:Pname)
{
String allName=Element.getText();
System.out.println(allName);
}
List<WebElement> Price=driver.findElements(By.xpath(
"//div[@class='_4rR01T']/../following-
sibling::div[1]/div[1]/div[1]/div[1]"));
Thread.sleep(2000);
for(WebElement Element1: Price)
{
String prinename=Element1.getText();
System.out.println(prinename);
}*/
//driver.quit();
for(int i=1;i<Pname.size();i++)
{
System.out.println(Pname.get(i).getText()+" =
"+Price.get(i).getText());
}
}}
Scenario:
Access actitime .click on task then click on add new click on new
customer provide customer name add description then click on create
customer once the customer will be created print the customer name
and close the window.
Program:
122
package selenium_program;
import java.util.Random;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
System.setProperty("webdriver.chrome.driver","D:\\Selenium
Folder\\chromedriver.exe");
ChromeDriver driver =new ChromeDriver();
driver.get("https://demo.actitime.com/login.do");
driver.manage().window().maximize();
driver.findElement(By.id("username")).sendKeys("admin");
Thread.sleep(4000);
driver.findElement(By.name("pwd")).sendKeys("manager");
Thread.sleep(4000);
driver.findElement(By.className("initial")).click();
Thread.sleep(2000);
driver.findElement(By.xpath("//div[@id='container_tasks']")).c
lick();
Thread.sleep(2000);
driver.findElement(By.xpath("//div[@class='plusIcon']")).click
();
Thread.sleep(2000);
driver.findElement(By.xpath("//div[@class='item
createNewCustomer']")).click();
Thread.sleep(3000);
driver.findElement(By.xpath("//input[@
class='inputFieldWithPlaceholder newNameField
inputNameField']")).sendKeys("Purushotam" +num);
Thread.sleep(2000);
driver.findElement(By.xpath("//textarea[@
placeholder='Enter Customer Description']")).sendKeys("hi hi");
Thread.sleep(2000);
driver.findElement(By.xpath("//div[text()='Create
Customer']")).click();
Thread.sleep(3000);
String Name=driver.findElement(By.xpath(
"//div[@class='titleEditButtonContainer']")).getText();
System.out.println(Name);
}
}
X-path by starts with: -
123
With visible text: -
//tagName[starts-with(text(),’partial visible text’)]
With attribute: -
124
(//div [@name =’-4kkrjm’]) [1]
Searchcontext(I)
WebDriver(I)
Jsexecution(I)
TakeScreenshot(I)
RemoteWebDriver(C)
OpenDriver
FireFox Driver
ChromiumDriver(C)
WhichEdgeDriver
approach is appr ChromeDriver
125
→This approach is not correct because we cannot perform class
browser execution. It is specific to chrome bowser.
RemoteWebDriver driver=new RemoteWebDriver();
→With the help of upcasting we can perform cross browser execution
but this approach is appropriate for selenium grid.
WebDriver driver=new ChromeDriver();
→With help upcasting we can perform cross browser execution and
this approach is best approach for selenium web driver.
Search context driver=new ChromeDriver ();
→With the help of this approach, we can launch a browser but we
can’t access to any Web Application.
Scenario:
➔ Access actitime.
➔ To login operation
➔ Click on user
➔ Click on new user
➔ Provide first name, last name and email id.
➔ Then click on save and send invitation.
➔ Click on close.
➔ Click on log out.
➔ Close the window.
Program:
package selenium_program;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
System.setProperty("webdriver.chrome.driver","D:\\Selenium
Folder\\chromedriver.exe");
WebDriver driver =new ChromeDriver();
126
driver.get("https://demo.actitime.com/login.do");
driver.manage().window().maximize();
driver.findElement(By.id("username")).sendKeys("admin");
Thread.sleep(4000);
driver.findElement(By.name("pwd")).sendKeys("manager");
Thread.sleep(4000);
driver.findElement(By.className("initial")).click();
Thread.sleep(2000);
driver.findElement(By.xpath("//div[@id='container_users']")).c
lick();
Thread.sleep(2000);
driver.findElement(By.xpath("//div[text()='New
User']")).click();
Thread.sleep(2000);
driver.findElement(By.xpath("//input[@id='createUserPanel_firs
tNameField']")).sendKeys("S");
Thread.sleep(3000);
driver.findElement(By.xpath("//input[@id='createUserPanel_last
NameField']")).sendKeys("purushotham");
Thread.sleep(3000);
driver.findElement(By.xpath("//input[@id='createUserPanel_emai
lField']")).sendKeys("purusotham8305@gmail.com");
Thread.sleep(2000);
driver.findElement(By.xpath("//div[text()='Save & Send
Invitation']")).click();
Thread.sleep(4000);
driver.findElement(By.xpath("(//span[text()='Close'])[1]")).cl
ick();
driver.findElement(By.xpath("(//div[@class='popup_menu_icon'])
[5]")).click();
Thread.sleep(2000);
driver.quit();
}
Hover message handling: -
➔ Hover messages are not inspectable.
➔ This message type of messages always store in inside title
attribute.
➔ To handle this type of messages we have to use a method
getAttribute();
Syntax:
String hov=element.getAttribute(“title”);
127
Scenario:
➔ Access actitime
➔ Go to keep me logged in checkbox
➔ Print the hover message
➔ Check that element is displayed, enabled , delected or not.
➔ Fetch the size , location , tag name of the web element.
Program:
package selenium_program;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
128
SECTION-2
Keyboard stroke handling:
Keyboard stock can be handled in two ways.
1) With the help of keys class
2) With the help of robot class
Keys class:
• It is an inbuilt class present in org.openqa.seleniumpackage.
• Keys class we have to declare inside sendKeys methods
• Outside sendKeys methods keys class will not work
• Keys class cannot perform its operations with alphabets
• Keys class don’t have any access on desktop windows.
Syntax:
driver.findElement(By.xpath("//input[@id='u
sername']")).sendKeys("admin",Keys.TAB,"manager
",Keys.ENTER);
Robot class:
• To use robot class, we have to create an object for robot class.
• This class is present in java.awt.package
• In these class two methods are present
1. Keypress
2. Keyrelease
• Robot class will work with alphabets, no need to use sendKeys
method.
• It can access in desktop window.
129
Different b/w Keys and Robot: -
S.No Keys Robot
1 It is present is selenium It is present in
package. java.awt.package.
2 Keys class we have to Robot class no need to declare
declare inside sendKeys. inside sendkeys() but we have
to create an object of robot
class
3 Keys class will not work Robot class will work with
with alphabets. alphabets.
4 Keys class don’t have any Robot class can access in
access in desktop windows. desktop.
Scenario:
➔ Access actitime.
➔ Perform administration login, with the help of Key class.
➔ Perform regular user login with help of robot class.
Program:
package selenium_program;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
System.setProperty("webdriver.chrome.driver","D:\\Selenium
Folder\\chromedriver.exe");
WebDriver driver =new ChromeDriver();
driver.get("https://demo.actitime.com/login.do");
driver.manage().window().maximize();
Thread.sleep(3000);
130
//driver.findElement(By.xpath("//input[@id='username']")).send
Keys("admin",Keys.TAB,"manager",Keys.ENTER);
driver.findElement(By.xpath("//input[@id='username']")).sendKe
ys("trainee");
Thread.sleep(3000);
Robot r=new Robot();
r.keyPress(KeyEvent.VK_CONTROL);
r.keyPress(KeyEvent.VK_A);
r.keyRelease(KeyEvent.VK_CONTROL);
r.keyRelease(KeyEvent.VK_A);
Thread.sleep(2000);
r.keyPress(KeyEvent.VK_CONTROL);
r.keyPress(KeyEvent.VK_C);
r.keyRelease(KeyEvent.VK_CONTROL);
r.keyRelease(KeyEvent.VK_C);
Thread.sleep(2000);
r.keyPress(KeyEvent.VK_TAB);
r.keyRelease(KeyEvent.VK_TAB);
Thread.sleep(2000);
r.keyPress(KeyEvent.VK_CONTROL);
r.keyPress(KeyEvent.VK_V);
r.keyRelease(KeyEvent.VK_CONTROL);
r.keyRelease(KeyEvent.VK_V);
Thread.sleep(2000);
r.keyPress(KeyEvent.VK_ENTER);
r.keyRelease(KeyEvent.VK_ENTER);
}
Auto Suggestion Handling:
→Auto suggestion are nothing but set of suggestion which wait
automatically visible after searching something in a web page.
Scenario:
Access google , search for virat kohil and print all the suggestions.
Program:
package selenium_program;
import java.util.Iterator;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
131
public static void main(String[] args) throws
InterruptedException {
System.setProperty("webdriver.chrome.driver",
"D:\\Selenium Folder\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("https://www.google.com/");
driver.findElement(By.xpath("//input[@class='gLFyf']")).sendKe
ys("virat kholi");
Thread.sleep(4000);
List<WebElement>
suggestions=driver.findElements(By.xpath("(//div[@class='OBMEnb'])[1
]/ul/li"));
/*for(WebElement Element:suggestions)
{
System.out.println(Element.getText());
}*/
Iterator<WebElement> element1=suggestions.iterator();
while(element1.hasNext())
{
System.out.println(element1.next().getText());
}
}
132
Drop down or list box handling: -
→Drop down or list handled in 3 ways.
1. With the help of findElement approach.
2. With the help keyboard stroke (robot class)
3. With the help select class.
Scenario:
➔ Access orange Hrm application
➔ Do login operation
➔ Click on leave
➔ Select on leave type (use find Element as well as robot class
approach.
Program: -
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
driver.findElement(By.xpath("//input[@name='username']")).send
Keys( "Admin", Keys.TAB,"admin123", Keys.ENTER );
Thread.sleep(4000);
driver.findElement(By.xpath("(//a[@class='oxd-main-menu-
item'])[3]")).click();
Thread.sleep(4000);
driver.findElement(By.xpath("//div[text()='-- Select --
']")).click();
Thread.sleep(4000);
Robot r=new Robot();
r.keyPress(KeyEvent.VK_PAGE_DOWN);
r.keyRelease(KeyEvent.VK_PAGE_DOWN);
r.keyPress(KeyEvent.VK_PAGE_DOWN);
r.keyRelease(KeyEvent.VK_PAGE_DOWN);
133
}
Select Class:
• It is an inbuilt class present in selenium package.
• With the help of this point we can handle or drop down
or list box.
• This class is applicable only if select tag is present.
• To use this class we need to create an object of select
class.
Syntax:
→In this class some method are present to perform selection
and deselection operation.
To perform selection operation: -
➔ selectByvisibleText(“Austrialia”);//selecting with
visble text
➔ s.selectByvalue(“13”);//select by value
➔ s.selectByindex(10);//selecting by index
To perform Deselection operation: -
➔ s.deselectAll();
➔ s.deselectByindex(0);//de.selecting by value
➔ s.deselectByvalue(null);//de.selecting by value
➔ s.deselectByvisible(“”);//de.selecting by visible text
Note: -
isMultiple() is to check listbox /dropdown is multi Selected or
not.
134
Scenario:
➔ Access opencart.com
➔ Click on register after that in the registration page
select the county (use select class)
Program:
package selenium_program;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
System.setProperty("webdriver.chrome.driver","D:\
\Selenium Folder\\chromedriver.exe");
WebDriver driver =new ChromeDriver();
driver.get("https://www.opencart.com/");
driver.findElement(By.xpath("(//a[text()='Register'])
[2]")).click();
WebElement name=
driver.findElement(By.xpath("//select[@class='form-
control']"));
135
Scroll down handling:
→Scroll down handing can be done in two ways.
1. With the help of java script executor.
2. With the help of robot class.
Java script executor: -
➔ In this approach we have to down cast java script executor.
Syntax:
JavascriptExecutor jse=(JavascriptExecutor)driver;
➔ After down casting we have to use a method called as execute
script.
➔ In this method we have to pass gthe java script syntax in string
formal.
Note: javascript syntax we have to pass in front end consoule.
Syntax: jse.executeScript("window.scrollBy(0,300);");
Robot Class:
→In this case we have to use page.down:
Syntax:
Robot r=new Robot();
r.keyPress(KeyEvent.VK_PAGE.DOWN);
r.keyrelease(KeyEvent.VK_PAGE.DOWN);
Scenario:
➔ Access opencart platform
➔ Click on registor
➔ In this registor page perform scrolldown operation (javascrip
executor , robot class)
136
Program:
package selenium_program;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptException;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.json.Json;
driver.findElement(By.xpath("(//a[text()='Regis
ter'])[2]")).click();
WebElement name=
driver.findElement(By.xpath("//select[@class='f
orm-control']"));
//JavascriptException
jse=(JavascriptException)driver;
Thread.sleep(2000);
//jse.executeScript("window.scrollBy(0,300);");
JavascriptExecutor
jse=(JavascriptExecutor)driver;
jse.executeScript("window.scrollBy(0,300);"
);
}
}
137
Synchronization: -
• Synchronization is nothing but time mismatch in between
automation tool speed and web browser speed.
• Synchronization happen because of automation tool speed is
faster than web browser speed.
• We can handle synchronization issue in 4 ways.
1. Thread.sleep();
2. Implictily wait.
3. Explicit wait.
4. Fluent wait.
1.Thread.sleep();
138
Note: -
During execution if script failed and we are getting exception, we
will check with Thread.sleep, that really synchronization issue is
present or not, if it is present we will remove thread.sleep and we will
go with explicit wait.
Explicit wait: -
Scenario:
➔ Access flipkart
➔ Search for iphone 11
➔ Click on add to compare of 1st product ,last product and second
last product.
➔ Close the window.
139
S.No Implicit wait Explicit wait
1 We have to declare implicit wait We can declare explicit wait
only for one time. multiple time in our script.
2 Implicit wait will work only Explicit wait will work with all
with findElement and the methods.
findElements.
3 In case of implicit wait no need In case of explicit wait we have to
to create an object. create webdriverwait class object.
4 Syntax: Syntax:
Driver.manage() Wait.until
.timeouts(). (ExpectedCondition.particular
Implicitywai ExpectedConditin);
t(During.ofseconds(10);
Program: -
package selenium_program;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class FlipKartImplicitly {
public static void main(String[] args) throws
InterruptedException {
System.setProperty("webdriver.chrome.driver",
"D:\\Selenium Folder\\chromedriver.exe");
ChromeDriver driver=new ChromeDriver();
Thread.sleep(3000);
//driver.manage().timeouts().implicitlyWait(Duration.ofSe
conds(3));
driver.get("https://www.flipkart.com/");
driver.findElement(By.xpath("//button[text()='✕']")).clic
k();
140
WebElement element=
driver.findElement(By.xpath("//input[@title='Search for
products, brands and more']"));
element.sendKeys("iphone 11");
element.submit();
Thread.sleep(6000);
driver.findElement(By.xpath("(//label[@class='_2iDkf8'])[
1]")).click();
Thread.sleep(3000);
driver.findElement(By.xpath("(//label[@class='_2iDkf8'])[
24]")).click();
Thread.sleep(3000);
driver.findElement(By.xpath("(//label[@class='_2iDkf8'])[
23]")).click();
Thread.sleep(6000);
driver.close();
141
→With the help of this method we can build a relationship in b/w
mouse actions.
4. dobleClick(): -
→To perform dobleClick operation in a webpage we have to use this
method.
5. Perform: -
→With the help of this method we can send the command to the
mouse action to perform the operation.
6. Drag and Drop(source, target): -
→with the help of this method we can drag a element and drop it to
the target.
Syntax:
Act.dragAnddrop(source,target);
7. Source DragAndDropBy(source,x,y): -
→with the help of this method we can drag a source (webElement) to
a particular offset(xOffset,yOffset)
Syntax:
Act.dragandDropBy(src,Xoffset,Yoffset);
Scenario: -
➔ Access flipkart
➔ Close the login page
➔ Left click on the search option
➔ Right click on it
Program:
package selenium_program;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.interactions.Actions;
142
driver.get("https://www.flipkart.com/?ef_id=b5abd62406711
47a35c4b22435595128:G:s&s_kwcid=AL!739!10!76484942419895!76485
137405439&semcmpid=sem_F1167BY7_Brand_adcenter");
Thread.sleep(4000);
driver.findElement(By.xpath("//button[@class='_2KpZ6l
_2doB4z']")).click();
Thread.sleep(4000);
WebElement element=
driver.findElement(By.xpath("//input[@title='Search for
products, brands and more']"));
Actions act=new Actions(driver);
act.moveToElement(element).contextClick().perform();
}
}
Scenario:
➔ Access dhtml goodies.com
➔ Drag the capitals to its respective countries.
Program:
package selenium_program;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.interactions.Actions;
143
r.dragAndDrop(element, element2);
WebElement
element3=driver.findElement(By.xpath("(//div[text()='Rome'])[2
]"));
WebElement
element4=driver.findElement(By.xpath("//div[text()='Italy']"))
;
r.dragAndDrop(element3, element4);
r.perform();
}
Scenario: -
➔ Access flipkart
➔ Search for iphone 11
➔ In the price option drag the right pointer to the left side as well
as drag the left pointer and right side.
Program: -
package selenium_program;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.interactions.Actions;
driver.findElement(By.xpath("//button[text()='✕']")).clic
k();
Thread.sleep(2000);
WebElement element=
driver.findElement(By.xpath("//input[@title='Search for
products, brands and more']"));
element.sendKeys("iphone 11");
element.submit();
144
Thread.sleep(3000);
WebElement leftside=
driver.findElement(By.xpath("(//div[@class='_3FdLqY'])[2]
"));
Thread.sleep(3000);
WebElement rightside=
driver.findElement(By.xpath("(//div[@class='_3FdLqY'])[1]
"));
Actions atc=new Actions(driver);
atc.dragAndDropBy(leftside, -40, 0).perform();
//Thread.sleep(3000);
atc.dragAndDropBy(rightside, 40, 0).perform();
driver.close();
}
Alert pop-up:
145
Alert message
OK cancle
Cancle
Scenario:
➔ Access acttime.
➔ Do login operation click on settings’
➔ Click on types of work.
➔ Click crate type of work.
➔ Provide some name.
➔ Click on cancel
➔ Fetch the alert message, click on cancel or ok
Program :
package selenium_program;
import java.time.Duration;
import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(1
0));
driver.findElement(By.xpath("//input[@id='username']")).sendKe
ys("admin",Keys.TAB,"manager",Keys.ENTER);
driver.findElement(By.xpath("(//div[@class='menu_icon'])[2]"))
.click();
146
driver.findElement(By.xpath("//a[text()='Types of
Work']")).click();
driver.findElement(By.xpath("//span[text()='Create Type of
Work']")).click();
driver.findElement(By.xpath("//input[@name='name']")).sendKeys
("hihitata");
driver.findElement(By.xpath("//input[@value=' Cancel
']")).click();
Alert alt =driver.switchTo().alert();
String msg=alt.getText();
System.out.println(msg);
alt.accept();
// alt.dismiss();
}
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
147
WebDriver driver=new ChromeDriver(option);
driver.get("https://demo.actitime.com/login.do");
driver.manage().timeouts().implicitlyWait( Duration.ofSeconds(10));
driver.findElement(By.xpath("//input[@id='username']")).sendKeys("admin",Keys.TAB,"
manager",Keys.ENTER);
driver.findElement(By.xpath("//div[@id='container_tasks']")).click();
driver.findElement(By.xpath("(//td[@class='selection'])[1]")).click();
Thread.sleep(3000);
driver.findElement(By.xpath("(//div[text()='Delete'])[1]")).click();
Thread.sleep(4000);
String msg=driver.findElement(By.xpath("//div[contains(text(),'You are about to
delete')]"))
.getText();
System.out.println(msg);
}
}
Window pop-up handling: -
→With the help of this method we can store the parent window id.
Syntax:
Driver. getWindowHandle();
getWindowHandles();
→With the help of this method we can store all child window ids.
Syntax:
Driver. getWindowHandles();
Note:
We have to switch the web driver focus to the child window.
Syntax:
Driver.switchTo(). window(All);
Why we are using set in case of list?
→set will never allow duplicate and window ides are always unique
that’s why we are using set.
→list will allow duplicate. so, we cannot use list in this case.
148
S.No getWindowHandle() getWindowHandles()
1 getWindowHandle method getWindowHandles method
will gives us the parent will give us the all child
window id. window id.
2 Return type of Return type of
getWindowHandle is getWindowHandles is set of
String String
Scenario:
➔ access flipkart
➔ close the login page
➔ search for iphone 11
➔ click on the first product
➔ print the product name from the next window.
➔ Close both the window.
Program: -
package selenium_program;
import java.time.Duration;
import java.util.Set;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
driver.manage().timeouts().implicitlyWait(Duratio
n.ofSeconds(10));
149
driver.findElement(By.xpath("//button[text()='✕']")).
click();
WebElement element=
driver.findElement(By.xpath("//input[@title='Sear
ch for products, brands and more']"));
element.sendKeys("iphone 11");
element.submit();
driver.findElement(By.xpath("(//div[@class='_4rR0
1T'])[1]")).click();
Thread.sleep(9000);
String parent=driver.getWindowHandle();
Set<String> child=driver.getWindowHandles();
for(String all:child)
{
if(!all.equals(parent))
{
driver.switchTo().window(all);
}
}
String
text=driver.findElement(By.xpath("//span[text()='APPL
E iPhone 11 (White, 64 GB)']")).getText();
System.out.println(text);
}
Frame-popup-handling: -
150
1.Frame(int index): -
Scenario: -
➔ Access selenium.dev website
➔ Click on frame
➔ Click on org,opeanqa.selenium from the package.
➔ Click on alert from the inter face alert message from frame 3
➔ Close the window
Program: -
package selenium_program;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
driver.get("https://www.selenium.dev/selenium/docs/api/java/ov
erview-summary.html");
151
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(1
0));
driver.findElement(By.xpath("(
//a[text()='Frames'])[1]")).click();
driver.switchTo().frame(0);
driver.findElement(By.xpath("(
//a[text()='org.openqa.selenium'])[1]")).click();
driver.switchTo().defaultContent();
driver.switchTo().frame(1);
driver.findElement(By.xpath("//span[text()='Alert']")).click()
;
driver.switchTo().defaultContent();
driver.switchTo().frame(2);
String
div=driver.findElement(By.xpath("//h2[text()='Interface
Alert']")).getText();
System.out.println(div);
driver.quit();
ScreenShot handling:
TakesScreenshot td=(TakesScreenshot)driver;
• We have to use a method called as getScreenshot as in our
script.
• This method will get screenshot in file format and it will store in
source.
File src=ts.getScreenshotAs(outputType.FILE);
• We have to create file class object to provide the path, where we
can copy the src.
File dest=new File(“.\\screenshot\\” + “screen.png”);
152
• Then we need to use a method called as copy. To copy the
source into destination.
Files.copy (src,dest);
Program: -
package selenium_program;
import java.io.File;
import java.io.IOException;
import com.google.common.*;
import com.google.common.io.Files;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
153
}
Calendar cal=Calendar.getInstance();
String formate=sdf.Format(d);
Program:
package selenium_program;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
154
public class Calendar_Formate {
//driver.get("https://jqueryui.com/resources/demos/datepicker/de
fault.html");
Calendar cal=Calendar.getInstance();
cal.add(Calendar.DAY_OF_YEAR, 1);
Date d=cal.getTime();
SimpleDateFormat sdf=new
SimpleDateFormat("MM/dd/yyyy");
String Formate=sdf.format(d);
System.out.println(Formate);
//driver.findElement(By.xpath("//input[@id='datepicker']")).sen
dKeys(Formate);
//cal.add(Calendar.DAY_OF_YEAR, 10);
}
155