Sta Final
Sta Final
Hakeem Nagar, Melvisharam - 632 509, Ranipet District, Tamil Nadu, India.
(Regd. Under Sec 2(F) & 12(B) of the UGC Act 1956)
(REGULATION - 2021)
Register Number:
Degree / Branch:
Year / Semester:
Academic Year:
1
C. ABDUL HAKEEM COLLEGE OF ENGINEERING AND TECHNOLOGY
Hakeem Nagar, Melvisharam - 632 509, Ranipet District, Tamil Nadu, India.
(Approved by AICTE, New Delhi and Affiliated to Anna University, Chennai)
( Regd.Under Sec 2(F) & 12(B) of the UGC Act 1956)
CERTIFICATE
Certified that this is the bonafide record of work done by the above in
CCS335 –NEURAL NETWORK AND DEEP LEARNING LABduring 2024 - 2025.
Internal: External:
2
CONTENTS
Aim
Procedure
1 –Homepage
2 – Master page (Header &Footer)
3 –Login&Registration
4 – My Account Page
5 –SearchFeature
6 – Product Listing Page (PLP)
7– Product Details Page (PDP)
8– Shopping Cart
9 –CheckoutFlow
10 –OrderConfirmationPage
Obviously homepage of any website is the very first page that many users see. Homepages in
ecommerce websites actually go far beyond than just a landing page. Besides a clickable hero image or
product slideshow with auto-scroll features, homepage of an online store can actually serve as a
powerful marketing tool. Here are some essential test cases that your ecommerce testing team should
focus when testing the homepage:
– Does the hero carousel autoscroll? If so, then at what interval (image refresh time)?
– Does the hero carousel continue to autoscroll when the user hovers mouse over the image? Does
thescrolling pause or continue to auto scroll to the next image slide?
– When clicked on one of the slider images or call to action (CTA) buttons, is it taking the customer
tothe intended page?
– Is the hero slider scrolling too fast?
– Is the homepage loading speed acceptable?
Is the rest of the homepage content such as the newsletters, banners, social media links in the site footer
etc easily viewable?
– Does the homepage load and appear the same way across supported browsers and screen
resolutions?
– Can the shopping cart be easily located from homepage?
– Can the login/signup button be easily located from homepage?
– Can the contact information be easily located from homepage?
Unlike most other pages, the master page of an ecommerce site is not a stand-alone page but consists of
page components that are used in most of the other pages. Typically, the master page consists of the
header, the navigation menu and the footer components. Here are some important test cases that your
ecommerce QA team should focus when testing the master page components:
– Do the master page components appear on all page types as expected?
– Does the site logo appear as per the design?
– Is the website logo clickable and takes user to the site homepage?
– Is the navigation menu appearing as per the design?
– Does the nav menu constitute all the sub−menus and mega−menu (if implemented)?
– Does the nav menu turn to a burger menu when viewed on smaller screen breakpoints (e.g.
mobileand tablet screens)?
– Is the footer appearing as per they design?
– Are all the footer components (e.g. footer menu, footer logos, legal links such as privacy
policy,terms & conditions, the © notice and social icons etc) appearing as expected?
– Does the footer menu turn into an accordion to save space on smaller screen sizes (e.g. mobile
andtablet screens)?
While all of the ecommerce sites have user registration feature, some of them do allow their customers
to purchase products as a guest, i.e. without forcing them to register and create an account, and then
with an optional step to create an account in the order confirmation page after the order has been
placed. Once an account has been created, the user can choose to log in at any stage during a checkout
process. Here are some good test cases for your ecommerce testing team to focus when testing the login
and registration process:
– Assuming that the site permits this, can the customer purchase items as a guest user?
– Can a guest user easily create an account from the order confirmation page after the order has
beenplaced?
– Can a guest user register as a member from the registration page?
– Once logged in, are the products in the cart getting correctly associated with the logged in member’s
account?
– Once logged in, is the user still being prompted to sign in? This shouldn’t happen.
– Are the login redirects working as expected and whether the user is being redirected to the
correctpage after completing a particular user journey?
– Are the user sessions being maintained for the intended time period?
– Is the user’s session timing out and expiring after the stipulated time?
Believe it or not, the search feature is one of the most-used features in an ecommerce store. Even with
ecommerce sites with sophisticated product listing (category) pages and easy to use navigation,
customers often find it easier to use the website search feature to find exactly what they are looking for.
Here are some important test cases for your ecommerce testing team to focus when testing the Search
features:
– Is the search feature robust enough to allow searching by product names, brand names or
product categories etc? e.g. iPhone X, Apple iPhone, latest iPhone models, cheap iPhone, iPhones
in 2023 oreven just iPhones etc.
– Are the search results relevant for all variations of search keywords?
– Does the search result page have sorting options?
If sorting option is available on search results page, then can customers sort the results based on price
(highto low, low to high), date ranges, brand, review / ratings etc?
– Is pagination option available on search results page when a long list of products are displayed?
– How many results are displayed on each page?
– Does the next page load automatically when user scrolls? If not, can the user easily navigate to
thenext search result page using pagination?
While it is neither possible nor prudent to test each and every category page of an ecommerce site,
these pages list products that the customers are looking for and hence you must test at least few of the
product listing pages randomly to ensure everything is in order. Here are some critical test cases for
your ecommerce QA team to focus when testing the Category or Product Listing Page:
– Does this page display the correct products based on the selected category?
– Does this page display proper sorting options based on price (high to low, low to high), date
ranges,brand, review / ratings etc?
– Does this page display proper filter options?
– Is pagination option available on this page when a long list of products are displayed?
– How many results are displayed on each page?
– Does the next page load automatically when user scrolls? If not, can the user easily navigate to
thenext page using pagination?
– Does this page display the correct recommended products based on the selected category?
– Does this page display the correct related products based on the selected category?
– Does this page display the correct featured products based on the selected category?
Whether you realize this or not, but this is the page where every other page (home page, the navigation
menu, category pages, search result pages etc) is trying to drive traffic in. Thus, the product details page
is the page that ultimately begins the checkout flow journey that results in revenue for every
ecommerce sites. Here are some crucial test cases for your ecommerce testing team to focus when
testing the Product Details Page:
– Does this page display all the product related information (e.g. product name, SKU, price, discount
ifany, product images, product specifications, user reviews, Add to Cart button, quantity changer etc)
as expected?
– Does this precut display other similar products that were bought by customers who purchased
thisitem?
– Can the customer customize the product if it is a customizable product and available with
variations(size, colors etc)?
– Does this page show the stock availability accurately?
– Can the user select required number of items using the quantity selector and then add the
product tocart?
– Does this product gets added to cart when added?
– Does the quantity in cart get updated when the product is added to cart?
Shopping cart is one of the crucial components of an ecommerce website for obvious reasons. Just like
physical shopping baskets, the shopping carts in an ecommerce website allows the customers to select
and store multiple different items in their cart and then purchase them together when ready. Here are
some key test cases, which should be part of testing a shopping cart.
– Does the cart get updated to show updated quantity when an item is added to it?
– Does the mini−cart (that slides when you click on the cart icon) correctly reflect the items,
theirquantity and price?
– Can you increase or decrease quantity of an item from the cart and mini−cart?
– Can you remove an item from the cart and mini−cart?
– Can you add the item several times to the cart?
– Can you add several variations (e.g. color, size etc) of the same item to the cart?
– Can you add several items of different types to the cart?
– Can you visit the product detail page by clicking on an item from the cart?
– Does the cart still remembers the items, their quantity and price correctly even if you
accidentallyclose the browser and then reopen it?
– Does the cart still remembers the items, their quantity and price correctly even if you log out as
themember and then logs back in?
– Can you apply valid coupon codes and discount vouchers in the cart?
– Does the discount get correctly applied when valid coupon codes and discount vouchers
are appliedin the cart?
The Checkout flow is the user journey that takes place when the user decides to move the added product
items from the shopping cart and to finally purchase them. In the checkout process, usually theuser is
required to provide shipping details, billing information and payment details to complete the purchase.
Timed out or unsuccessful transactions are one of the top reasons why most online shoppers abandon an
ecommerce website without completing their purchase. Failed transactions are thus one of the main
reasons of abandoned carts. Here are some of the most crucial test cases to test during the checkout flow.
– If the user is already logged in, does their shipping and billing information get auto−
filled incheckout?
– If the user is a guest user, can they enter their shipping and billing information?
– Do all the types of supported payment methods work?
– Can customers check out as guests and make payments?
– For returning customers, does the checkout page prompt them to sign in?
– Are sensitive information such as customer’s credit card details, PayPal / Amazon Pay /
Google Pay /Apple Pay credentials, etc handled securely and not stored on the site’s server?
– Is the user taken to Order Confirmation page upon successful checkout?
This is the final step of the checkout flow user journey and is displayed only when each steps of the
checkout including shipping, billing and payment are successful. Here are some of the most
importanttest cases to test on the order confirmation page.
– Does this page display the Order ID correctly?
– Does this page display the product details correctly?
– Does this page offer an easy way to create account, in case of guest users?
– Does the customer receive an order confirmation email / SMS text message along with the
order
RESULT:
EX NO : 2 DEVELOP TEST CASES FOR TESTING E -COMMERCE
APPLICIATION
AIM:
HOME PAGE
TC002 Home Page Verify the details on Home page Verify that user name is displayed on
home page or not
TC003 Home Page Verify the details on Home page Verify that featured products are
displayed on home page
TC004 Home Page Verify the details on Home page Verify that Search Functionality is
present on home page.
TC005 Home Page Verify the details on Home page Verify the home page of application on
different browsers.
TC006 Home Page Verify the details on Home page Verify the alignment on the home page
TC007 Home Page Verify the details on Home page Verify that products displayed on home
page are clickable.
TC008 Home Page Verify the details on Home page Verify that when user clicks on a
product, user should be redirected to
product specification page.
TC009 Home Page Verify the details on Home page Verify that user profile section is
present on home page.
TC0010 Home Page Verify the details on Home page Verify that products displayed on home
page are categorised.
SEARCH FUNTIONALTY
TC002 Product Search Verify the product search Verify that after entering search text
functionality and clicking on search icon, the search
should be performed.
TC003 Product Search Verify the product search Verify that the search results should be
functionality as per the search query.
TC004 Product Search Verify the product search Verify that user should be able to
functionality search based on product name,brand
name or product specification.
TC005 Product Search Verify the product search Verify that filter should be present for
functionality filtering the search results bases on
Brand, Price, Reviews or Ratings.
TC006 Product Search Verify the product search Verify that sorting options should be
functionality present on search results page.
TC007 Product Search Verify the product search Verify that the number of search results
functionality displayed on one page.
TC008 Product Search Verify the product search Verify that there should be navigation
functionality button(Next and Previous) for
navigation to pages.
TC009 Product Search Verify the product search Verify that user should be perform search in
functionality different categories for example, Movies,
Books, Grocery etc.
PRODUCT DETAILS
TC001 Product Verify the details on Product Verify that images of product are
Details Specification page displayed correctly.
TC002 Product Verify the details on Product Verify that price of product is
Details Specification page displayed.
TC003 Product Verify the details on Product Verify that product reviews are
Details Specification page mentioned.
TC004 Product Verify the details on Product Verify that product specifications are
Details Specification page displayed.
TC005 Product Verify the details on Product Verify that information about IN-
Details Specification page Stock/Out-Stock are displayed.
TC006 Product Verify the details on Product Verify that seller ratings should be
Details Specification page displayed.
TC007 Product Verify the details on Product Verify that all the variations of product
Details Specification page are displayed.
TC008 Product Verify the details on Product Verify that shipping information about
Details Specification page product are displayed.
TC009 Product Verify the details on Product Verify that payment options are
Details Specification page mentioned on product page.
TC0010 Product Verify the details on Product Verify that product suggestions related
Details Specification page to product should be displayed.
CART PAGE
TC002 Cart Page Verify the details on Cart Page Verify that user should be able to
continue shopping after adding items to
cart.
TC003 Cart Page Verify the details on Cart Page Verify that item quantity should be
increased if user adds same item in cart
again.
TC004 Cart Page Verify the details on Cart Page Verify that total amount of all items
should be displayed to user.
TC005 Cart Page Verify the details on Cart Page Verity that the amount displayed to user
should include the taxes and shipping
charges as per location.
TC006 Cart Page Verify the details on Cart Page Verify that user should not be able to add
items in cart beyond a certain limit.
TC007 Cart Page Verify the details on Cart Page Verify that when user clicks on remove
from cart button the item should be
removed from cart.
TC008 Cart Page Verify the details on Cart Page Verify that user should be able to apply
coupons or vouchers at checkout from
cart.
TC009 Cart Page Verify the details on Cart Page Verify that items in cart should be present
if user logs out and logs in again.
TC002 Checkout,Pay Verify the details on Verify that delivery details of items
ments Page Checkout,Payments Page should be displayed at checkout.
TC003 Checkout,Pay Verify the details on Verify that user should get order details
ments Page Checkout,Payments Page by message or email.
TC004 Checkout,Pay Verify the details on Verify that user should be directed to
ments Page Checkout,Payments Page home page after checkout.
TC005 Checkout,Pay Verify the details on Verify that user should be displayed
ments Page Checkout,Payments Page payment options such as Credit Card,
Debit Card, Net Banking etc.
TC006 Checkout,Pay Verify the details on Verify that if user is not registered then
ments Page Checkout,Payments Page payment should be done as Guest user.
TC007 Checkout,Pay Verify the details on Verify that user should be provided
ments Page Checkout,Payments Page with an option to save the payment
method.
TC008 Checkout,Pay Verify the details on Verify that session should be timed out
ments Page Checkout,Payments Page if payment is not done for a certain
time.
TC009 Checkout,Pay Verify the details on Verify that user details should be
ments Page Checkout,Payments Page displayed on payment page for
registered customers.
MY ORDER PAGE
TC002 My Orders Verify the details on Orders Page Verify that user should be able to
Page change the delivery date and time.
TC003 My Orders Verify the details on Orders Page Verify that user should be able to
Page cancel the order
TC004 My Orders Verify the details on Orders Page Verify that user should be able to
Page return the order after delivery of order.
TC005 My Orders Verify the details on Orders Page Verify that user should be able to
Page exchange the order from My orders
page.
TC006 My Orders Verify the details on Orders Page Verify that user should be able to
Page provide feed back and reviews about
the item delivered.
TC002 Customer Verify the details on Customer Verify that different modes of
Service Page Service Page customer service such as Email,
Chat or Call should be mentioned.
TC003 Customer Verify the details on Customer Verify that waiting time to connect
Service Page Service Page to customer service shold be
displayed to user.
TC004 Customer Verify the details on Customer Verify that customer service
Service Page Service Page should be available in different
languages.
TC005 Customer Verify the details on Customer Verify that the timings of customer
Service Page Service Page service option should be displayed
to user.
RESULT:
EX NO : 3 TEST THE E-COMMERCE APPLICATION AND REPORT THE DEFECTS IN IT
AIM:
HOME PAGE
Test Modul Test Test Pre- Test Data Step Test Expected Result Actual Status Defect
Case e Scenario Case requisites No. Step Result ID
ID Name
TC00 Home Verify Verify Browser Username 1 Open Browser should
1 Page the that should be - browser be opened
details home installed Username
on Home page is Internet Password- 2 Open url Ecommerce
page display connectio password website should
ed after n should be opened
login or be present
not. 3 Enter user should be
usernam able to input
e and username and
password password
4 Click on Home page
login should be
button displayed after
login
TC00 Home Verify Verify Browser 1 Open Browser should
2 Page the that should be browser be opened
details user installed 2 Open url Ecommerce
on Home name is Internet website should
page display connectio be opened
ed on n should 3 Enter user should be
home be present usernam able to input
page or User e and username and
not should be password password
logged in 4 Click on Home page
login should be
button displayed after
login and user
name should be
displayed on
home page
TC00 Home Verify Verify Browser 1 Open Browser should
3 Page the that should be browser be opened
details feature installed 2 Open url Ecommerce
on Home d Internet website should
page product connectio be opened
s are n should
display be present 3 Enter user should be
ed on User usernam able to input
home should be e and username and
page logged in password password
4 Click on Home page
login should be
button displayed after
login and user
name should be
displayed on
home page
TC00 Home Verify Verify Browser 1 Open Browser should
4 Page the that should be browser be opened
details Search installed
on Home Functio Internet
page nality connectio
2 Open url Ecommerce
is n should
website should
present be present
be opened
on User
3 Enter user should be
home should be
usernam able to input
page. logged in
e and username and
password password
4 Click on User should be
login logged in and
button Search
functionality is
present on home
page.
TC00 Home Verify Verify Browser 1 Open Browser should
5 Page the the should be browser be opened
details home installed
on Home page of Internet 2 Open url Ecommerce
page applicat connectio website should
ion on n should be opened
differen be present 3 Enter user should be
t User usernam able to input
browse should be e and username and
rs. logged in password password
4 Click on User should be
login logged in and
button home page
should be same
on different
browsers.
TC00 Home Verify Verify Browser 1 Open Browser should
6 Page the the should be browser be opened
details alignm installed
on Home ent on Internet
page the connectio
2 Open url Ecommerce
home n should
website should
page be present be opened
User 3 Enter user should be
should be usernam able to input
logged in e and username and
password password
4 Click on User should be
login logged in and
button alignment of
products on
home page
should be proper.
TC00 Home Verify Verify Browser 1 Open Browser should
7 Page the that should be browser be opened
details product installed
on Home s Internet
page display connectio
2 Open url Ecommerce
ed on n should
website should
home be present be opened
page User
3 Enter user should be
are should be
usernam able to input
clickabl logged in
e and username and
e.
password password
4 Click on Home page
login should be
button displayed after
login and user
name should be
displayed on
home page
5 Click on User should be
any redirected to
product product
displaye specification
d on page.
home
page
TC00 Home Verify Verify Browser 1 Open Browser should
8 Page the that should be browser be opened
details when installed
on Home user Internet 2 Open url Ecommerce
page clicks connectio website should
on a n should be opened
product be present 3 Enter user should be
, user User usernam able to input
should should be e and username and
be logged in password password
redirect 4 Click on Home page
ed to login should be
product button displayed after
specific login and user
ation name should be
page. displayed on
home page
5 Click on User should be
any redirected to
product product
displaye specification
d on page.
home
page
TC00 Home Verify Verify Browser 1 Open Browser should
9 Page the that should be browser be opened
details user installed
on Home profile Internet
page section connectio
2 Open url Ecommerce
is n should
website should
present be present be opened
on User
3 Enter user should be
home should be
usernam able to input
page. logged in
e and username and
password password
4 Click on Home page
login should be
button displayed after
login and user
name should be
displayed on
home page
5 Click on User profile
user should be
name displayed.
displaye
d on
home
page.
TC00 Home Verify Verify Browser 1 Open Browser should
10 Page the that should be browser be opened
details product installed
on Home s Internet
page display connectio
2 Open url Ecommerce
ed on n should
website should
home be present
be opened
page User
3 Enter user should be
are should be
usernam able to input
categor logged in
e and username and
ised.
password password
4 Click on Used should be
logged in and home
login
page should be
button displayed, products
should categorised.
SEARCH FUNTIONALTY
Test Module Test Test Pre- Test Data Step Test Step Expected Result Actual Status Defect
Cas Name Scenario Case requisites No. Result id
e ID
TC0 Product Verify Verify Browser Username- 1 Open Browser should be
01 Search the that should be Username browser opened
product search installed Password- 2 Open url Ecommerce website
search field Internet password should be opened
functiona accepts connection 3 Enter user should be able
lity alphabets should be username to input username
, present and and password
numbers User password
or should be 4 Click on Home page should
symbols. logged in login button be displayed after
login
5 Click on Search field should
search field. accepts alphabets,
numbers or
symbols.
TC0 Product Verify Verify Browser 1 Open Browser should be
02 Search the that after should be browser opened
product entering installed 2 Open url Ecommerce website
search search Internet should be opened
functiona text and connection 3 Enter user should be able
lity clicking should be username to input username
on present and and password
search User password
icon, the should be 4 Click on Home page should
search logged in login button be displayed after
should login and user name
be should be displayed
performe on home page
d. 5 Enter search Search should be
text in performed
search field according to search
and click on text provided by
search icon. user.
TC0 Product Verify Verify Browser 1 Open Browser should be
03 Search the that the should be browser opened
product search installed 2 Open url Ecommerce website
search results Internet should be opened
functiona should connection 3 Enter user should be able
lity be as per should be username to input username
the present and and password
search User password
query. should be 4 Click on Home page should
logged in login button be displayed after
login and user name
should be displayed
on home page
5 Enter search Search should be
text in performed
search field according to search
and click on text provided by
search icon. user.
TC0 Product Verify Verify Browser 1 Open Browser should be
04 Search the that user should be browser opened
product should installed 2 Open url Ecommerce website
search be able Internet should be opened
functiona to search connection 3 Enter user should be able
lity based on should be username to input username
product present and and password
name,bra User password
nd name should be
4 Click on User should be
or logged in
login button logged in and
product
Search functionality
specifica is present on home
tion. page.
5 Enter search User should be able
text in to perform search
search field bases on product
and click on name, brand name
search icon. or product
specification.
TC0 Product Verify Verify Browser 1 Open Browser should be
05 Search the that filter should be browser opened
product should installed 2 Open url Ecommerce website
search be Internet should be opened
functiona present connection 3 Enter user should be able
lity for should be username to input username
filtering present and and password
the User password
search should be 4 Click on User should be
results logged in login button logged in and home
bases on page should be
Brand, same on different
Price, browsers.
Reviews 5 Enter search Search should be
or text in performed
Ratings. search field according to search
and click on text provided by
search icon. user and filters
should be present.
TC0 Product Verify Verify Browser 1 Open Browser should be
06 Search the that should be browser opened
product sorting installed 2 Open url Ecommerce website
search options Internet should be opened
functiona should connection 3 Enter user should be able
lity be should be username to input username
present present and and password
on User password
search should be 4 Click on User should be
results logged in login button logged in and
page. alignment of
products on home
page should be
proper.
5 Enter search Search should be
text in performed
search field according to search
and click on text provided by
search icon. user and sorting
options should be
present on search
results page.
TC0 Product Verify Verify Browser 1 Open Browser should be
07 Search the that the should be browser opened
product number installed 2 Open url Ecommerce website
search of search Internet should be opened
functiona results connection 3 Enter user should be able
lity displaye should be username to input username
d on one present and and password
page. User password
should be 4 Click on Home page should
logged in login button be displayed after
login and user name
should be displayed
on home page
5 Enter search Search should be
text in performed
search field according to the
and click on search text provided
search icon. and a specific
number of results
should be displayed
on one page.
TC0 Product Verify Verify Browser 1 Open Browser should be
08 Search the that there should be browser opened
product should installed 2 Open url Ecommerce website
search be Internet should be opened
functiona navigatio connection 3 Enter user should be able
lity n should be username to input username
button(N present and and password
ext and User password
Previous should be 4 Click on Home page should
) for logged in login button be displayed after
navigatio login and user name
n to should be displayed
pages. on home page
5 Enter search Search should be
text in performed
search field according to text
and click on provided by user
search icon. and navigation
button should be
present on search
result page.
TC0 Product Verify Verify Browser 1 Open Browser should be
09 Search the that user should be browser opened
product should installed 2 Open url Ecommerce website
search be Internet should be opened
functiona perform connection 3 Enter user should be able
lity search in should be username to input username
different present and and password
categorie User password
s for should be 4 Click on Home page should
example, logged in login button be displayed after
Movies, login and user name
Books, should be displayed
Grocery on home page
etc. 5 Enter search Search should be
text in performed in
search field different categories
and click on such as movies,
search icon. books, grocery etc.
PRODUCT DETAILS
Test Module Test Test Pre- Test Data Ste Test Step Expected Result Actual Status Defec
Case Name Scenari Case requisites p Result t ID
ID o No.
5 Click on a Product
product specifications
displayed should be
on home displayed.
page.
CART PAGE
Test Module Test Test Pre- Test Data Step Test Step Expected Result Actual Statu Defec
Case Name Scenari Case requisites No. Result s t ID
ID o
TC0 Cart Verify Verify Browser Username- 1 Open Browser should be
01 Page the that should be Username browser opened
details when installed Password- 2 Open url Ecommerce website
on Cart user Internet password should be opened
Page clicks connectio 3 Enter user should be able
on add n should username to input username
to cart, be and and password
the present password
produc 4 Click on Home page should
t login be displayed after
should button login
be 5 Click on The product page
added any should be
to cart. product displayed.
displayed
on home
page
6 Click on The product should
add to be added to cart.
cart for
the
product.
TC0 Cart Verify Verify Browser 1 Open Browser should be
02 Page the that should be browser opened
details user installed 2 Open url Ecommerce website
on Cart should Internet should be opened
Page be able connectio 3 Enter user should be able
to n should username to input username
contin be and and password
ue present password
shoppi User 4 Click on Home page should
ng should be login be displayed after
after logged in button login and user name
adding should be displayed
items on home page
to cart. 5 Click on The product page
any should be
product displayed.
displayed
on home
page
6 Click on The product should
add to be added to cart and
cart for user can continue
the shopping.
product.
TC0 Cart Verify Verify Browser 1 Open Browser should be
03 Page the that should be browser opened
details item installed 2 Open url Ecommerce website
on Cart quantit Internet should be opened
Page y connectio 3 Enter user should be able
should n should username to input username
be be and and password
increas present password
ed if User 4 Click on Home page should
user should be login be displayed after
adds logged in button login and user name
same should be displayed
item in on home page
cart 5 Click on The product page
again. any should be
product displayed.
displayed
on home
page
6 Click on The product should
add to be added to cart.
cart for
the
product.
7 Click on The item quantity
add to should be increases.
cart again
for the
same
product.
TC0 Cart Verify Verify Browser 1 Open Browser should be
04 Page the that should be browser opened
details total installed
on Cart amoun Internet 2 Open url Ecommerce website
should be opened
Page t of all connectio
items n should 3 Enter user should be able
should be username to input username
and and password
be present password
display User 4 Click on User should be
ed to should be login logged in and
user. logged in button Search functionality
is present on home
page.
5 Click on The product page
any should be
product displayed.
displayed
on home
page
6 Click on The product should
add to be added to cart.
cart for
the
product.
7 Click on The total amount of
go to cart all items in cart
button. should be
displayed.
TC0 Cart Verify Verity Browser 1 Open Browser should be
05 Page the that should be browser opened
details the installed
on Cart amoun Internet 2 Open url Ecommerce website
should be opened
Page t connectio
display n should 3 Enter user should be able
ed to be username to input username
user present and and password
should User password
include should be 4 Click on User should be
the logged in login logged in and home
taxes button page should be
and same on different
shippin browsers.
g 5 Click on The product page
charge any should be
s as product displayed.
per displayed
locatio on home
n. page
6 Click on The product should
add to be added to cart.
cart for
the
product.
7 Click on The total amount
go to cart should include
button. taxes and shipping
charges.
TC0 Cart Verify Verify Browser 1 Open Browser should be
06 Page the that should be browser opened
details user installed
on Cart should Internet 2 Open url Ecommerce website
should be opened
Page not be connectio 3 Enter user should be able
able to n should username to input username
add be and and password
items present password
in cart User 4 Click on User should be
beyond should be login logged in and
a logged in button alignment of
certain products on home
limit. page should be
proper.
5 Click on The product page
any should be
product displayed.
displayed
on home
page
6 Click on The user should not
add to be allowed to add
cart for items to cart beyond
the a certain limit.
product
for many
times.
TC0 Cart Verify Verify Browser 1 Open Browser should be
07 Page the that should be browser opened
details when installed
on Cart user Internet 2 Open url Ecommerce website
Page clicks connectio should be opened
on n should 3 Enter user should be able
remov be username to input username
e from present and and password
cart User password
button should be 4 Click on Home page should
the logged in login be displayed after
item button login and user name
should should be displayed
be on home page
remov 5 Click on User should be
ed any redirected to
from product product
cart. displayed specification page.
on home
page
6 Click on The product page
any should be
product displayed.
displayed
on home
page
7 Click on The product should
add to be added to cart.
cart for
the
product.
8 Click on The item should be
remove removed form cart.
from cart
button.
TC0 Cart Verify Verify Browser 1 Open Browser should be
08 Page the that should be browser opened
details user installed
on Cart should Internet
Page be able connectio 2 Open url Ecommerce website
to n should should be opened
apply be 3 Enter user should be able
coupon present username to input username
s or User and and password
vouche should be password
rs at logged in 4 Click on Home page should
checko login be displayed after
ut button login and user name
from should be displayed
cart. on home page
5 Click on User should be
any redirected to
product product
displayed specification page.
on home
page
6 Click on The product page
any should be
product displayed.
displayed
on home
page
7 Click on The product should
add to be added to cart.
cart for
the
product.
8 Click on User should be able
go to cart to apply cupons or
button. vouchers.
TC0 Cart Verify Verify Browser 1 Open Browser should be
09 Page the that should be browser opened
details items installed
on Cart in cart Internet 2 Open url Ecommerce website
should be opened
Page should connectio
be n should 3 Enter user should be able
present be username to input username
if user present and and password
logs User password
out should be 4 Click on Home page should
and logged in login be displayed after
logs in button login and user name
again. should be displayed
on home page
5 Click on User profile should
user be displayed.
name
displayed
on home
page.
6 Click on The product page
any should be
product displayed.
displayed
on home
page
7 Click on The product should
add to be added to cart.
cart for
the
product.
8 Click on User is logged out.
Logut
button
9 Login The user should be
again logged in and the
with items shold be
same present in cart.
userid
password
Test Module Test Test Pre- Test Data Step Test Step Expected Result Actual Status Defec
Case Name Scenari Case requisites No. Result t ID
ID o
TC0 Checko Verify Verify Browser Username 1 Open Browser should be
01 ut,Paym the that should be - browser opened
ents details payme installed Username 2 Open url Ecommerce
Page on nts Internet Password- website should be
Checko options connecti password opened
ut,Paym applica on 3 Enter user should be able
ents ble for should be username to input username
Page the present and and password
order password
should
be 4 Click on Home page should
display login be displayed after
ed at button login
checko
ut.
5 Click on The product page
any should be
product displayed.
displayed
on home
page
6 Click on The product should
add to be added to cart.
cart for
the
product.
7 Click on The checkout page
Checkout should be
button. displayed with
payments options.
MY ORDER PAGE
Test Module Test Test Pre- Test Data Step Test Step Expected Result Actual Status Defec
Case Name Scenari Case requisites No. Result t ID
ID o
TC0 My Verify Verify Browser Username 1 Open Browser should be
01 Orders the that should be - browser opened
Page details user installed Username 2 Open url Ecommerce
on should Internet Password- website should be
Orders be able connecti password opened
Page to on 3 Enter user should be able
track should be username to input username
the present and and password
order password
on My 4 Click on Home page should
orders login be displayed after
page. button login
5 Click on The orders by user
My should be
orders displayed.
button
6 Click on Tracking
Track information should
order for be displayed for
a order. that order.
TC0 My Verify Verify Browser 1 Open Browser should be
02 Orders the that should be browser opened
Page details user installed 2 Open url Ecommerce
on should Internet website should be
Orders be able connecti opened
Page to on 3 Enter user should be able
change should be username to input username
the present and and password
deliver User password
y date should be 4 Click on Home page should
and logged in login be displayed after
time. button login and user
name should be
displayed on home
page
5 Click on The orders by user
My should be
orders displayed.
button
6 Click on The user should be
change provided details for
delivery selecting delivery
date and date and time.
time
button.
TC0 My Verify Verify Browser 1 Open Browser should be
03 Orders the that should be browser opened
Page details user installed 2 Open url Ecommerce
on should Internet website should be
Orders be able connecti opened
Page to on 3 Enter user should be able
cancel should be username to input username
the present and and password
order User password
should be 4 Click on Home page should
logged in login be displayed after
button login and user
name should be
displayed on home
page
5 Click on The orders by user
My should be
orders displayed.
button
6 Click on User should be able
cancel to cancel the order.
order for
an order.
TC0 My Verify Verify Browser 1 Open Browser should be
04 Orders the that should be browser opened
Page details user installed 2 Open url Ecommerce
on should Internet website should be
Orders be able connecti opened
Page to on 3 Enter user should be able
return should be username to input username
the present and and password
order User password
after should be 4 Click on User should be
deliver logged in login logged in and
y of button Search
order. functionality is
present on home
page.
5 Click on The orders by user
My should be
orders displayed.
button
6 Click on User should be
return provided with
item for pickup date and
an order. time for return.
TC0 My Verify Verify Browser 1 Open Browser should be
05 Orders the that should be browser opened
Page details user installed 2 Open url Ecommerce
on should Internet website should be
Orders be able connecti opened
Page to on 3 Enter user should be able
exchan should be username to input username
ge the present and and password
order User password
from should be 4 Click on User should be
My logged in login logged in and home
orders button page should be
page. same on different
browsers.
5 Click on The orders by user
My should be
orders displayed.
button
6 Click on User should be
exchange given details of
item for exchange item .
an order.
TC0 My Verify Verify Browser 1 Open Browser should be
06 Orders the that should be browser opened
Page details user installed 2 Open url Ecommerce
on should Internet website should be
Orders be able connecti opened
Page to on 3 Enter user should be able
provid should be username to input username
e feed present and and password
back User password
and should be 4 Click on User should be
review logged in login logged in and
s about button alignment of
the products on home
item page should be
deliver proper.
ed. 5 Click on The orders by user
My should be
orders displayed.
button
6 Click on User can write
Write review and provide
review feedback.
button
for an
item.
CUSTOMER SERVICE PAGE
Test Modul Test Test Pre- Test Data Step Test Expected Result Actual Status De
Case e Scenario Case requisites No. Step Result fe
ID Name ct
ID
TC0 Custo Verify Verify Browser Usernam 1 Open Browser should be
01 mer the that should be e- browser opened
Servic details on customer installed Usernam 2 Open Ecommerce website
e Page Custome service Internet e url should be opened
r Service options connecti Password
Page should be on - 3 Enter user should be able to
present should be password usernam input username and
on the present e and password
website. passwor
d
4 Click on Home page should be
login displayed after login
button
5 Click on Customer care page
contact is displayed.
custome
r care
button.
TC0 Custo Verify Verify Browser 1 Open Browser should be
02 mer the that should be browser opened
Servic details on different installed 2 Open Ecommerce website
e Page Custome modes of Internet url should be opened
r Service customer connecti
Page service on 3 Enter user should be able to
such as should be usernam input username and
Email, present e and password
Chat or User passwor
Call should be d
should be logged in 4 Click on Home page should be
mentione login displayed after login
d. button and user name should
be displayed on home
page
5 Click on Customer care page
contact is displayed with
custome different modes of
r care customer service
button. such as Email,chat or
call.
TC0 Custo Verify Verify Browser 1 Open Browser should be
03 mer the that should be browser opened
Servic details on waiting installed 2 Open Ecommerce website
e Page Custome time to Internet url should be opened
r Service connect connecti
Page to on 3 Enter user should be able to
customer should be usernam input username and
e and password
service present passwor
shold be User d
displayed should be
to user. logged in 4 Click on Home page should be
login displayed after login
button and user name should
be displayed on home
page
5 Click on Customer care page
contact is displayed with
custome different modes of
r care customer service
button. such as Email,chat or
call.
6 Select Waiting time is
any displayed for that
mode of customer service.
custome
r
service.
TC0 Custo Verify Verify Browser 1 Open Browser should be
04 mer the that should be browser opened
Servic details on customer installed 2 Open Ecommerce website
e Page Custome service Internet url should be opened
r Service should be connecti
Page available on 3 Enter user should be able to
in should be usernam input username and
different present e and password
language User passwor
s. should be d
logged in 4 Click on User should be
login logged in and Search
button functionality is
present on home
page.
5 Click on Customer care page
contact is displayed with
custome different available
r care languages.
button.
TC0 Custo Verify Verify Browser 1 Open Browser should be
05 mer the that the should be browser opened
Servic details on timings installed 2 Open Ecommerce website
e Page Custome of Internet url should be opened
r Service customer connecti
Page service on 3 Enter user should be able to
option should be usernam input username and
should be present e and password
displayed User passwor
to user. should be d
logged in 4 Click on User should be
login logged in and home
button page should be same
on different browsers.
5 Click on Customer care page
contact is displayed with
custome timings of different
r care modes of customer
button. care.
RESULT:
EX NO : 4 DEVELOP THE TEST PLAN AND DESIGN THE TEST CASES FOR
AIM:
Validate that the Inventory Control System meets the functional requirements.
Verify the accuracy and consistency of inventory tracking.
Assess system performance under varying loads.
Ensure the system's security mechanisms are effective.
Evaluate the system's usability and user-friendliness.
3. Test Scope
The testing will cover the following aspects of the Inventory Control System:
5. Test Data
Test data will include a range of products, quantities, prices, and suppliers.
Both normal and boundary test cases will be created to cover various scenarios.
Data will be structured to validate different calculations and reports.
6. Test Cases
A comprehensive list of test cases will be created for functional, performance, security, and usability testing.
Each test case will include:
Test case ID
Description of the scenario
Preconditions
Steps to execute the test
Expected results
Actual results
Pass/fail status
7. Types of Testing
8. Test Schedule
Testing Phases and Estimated Timeline:
Unit Testing: 1 week
Integration Testing: 2 weeks
Functional Testing: 2 weeks
Performance Testing: 1 week
Security Testing: 1 week
Usability Testing: 1 week
9. Defect Management
14. Approval
This test plan requires approval from relevant stakeholders before testing commences.
15. Appendix
Glossary of terms
References used in the test plan
TEST CASES FOR INVENTORY MANAGEMENT SYSTEM
RESULT:
EX NO: 5 EXECUTE THE TEST CASES AGAINST A CLIENT SERVER OR
DESKTOP APPLICATION AND IDENTIFY THE DEFECTS.
AIM:
Program:
1. html:
<html>
<head>
<title>JavascriptLoginFormValidation</title>
<!--IncludeCSSFileHere-->
<linkrel="stylesheet"href="form-style.css"/>
<!--IncludeJSFileHere -->
<scriptsrc="login.js"></script>
</head>
<body>
<divclass="container">
<divclass="main">
<h2>JavascriptLoginFormValidation</h2>
<formid="form_id"method="post"name="myform">
<label>UserName:</label>
<inputtype="text"name="username"id="username"/>
<label>Password:</label>
<inputtype="password"name="password"id="password"/>
<inputtype="button"value="Login"id="submit"onclick="validate()"/>
</form>
<span><bclass="note">Note:</b>For this demousefollowingusernameand password.
<br/><bclass="valid">UserName: Form<br/>Password:123</b></span>
</div>
</div>
</body>
</html>
login.js:
varattempt =3; //Variable tocount numberofattempts.
//BelowfunctionExecutesonclickofloginbutton.functio
nvalidate(){ varusername=document.getElementById("username")
.value;varp
assword=document.getElementById("password").value;
if(username=="Form"&&password=="123"){alert("
Login successfully");
window.location="success.html";//Redirectingtootherpage.returnf
alse;
}
else{
attempt --; // Decrementing by one.
Ialert("Youhaveleft"+attempt+"attempt;");
// Disabling fields after 3
attempts.if(attempt ==0){
document.getElementById("username").disabled=true;doc
ument.getElementById("password").disabled =
true;document.getElementById("submit").disabled =
true;returnfalse;
}
}
}
success.html:
<html>
<head>
<title>JavascriptLoginFormValidation</title>
</head>
<body>
<h2>SuccessfulLogin!</h2>
</body>
</html>
RESULT:
Ex.No:6 TEST THE PERFORMANCE OF THE E-COMMERCE APPLICATION
AIM:
E-Commerce applications are designed in such a way that customers can easily make purchases at any
time of the day, irrespective of where they are located. If an eCommerce application malfunctions
during peak hours, not only will it cause customer dissatisfaction, but it will also lead to revenue loss
for the business.
To avoid such situations, companies can invest in performance testing of eCommerce applications
that focuses on issues related to speed, stability, and scalability. Hence, in the wake of increasing
demand for online shopping, it is necessary to do performance testing of the eCommerce application
and toensure that the application is stable and scalable enough to serve all customer requirements.
Reduce Risks: Many times, making major and considerable changes to a site can cause
notable strategic changes or even trigger significant losses. However, testing these changes
in a planned manner can help eliminate the chances of these uncertain revenue losses
.
Increase Conversion Rates: By testing every aspect of an application and ensuring a smooth
visitor experience through site optimization, the application conversion rate is bound to increase.
Improve User Engagement: Testing tells which page element or process affects a user’s onsite
journey and helps in rectifying the issues faster. The better the user experience, the greater the
onsite engagement.
Coupon codes or gift vouchers are provided to increase product sales and performance tests
ensure that coupon codes work well when applied to users in bulk.
Multiple systems like email servers, social network sites, and enterprise content management
systems are involved in the backend and the performance test ensures flawless functioning of
various features like product images/videos, and social media in such an integrated system.
eCommerce applications usually have more users than any other application and validation of
users is a must to filter out genuine customers. Performance test helps in validating multiple
sign-up and invoice email notifications in parallel.
Chatbots interact with online shoppers to improve the user experience, and any delay in
providing the required information may switch users to a competitor's application.
Performance tests speed up chatbots to answer customer queries.
Reviews are very important to increase the sale of a product. The majority of users prefer
visiting the review listing page to get instant user feedback. Performance test helps in
optimizing customer review listing load time.
eCommerce applications attract the maximum number of customers during annual sales
events. Backend servers should be set with the optimal settings, keeping future users’ traffic
in mind. Performance tests help in identifying the servers’ optimum locations to manage
a higher number of users.
Faster Integrated Systems Communication: Multiple systems like email servers, social media
accounts, and payment channels are involved in the functioning of an
eCommerce application to ensure that integrated systems work well under a heavy load
.
System Scaling: Brands cannot predict user load during peak hours, hence, the need of the
hour is to be ready with tested scalable systems.
Immoderate Scripts: Few eCommerce applications are associated with third-party scripts
that are running in the background like Google Analytics and Ads, and these widgets
can be a significant contributor to page load time.
Slow Servers: Server resources and applications should be optimized to deliver content as
quickly as possible after addressing any content-related performance issues.
Massive Media: Oftentimes, images, videos, and other media are uploaded by
non-technical employees that aren't familiar with the impact of loaded heavy files.
It's important to ensure these assets are optimized to maximize performance
Testing Payment Gateway Integration: Failed transactions are one of the main reasons
why most customers exit an application without completing the purchase.
So it's important to ensure the proper functioning of payment gateways.
Product Details Page: A fast product listing is important because every consumer will be
attracted to the product by how it's presented and how it's visible to them.
Role of QASource
Testing experts at QASource have years of experience in running performance tests on a wide range
of domains including eCommerce, media streaming, legal, human resources, eLearning, healthcare
, enterprise content management, financial, and many more. QASource assists teams in setting
up the performance test lab and identifying the best-fit performance test scenarios to ensure the
best user experience. Following are our high-level performance testing services to meet the performance
test requirement:
Performance test plan
Test data setup
Simulation of test cases
Generate performance test suite results
Identify bottlenecks and follow up with the Dev team to fix them
Generate daily status reports
Conclusion
Performance testing of eCommerce applications is a crucial part of any business's success.
It helps eCommerce applications generate better user experience, safeguard user data security, and
ensure mobile responsiveness, security, and a quick load time. It is vital to conduct quick and
effective application performance testing from time to time to ensure that the application is
offering an exceptional customer experience to maximize revenue for businesses
RESULT:
EX NO: 7 AUTOMATE THE TESTING OF E-COMMERCE APPPLICATIONS
USING SELEINIUM
AIM:
Positive Scenario
Steps to Automate:
1. Open this URL http://automationpractice.com/index.php
2. Click on the sign-in link.
3. Enter your email address in the 'Create and Account' section.
4. Click on Create an Account button.
5. Enter your Personal Information, Address, and Contact info.
6. Click on the Register button.
7. Validate that the user is created.
import java.util.concurrent.TimeUnit;
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;
import io.github.bonigarcia.wdm.WebDriverManager;
public class EcomSignUp {
public static void main(String[] args)
{ WebDriverManager.chromedriver().setup
();WebDriver driver=new ChromeDriver();
String URL="http://automationpractice.com/index.php";
driver.get(URL);
driver.manage().timeouts().implicitlyWait(2000, TimeUnit.MILLISECONDS);
driver.manage().window().maximize();
//Click on Sign in
driver.findElement(By.linkText("Sign in")).click();
//Enter email address
driver.findElement(By.cssSelector("[name='email_create']")).sendKeys("[email protected]");
//Click on "Create an account"
driver.findElement(By.xpath("//button[@name=\"SubmitCreate\"]")).click();
//Select Title
driver.findElement(By.xpath("//input[@id=\"id_gender1\"]")).click();
driver.findElement(By.name("customer_firstname")).sendKeys("Test User");
driver.findElement(By.name("customer_lastname")).sendKeys("Vsoft");
driver.findElement(By.id("passwd")).sendKeys("PKR@PKR");
// Enter your address
driver.findElement(By.id("firstname")).sendKeys("Test User");
driver.findElement(By.id("lastname")).sendKeys("Vsoft");
driver.findElement(By.id("company")).sendKeys("Vsoft");
driver.findElement(By.id("address1")).sendKeys("Test 81/1,2nd cross");
driver.findElement(By.id("city")).sendKeys("XYZ");
// Select State
WebElement statedropdown=driver.findElement(By.name("id_state"));
Select oSelect=new Select(statedropdown);
oSelect.selectByValue("4");
driver.findElement(By.name("postcode")).sendKeys("51838");
// Select Country
WebElement countrydropDown=driver.findElement(By.name("id_country"));
Select oSelectC=new Select(countrydropDown);
oSelectC.selectByVisibleText("United States");
//Enter Mobile Number
driver.findElement(By.id("phone_mobile")).sendKeys("234567890");
driver.findElement(By.xpath("//input[@name=\"alias\"]")).clear();
driver.findElement(By.xpath("//input[@name=\"alias\"]")).sendKeys("Office");
driver.findElement(By.name("submitAccount")).click();
String userText=driver.findElement(By.xpath("//*[@id=\"header\"]/div[2]/div/div/nav/div[1]/a")).getText();
// Validate that user has created
if(userText.contains("Vsoft"))
{ System.out.println("User Verified,Test case
Passed");
}
else {
System.out.println("User Verification Failed,Test case Failed");
}
}}
Negative Scenarios
Steps to Automate:
1. Open this URL http://automationpractice.com/index.php
2. Click on the sign-in link.
3. Enter your email address and click the Register button.
4. Leave the mandatory fields (marked with *) blank and click the Register button.
5. Verify that an error has been displayed for the mandatory fields.
4. Test Case - Verify error messages for entering incorrect values in fields.
Steps to Automate:
1. Open this URL http://automationpractice.com/index.php
2. Click on the sign-in link.
3. Enter your email address and click the Register button.
4. Enter incorrect values in fields like., enter numbers in first and last name, city field, etc., and enter
alphabets in Mobile no, Zip postal code, etc., and click on the 'Register' button.
5. Verify that error messages for respective fields are displaying.
Try automating the above scenarios using Selenium commands, if you face any difficulty please refer to the
Selenium Tutorial series.
5. Automate the 'Search Product' feature of Amazon like e-commerce website with Selenium
1. Test Case - Automate the 'Search Product' feature of the e-commerce website with Selenium.
Steps to Automate:
1. Open link http://automationpractice.com/index.php
2. Move your cursor over the Women's link.
3. Click on the sub-menu 'T-shirts'
4. Get the Name/Text of the first product displayed on the page.
5. Now enter the same product name in the search bar present at the top of the page and click the search
button.
6. Validate that the same product is displayed on the searched page with the same details which were
displayed on T-Shirt's page.
Automation Code for Product Search:
import java.util.concurrent.TimeUnit;
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.interactions.Actions;
import io.github.bonigarcia.wdm.WebDriverManager;
public class EcomPractice2 {
public static void main(String[] args) throws
InterruptedException{WebDriverManager.chromedriver().setup();
WebDriver driver=new ChromeDriver();
String URL="http://automationpractice.com/index.php";
driver.get(URL);
driver.manage().window().maximize();
// Initialise Actions class object
Actions actions=new Actions(driver);
driver.manage().timeouts().implicitlyWait(2000, TimeUnit.MILLISECONDS);
WebElement womenTab=driver.findElement(By.linkText("WOMEN"));
WebElement
TshirtTab=driver.findElement(By.xpath("//div[@id='block_top_menu']/ul/li[1]/ul/li[1]/ul//a[@title='T-
shirts']"));
actions.moveToElement(womenTab).moveToElement(TshirtTab).click().perform();
Thread.sleep(2000);
// Get Product Name
String
ProductName=driver.findElement(By.xpath("/html[1]/body[1]/div[1]/div[2]/div[1]/div[3]/div[2]/ul[1]/li[1]/di
v[1]/div[2]/h5[1]/a[1]")).getText();
System.out.println(ProductName);
driver.findElement(By.id("search_query_top")).sendKeys(ProductName);
driver.findElement(By.name("submit_search")).click();
// Get Name of Searched Product
String
SearchResultProductname=driver.findElement(By.xpath("/html[1]/body[1]/div[1]/div[2]/div[1]/div[3]/div[2]/
ul[1]/li[1]/div[1]/div[2]/h5[1]/a[1]")).getText();
// Verify that correct Product is displaying after search
if(ProductName.equalsIgnoreCase(SearchResultProductname))
{System.out.println("Results Matched;Test Case Passed");
}else{
System.out.println("Results NotMatched;Test Case Failed");
}
// Close the browser
driver.close();
}
}
6. Automate the 'Buy Product' feature of Amazon like an e-commerce website with Selenium
The most important function of an e-commerce website is buying a product, which includes various steps
like selecting a product, selecting size/color, adding to the cart, checkout, etc. You will find every test
scenario along with the automation code in the following section.
1. Test Case - Automate the end-to-end "Buy Product" feature of the e-commerce website.
Steps to Automate:
1. Open link http://automationpractice.com/index.php
2. log in to the website.
3. Move your cursor over the Women's link.
4. Click on the sub-menu 'T-shirts'.
5. Mouse hover on the second product displayed.
6. 'More' button will be displayed, click on the 'More' button.
7. Increase quantity to 2.
8. Select size 'L'
9. Select color.
10. Click the 'Add to Cart' button.
11. Click the 'Proceed to checkout' button.
12. Complete the buy order process till payment.
13. Make sure that the Product is ordered.
import java.util.concurrent.TimeUnit;
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.interactions.Actions;
import org.openqa.selenium.support.ui.Select;
import io.github.bonigarcia.wdm.WebDriverManager;
public class EcomExpert {
public static void main(String[]
args){ WebDriverManager.chromedriver().
setup();WebDriver driver=new
ChromeDriver();
String URL="http://automationpractice.com/index.php";
}
}
2. Test Case - Verify that 'Add to Wishlist' only works after login.
Steps to Automate:
1. Open link http://automationpractice.com/index.php
2. Move your cursor over the Women's link.
3. Click on the sub-menu 'T-shirts'.
4. Mouse hover on the second product displayed.
5. 'Add to Wishlist' will appear on the bottom of that product, click on it.
6. Verify that the error message is displayed 'You must be logged in to manage your wish list.'
3. Test Case - Verify that Total Price is reflecting correctly if the user changes quantity on the
'Shopping Cart Summary' Page.
Steps to Automate:
1. Open link http://automationpractice.com/index.php
2. Log in to the website.
3. Move your cursor over the Women's link.
4. Click on the sub-menu 'T-shirts'.
5. Mouse hover on the second product displayed.
6. 'More' button will be displayed, click on the 'More' button.
7. Make sure the quantity is set to 1.
8. Select size 'M'
9. Select the color of your choice.
10. Click the 'Add to Cart' button.
11. Click the 'Proceed to checkout' button.
12. Change the quantity to 2.
13. Verify that the Total price is changing and reflecting the correct price.
RESULT:
EX.NO:8 INTEGRATE TestNG WITH THE ABOVE TEST AUTOMATION
AIM:
TestNG is a powerful testing framework, an enhanced version of JUnit which was in use for a long time
before TestNG came into existence. NG stands for 'Next Generation'.
Step 4 − Click 'Select All' and 'TestNG' would be selected as shown in the figure.
Step 9 − Security Warning pops up as the validity of the software cannot be established. Click 'Ok'.
Step 10 − The Installer prompts to restart Eclipse for the changes to take effect. Click 'Yes'.
TestNG-Eclipse Setup
Step 1 − Launch Eclipse and create a 'New Java Project' as shown below.
Step 2 − Enter the project name and click 'Next'.
Step 3 − Navigate to "Libraries" Tab and Add the Selenium Remote Control Server JAR file by clicking on
"Add External JAR's" as shown below.
Step 4 − The added JAR file is shown here. Click 'Add Library'.
Step 5 − The 'Add Library' dialog opens. Select 'TestNG' and click 'Next' in the 'Add Library' dialog box.
Step 6 − The added 'TestNG' Library is added and it is displayed as shown below.
Step 7 − Upon creating the project, the structure of the project would be as shown below.
Step 8 − Right-click on 'src' folder and select New >> Other.
Step 9 − Select 'TestNG' and click 'Next'.
RESULT:
EXNO : 9 DEVELOP A MINI PROJECT
AIM:
The Page Object model is an object design pattern in Selenium, where web pages are represented a classes,
the various elements on the page are defined as variables in the class and all possible user interaction can
then be implemented as methods in the class.
Cucumber:
Cucumber is one such open-source tool, which supports Behavior Driven Development(BDD). In simple
words, Cucumber can be defined as a testing framework, driven by plain English. It serves as documentation,
automated tests, and development aid – all in one.Dependency List
Double-click on the resources directory and a new source directory under your new Maven project is
created as shown in the below image.
Step 6 – Add Selenium, TestNG, and Cucumber dependencies to the project
Add below mentioned Selenium, TestNG, and Cucumber dependencies to the project. I have added
WebDriverManager dependency to the POM.xml to download the driver binaries automatically. To know
more about this,
please refer to this tutorial – How to manage driver executables using WebDriverManager.
1 <properties>
2 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3 <cucumber.version>7.14.0</cucumber.version>
4 <selenium.version>4.14.0</selenium.version>
5 <webdrivermanager.version>5.5.3</webdrivermanager.version>
6 <testng.version>7.8.0</testng.version>
7 <apache.common.version>2.4</apache.common.version>
8 <maven.compiler.plugin.version>3.11.0</maven.compiler.plugin.version>
9 <maven.surefire.plugin.version>3.1.2</maven.surefire.plugin.version>
10 <maven.compiler.source.version>11</maven.compiler.source.version>
11 <maven.compiler.target.version>11</maven.compiler.target.version>
12 </properties>
13
14 <dependencies>
15
16 <dependency>
17 <groupId>io.cucumber</groupId>
18 <artifactId>cucumber-java</artifactId>
19 <version>${cucumber.version}</version>
20 </dependency>
21
22 <dependency>
23 <groupId>io.cucumber</groupId>
24 <artifactId>cucumber-testng</artifactId>
25 <version>${cucumber.version}</version>
26 <scope>test</scope>
27 </dependency>
28
29 <!-- Selenium -->
30 <dependency>
31 <groupId>org.seleniumhq.selenium</groupId>
32 <artifactId>selenium-java</artifactId>
33 <version>${selenium.version}</version>
34 </dependency>
35
36 <!-- Web Driver Manager -->
37 <dependency>
38 <groupId>io.github.bonigarcia</groupId>
39 <artifactId>webdrivermanager</artifactId>
40 <version>${webdrivermanager.version}</version>
41 </dependency>
42
43 <!-- TestNG -->
44 <dependency>
45 <groupId>org.testng</groupId>
46 <artifactId>testng</artifactId>
47 <version>${testng.version}</version>
48 <scope>test</scope>
49 </dependency>
50
51 <!-- Apache Common -->
52 <dependency>
53 <groupId>org.apache.directory.studio</groupId>
54 <artifactId>org.apache.commons.io</artifactId>
55 <version>${apache.common.version}</version>
56 </dependency>
57
58 </dependencies>
Step 7 – Add Maven Compiler Plugin and Surefire Plugin
The compiler plugin is used to compile the source code of a Maven project. This plugin has two goals,
Below is an example of Test Scenarios in the feature file. I have failed one test scenario intentionally –
@MissingUsername.
1 Feature: Login to HRM Application
2
3 Background:
4 Given User is on HRMLogin page "https://opensource-demo.orangehrmlive.com/"
5
6 @ValidCredentials
7 Scenario: Login with valid credentials
8
9 When User enters username as "Admin" and password as "admin123"
10 Then User should be able to login successfully and new page open
11
12 @InvalidCredentials
13 Scenario Outline: Login with invalid credentials
14
15 When User enters username as "<username>" and password as "<password>"
16 Then User should be able to see error message "<errorMessage>"
17
18 Examples:
19 | username | password | errorMessage |
20 | Admin | admin12$$ | Invalid credentials |
21 | admin$$ | admin123 | Invalid credentials |
22 | abc123 | xyz$$ | Invalid credentials |
23
24
25 @MissingUsername
26 Scenario Outline: Login with blank username
27
28 When User enters username as " " and password as "admin123"
29 Then User should be able to see a message "Required1" below Username
Step 9 – Create the classes for locators, actions, and utilities in src/main/java
Create folders – actions, locators, and utils in src/main/java.
Create a Java Class for each page where define WebElements as variables using Annotation @FindBy.
Create another Java class that contains methods for actions performed on WebElements. Here, I’m going
to create 2 classes for locators – LoginPageLocators and HomePageLocators as well as 2 classes
for actions – LoginPageActions and HomePageActions
The Locator class contains WebElements which are identified by @FindBy annotation as shown below:-
1 @FindBy(name = "txtUsername")
2 WebElement userName;
Action class contains methods for the action to be performed on the web elements identified in the locator
class.
The initElements is a static method of PageFactory class that is used to initialize all the web elements
located by @FindBy annotation. Only after the WebElements are initialized, they can be used in
the methods to perform actions.
1 public Login(WebDriver driver) {
2 this.driver = driver;
3 // This initElements method will create all WebElements
4 PageFactory.initElements(driver, this);
5 }
Below is the sample code of the LoginPageLocators.
1 import org.openqa.selenium.WebElement;
2 import org.openqa.selenium.support.FindBy;
3
4 public class LoginPageLocators
{5
6 @FindBy(name = "username")
7 public WebElement userName;
8
9 @FindBy(name = "password")
10 public WebElement password;
11
12 @FindBy(xpath = "//*[@id='app']/div[1]/div/div[1]/div/div[2]/div[2]/form/div[1]/div/span")
13 public WebElement missingUsernameErrorMessage;
14
15 @FindBy(xpath = "//*[@id='app']/div[1]/div/div[1]/div/div[2]/div[2]/form/div[3]/button")
16 public WebElement login;
17
18 @FindBy(xpath = "//*[@id='app']/div[1]/div/div[1]/div/div[2]/div[2]/div/div[1]/div[1]/p")
19 public WebElement errorMessage;
20
21 }
Below is the sample code for the HomePageLocators.
1 import org.openqa.selenium.WebElement;
2 import org.openqa.selenium.support.FindBy;
3
4 public class HomePageLocators
{5
6 @FindBy(xpath = "//span[@class='oxd-topbar-header-breadcrumb']/h6")
7 public WebElement homePageUserName;
8
9 }
Create the action classes for each web page. These action classes contain all the methods needed by the
step definitions. In this case, I have created 2 action classes – LoginPageActions, HomePageActions
LoginPageActions
1 import org.example.locators.LoginPageLocators;
2 import org.example.utils.HelperClass;
3 import org.openqa.selenium.support.PageFactory;
4
5 public class LoginPageActions
{6
7 LoginPageLocators loginPageLocators = null;
8
9 public LoginPageActions()
{10
11 this.loginPageLocators = new LoginPageLocators();
12
13 PageFactory.initElements(HelperClass.getDriver(),loginPageLocators);
14 }
15
16 // Get the error message when username is blank
17 public String getMissingUsernameText() {
18 return loginPageLocators.missingUsernameErrorMessage.getText();19
}
20
21 // Get the Error Message
22 public String getErrorMessage() {
23 return loginPageLocators.errorMessage.getText();24
}
25
26 public void login(String strUserName, String strPassword)
{27
28 // Fill user name
29 loginPageLocators.userName.sendKeys(strUserName);
30
31 // Fill password
32 loginPageLocators.password.sendKeys(strPassword);
33
34 // Click Login button
35 loginPageLocators.login.click();
36
37 }
HomePageActions
1 import org.example.locators.HomePageLocators;
2 import org.example.utils.HelperClass;
3 import org.openqa.selenium.support.PageFactory;
4
5 public class HomePageActions
{6
7 HomePageLocators homePageLocators = null;
8
9 public HomePageActions()
{10
11 this.homePageLocators = new HomePageLocators();
12 PageFactory.initElements(HelperClass.getDriver(),homePageLocators); 13
}
14
15 // Get the User name from Home Page
16 public String getHomePageText() {
17 return homePageLocators.homePageUserName.getText();18
}
19
20 }
Create a Helper class where we are initializing the web driver, initializing the web driver wait,
defining the timeouts, and creating a private constructor of the class, it will declare the web driver, so
whenever we create an object of this class, a new web browser is invoked.
1 package com.example.utils;
2
3 import java.time.Duration;
4 import org.openqa.selenium.WebDriver;
5 import org.openqa.selenium.chrome.ChromeDriver;
6 import io.github.bonigarcia.wdm.WebDriverManager;
7 import org.openqa.selenium.chrome.ChromeOptions;
8
9 public class HelperClass
{10
11 private static HelperClass helperClass;
12
13 private static WebDriver driver;
14 public final static int TIMEOUT = 5;
15
16 private HelperClass()
{17
18 WebDriverManager.chromedriver().setup();
19 ChromeOptions options = new ChromeOptions();
20 options.addArguments("--start-maximized");
21 driver = new ChromeDriver(options);
22 driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(TIMEOUT));
23 }
24
25 public static void openPage(String url) {
26 driver.get(url);27
}
28
29 public static WebDriver getDriver() {
30 return driver;31
}
32
33 public static void setUpDriver()
{34
35 if (helperClass==null)
{36
37 helperClass = new HelperClass();
38 }
39 }
40
41 public static void tearDown() {
42
43 if(driver!=null)
44 {driver.close()
45 ;driver.quit();
46 }
47
48 helperClass = null;
49 }
50
51 }
Step 10 – Create a StepDefinition class in src/test/java
Create a Java Class called Definition where we will create the Test Code related to the Given, When
, Then of Feature file in src/test/java.
Now, we need to create the Step Definition of the Feature File – LoginPageDefinitions.java.
1 import io.cucumber.java.en.Given;
2 import io.cucumber.java.en.Then;
3 import io.cucumber.java.en.When;
4 import org.example.actions.HomePageActions;
5 import org.example.actions.LoginPageActions;
6 import org.example.utils.HelperClass;
7 import org.testng.Assert;
8
9 public class LoginPageDefinitions
{10
11 LoginPageActions objLogin = new LoginPageActions();
12 HomePageActions objHomePage = new HomePageActions();
13
14 @Given("User is on HRMLogin page {string}")
15 public void loginTest(String url)
{16
17 HelperClass.openPage(url);
18
19 }
20
21 @When("User enters username as {string} and password as {string}")
22 public void goToHomePage(String userName, String passWord)
{23
24 // login to application
25 objLogin.login(userName, passWord);
26
27 // go the next page
28
29 }
30
31 @Then("User should be able to login successfully and new page open")
32 public void verifyLogin()
{33
34 // Verify home page
35 Assert.assertTrue(objHomePage.getHomePageText().contains("Dashboard"));
36
37 }
38
39 @Then("User should be able to see error message {string}")
40 public void verifyErrorMessage(String expectedErrorMessage)
{41
42 // Verify error message
43 Assert.assertEquals(objLogin.getErrorMessage(),expectedErrorMessage);
44
45 }
46
47 @Then("User should be able to see a message {string} below Username")
48 public void verifyMissingUsernameMessage(String message) {
49
50 Assert.assertEquals(objLogin.getMissingUsernameText(),message);
51 }
52
53 }
Step 11 – Create a Hook class in src/test/java
Create the hook class that contains the Before and After hook to initialize the web browser and
close the web browser. I have added the code to take the screenshot of the failed scenario in
@After Hook.
In the above example, as we can see, one of the tests has failed. So, when a test fails, we have written
the code to take a screenshot of the failed step. The Attached Image shows the image of the failed
test. You can click on that to see the screenshot.
Step 17 – TestNG Report Generation
TestNG generates various types of reports under the target->surefire-reports folder like emailable-
report.html, index.html, testng-results.xml.
We are interested in the “emailable-report.html” report. Open “emailable-report.html“, as this is an HTML
report, and open it with the browser. The below image shows emailable-report.html.
emailable-report.html
Index.html
TestNG also produces an “index.html” report. The below image shows the index.html report.
RESULT: