0% found this document useful (0 votes)
16 views74 pages

Software Testing Lab Record - IT Department

The document is a lab record for the Software Testing and Automation course at SRI Shanmugha College of Engineering and Technology for the academic year 2023-2024. It outlines the vision and mission of the institute and department, program outcomes, educational objectives, and specific objectives related to Information Technology. Additionally, it includes a detailed table of contents and various test plans and cases for e-commerce applications, focusing on aspects such as functionality, performance, security, and user experience.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views74 pages

Software Testing Lab Record - IT Department

The document is a lab record for the Software Testing and Automation course at SRI Shanmugha College of Engineering and Technology for the academic year 2023-2024. It outlines the vision and mission of the institute and department, program outcomes, educational objectives, and specific objectives related to Information Technology. Additionally, it includes a detailed table of contents and various test plans and cases for e-commerce applications, focusing on aspects such as functionality, performance, security, and user experience.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SRI SHANMUGHA COLLEGE OF ENGINEERING AND TECHNOLOGY

(An Autonomous Institution)


Pullipalayam, Morur (Po.), Sankari (Tk.), Salem (Dt.) - 637 304.

DEPARTMENT OF INFORMATION TECHNOLOGY

ACADEMIC YEAR: 2023-2024

ODD SEMESTER

LAB RECORD

(REGULATION-2021)

CCS366– SOFTWARE TESTING AND AUTOMATION

NAME:

REGISTER NUMBER:

YEAR / SEMESTER:

BRANCH:
SRI SHANMUGHA COLLEGE OF ENGINEERING AND TECHNOLOGY
(An Autonomous Institution)
Pullipalayam, Morur (Po.), Sankari (Tk.), Salem (Dt.) - 637 304.

RECORD NOTE BOOK

REGISTER NUMBER : ……………………………………………

Certified that this is a Bonafide observation of Practical work done by Mr. /Ms. ........................................

of the ............................................ Semester ……………………………………….. Branch during the

Academic year ….......................................... in the………………………………………………

Laboratory.

Submitted for the University Practical Examination held on………………………..

STAFF-IN-CHARGE HEAD OF THE DEPARTMENT

INTERNAL EXAMINER EXTERNAL EXAMINER


Vision and Mission of the Institute

VISION
To be an institute of repute in all fields of education by implementing the best
practices akin to global standards for fostering domain knowledge and
developing research attitude among students to make them globally
competent.
MISSION
• Achieving excellence in Teaching & Learning process using state-of-the-art resources.
• Extending opportunity to upgrade faculty knowledge and skills.
• Implementing the best student training practices for requirements of industrial scenario
of the state.
• Motivating faculty and students in research activity for real time application.

Vision and Mission of the Department

VISION
To create a conducive environment for the development of academic and
innovative technocrats employable at the global level, socially responsible
and professionally competent to sustain the challenges
MISSION
M1: To develop competent and quality IT professionals by imparting state-of the art
technology learning methodologies.
M2: To promote Industry – Institution relationships among the students to become more
employable and better citizens to solve societal issues.
M3: To constantly upgrade the Faculty qualification with cutting edge technology to
achieve high status in technical and research areas.
PROGRAMME OUTCOMES
The UG program in Information Technology will prepare students to attain:
the knowledge
PO1 Engineering
ofknowledge:
mathematics,
Apply
science,
engineering fundamentals and an engineering specialization to the solution of complex
engineering problems.
PO2 Problem analysis: Identify, formulate, review research literature, and analyze
complex engineering problems reaching substantiated conclusions using first principles
of mathematics, natural sciences and engineering sciences.
PO3 Design/development of solutions: Design solutions for complex engineering
problems and design system components or processes that meet the specified needs with
societal and consideration for the public health, safety, cultural,
appropriate
environmental considerations.
PO4 Conduct investigations of complex problems: Use research-based

knowledge and
research methods including design of experiments, analysis, and interpretation
of data and
synthesis of the information to provide valid conclusions. PO5 Modern tool
usage: Create, select, apply appropriate techniques, resources, modern
engineering and IT tools including prediction and modeling to complex
engineering
activities with an understanding of the limitations. PO6 The engineer and
society: Apply reasoning informed by the contextual knowledge
to assess societal, health, safety, legal, cultural issues and the consequent
responsibilities
relevant to the professional engineering practice. PO7 Environment and
sustainability: Understand the impact of the professional
engineering solutions in societal, environmental contexts, demonstrate the
knowledge and
need for sustainable development. PO8 Ethics: Apply ethical principles, commit
to professional ethics, responsibilities and
norms of the engineering practice.
PO9 Individual and team work: Function effectively as an individual, as a

member or
leader in diverse teams and in multidisciplinary settings.
PO10 Communication: Communicate effectively on complex engineering

activities
with the engineering
comprehend, write community with society at large being able to
effective reports, design documentation, make effective presentations and
receive clear
instructions.
PO11 Project management and finance: Demonstrate knowledge, understanding

of the
PROGRAM EDUCATIONAL OBJECTIVES (PEO)

PEO 1: To ensure graduates will be proficient and core competent by utilizing the
fundamental knowledge of Basic Sciences, Engineering, Mathematics and Information
Technology for the applications of various Engineering and Technology disciplines.

PEO 2: To enable graduates to think logically and will have the capacity to understand the social,
business, environmental based hardware and software issues by designing optimal solutions
through lifelong learning.

PEO 3: To enable graduates to gain employment in organizations and establish themselves as


professionals by applying their technical skills to solve real world problems and meet the
diversified needs of industry, academia and research.

PROGRAM SPECIFIC OBJECTIVES (PSOs)

1. To create, select, and apply appropriate techniques, resources, modern


engineering and IT tools including prediction and modelling to complex engineering
activities with an understanding of the limitations.
2. To manage complex IT projects with consideration of the human, financial,
ethical and environmental factors and an understanding of risk management
processes, and operational and policy implications.
TABLE OF CONTENTS

Page
[Link]. Date Name of the Experiment No. Marks Sign

DEVELOP THE TEST PLAN FOR TESTING AN E-


1 COMMERCE WEB/MOBILE APPLICATION
([Link]).

DESIGN THE TEST CASES FOR TESTING THE E-


2 COMMERCE APPLICATION

TEST THE E-COMMERCE APPLICATION AND


3
REPORT THE DEFECTS IN IT.

DEVELOP THE TEST PLAN AND DESIGN THE TEST


4 CASES FOR AN INVENTORY CONTROL SYSTEM.

EXECUTE THE TEST CASES AGAINST A CLIENT


5 SERVER OR DESKTOP APPLICATION AND IDENTIFY
THE DEFECTS.

6 TEST THE PERFORMANCE OF THE E-COMMERCE


APPLICATION.

AUTOMATE THE TESTING OF E-COMMERCE


7
APPLICATIONS USING SELENIUM.

INTEGRATE TESTNG WITH THE ABOVE TEST


8 AUTOMATION.

MINI PROJECT:
9 a)
BUILD A DATA-DRIVEN FRAMEWORK USING
SELENIUM AND TESTNG

BUILD PAGE OBJECT MODEL USING SELENIUM


9 b) AND TESTNG

BUILD BDD FRAMEWORK WITH SELENIUM,


9 c) TESTNG AND CUCUMBER
COURSE OBJECTIVES

• To understand the basics of software testing

• To learn how to do the testing and planning effectively

• To build test cases and execute them

• To focus on wide aspects of testing and understanding multiple facets of testing

• To get an insight about test automation and the tools used for test automation

COURSE OUTCOMES

CO1: Understand the basic concepts of software testing and the need for software testing
CO2: Design Test planning and different activities involved in test planning
CO3: Design effective test cases that can uncover critical defects in the application
CO4: Carry out advanced types of testing
CO5: Automate the software testing using Selenium and TestNG
[Link] Develop the test plan for testing an e-commerce web/mobile
application ([Link]).
Date:

Aim To develop the test Plan for Testing an E-commerce Web/Mobile Application
Introduction
The purpose of this test plan is to outline the testing approach for an e-commerce
web/mobile
application, specifically [Link]. The goal is to ensure that the application
functions as
intended, meets user requirements, and provides a seamless shopping experience.
Scope
The scope of this test plan includes testing the core functionalities of the e-commerce
application, such as browsing products, adding items to the cart, placing orders, and
managing
user accounts. It also covers testing across different platforms, including web and
mobile.
1. Validate the functionality of the e-commerce application.
Test Objectives
2. Verify that the application is user-friendly and provides a smooth shopping experience.
3. Ensure that the application is secure and protects user data.
4. Test the application's compatibility across different browsers and devices.
5. Evaluate the performance and scalability of the application under various load conditions.
6. Identify and report any defects or issues found during testing.
Test Environment
1. Web browsers: Chrome, Firefox, Safari, and Edge.
2. Mobile devices: iOS and Android.
3. Test management tool: Jira or any other preferred tool.
4. Test automation tool: Selenium WebDriver or any other preferred tool.
5. Load testing tool: JMeter or any other preferred tool.
Test Approach
1. Requirements Analysis:
Review the functional and non-functional requirements of the e-commerce application.
Identify testable features and prioritize them based on criticality.
2. Test Design:
Create test scenarios and test cases for each identified feature.
Include positive and negative test cases to cover different scenarios.
Define test data and test environment setup requirements.
3. Test Execution:
Execute test cases manually or using test automation tools.
Log defects in the test management tool and track their status.
Perform regression testing after each bug fix or application update.
4. Performance Testing:
Design and execute performance tests to evaluate the application's response time,
throughput, and scalability.
Simulate different user loads and monitor system resources during testing.
Identify performance bottlenecks and suggest improvements if needed.
5. Security Testing:
Conduct security testing to identify vulnerabilities and ensure the application protects
user data.
Test for common security issues like SQL injection, cross-site scripting (XSS), and
authentication vulnerabilities.
Implement security best practices and follow industry standards.
6. Compatibility Testing:
Test the application on different browsers, versions, and mobile devices.
Verify that the application renders correctly and functions as expected across various
platforms.
Test Deliverables
1. Test plan document.
2. Test scenarios and test cases.
3. Test execution reports.
4. Defect reports with severity and priority.
5. Performance test reports.
6. Security test reports.

Result
[Link] Design the test cases for testing the e-commerce application

Date:

Aim
To design the test cases for testing the e-commerce application

General Test Cases for Online Shopping Website


1. Verify that the company logo and name are clearly visible.
2. Verify that the user is able to navigate through all the products across different
categories.
3. Verify that all the links and banners are redirecting to the correct product/category pages
and none of the links are broken.
4. Verify that all the information displayed – product name, category name, price, and
product description is clearly visible.
5. Verify that all the images – product and banner are clearly visible.
6. Verify that category pages have a relevant product listed, specific to the category.
7. Verify that the correct count of total products is displayed on the category pages.
8. Search – Verify that on searching, all the products satisfying the search criteria are
visible on the search result page.
9. Search – Verify that on searching, products get displayed on the basis of their relevancy.
10. Search – Verify that the count of products is correctly displayed on the search result page
for a particular search term.
11. Filtering – Verify that filtering functionality correctly filters products based on the filter
applied.
12. Filtering – Verify that filtering works correctly on category pages.
13. Filtering – Verify that filtering works correctly on the search result page.
14. Filtering – Verify that the correct count of total products is displayed after a filter is
applied.
15. Filtering – Verify that the correct count and products get displayed on applying multiple
filters.
16. Sorting – Verify that all the sort options work correctly. On sorting the products based on
the sort option chosen.
17. Sorting – Verify that sorting works correctly on the category pages.
18. Sorting – Verify that sorting works correctly on the search result page.
19. Sorting – Verify that sorting works correctly on the pages containing the filtered result,
after applying filters.
20. Sorting – Verify that the product count remains the same irrespective of the sorting
option applied.
Product Buy Flow – Test cases for Ecommerce Website
1. Verify that on the product page, the user can select the desired attribute of the product
e.g. size, color, etc.
2. Verify that the user can add to the cart one or more products.
3. Verify that users can add products to the wishlist.
4. Verify that the user can see the previously added products on the cart page, after signing
in to the application.
5. Verify that the user can successfully buy more than one products that were added to
his/her cart.
6. Verify that the user cannot add more than the available inventory of the product.
7. Verify that the limit to the number of products a user can buy is working correctly. Also,
an error message gets displayed, preventing the user from buying more than the limit.
8. Verify that the delivery can be declined during checkout for the places where shipping is
not available.
9. Verify that the Cash on Delivery option of payment is working fine.
10. Verify that the different prepaid methods of payments are working fine.
11. Verify that product return functionality works correctly.
User Registration Test cases
1. Verify that all the required fields – username, email, password, confirm password, etc are
present on the registration page.
2. Verify that on passing valid values, a user should get registered and the same should be
allowed to log in to the application.
3. Verify that if a user tries to register an existing username then an error message
should get displayed.
4. Verify that the required/mandatory fields are marked with the ‘*’ symbol.
5. Verify that for a better user interface – dropdowns, radio buttons, checkboxes, etc fields
are displayed wherever possible instead of just text boxes.
6. Verify the page has both submit and cancel/reset buttons at the end.
7. Verify that clicking submits button after entering all the required fields, submits the data
to the server.
8. Verify that clicking the cancel/reset button after entering all the required fields,
cancels the submit request, and reset all the fields.
9. Verify that if no value is passed to the mandatory fields and submit button is clicked then
it leads to a validation error.
10. Verify that the user can leave the optional fields blank and on clicking the submit button
no validation error appears.
11. Verify that whenever possible validation should take place on the client side. For
example, if a user presses submit button without entering a username, and password then
this validation should take place on the client side instead of sending blank entries to the
server.
12. Check the upper limit of the different textbox fields.
13. Verify validation on the date and email fields. Only valid dates and valid email Ids should
be allowed.
14. Check validation on numeric fields by entering alphabets and special characters.
15. Check that leading and trailing spaces are trimmed i.e. in case, the user appends space
before and after a field, then the same should get trimmed before getting stored on the
server.
Product Creation Test cases (For seller)
1. Verify that only authorized sellers get access to product creation panels specific to the
authorized categories.
2. Verify that the product creation panel is working fine for single product creation.
3. Verify that the product creation panel is working fine for multiple product creations.
4. Verify that the maximum product creation limit for the seller is working fine, limiting the
seller to creating more than the desired number of products.
5. Verify panel validation for checking mandatory fields.
6. Verify that duplicate product creation is restricted through the panel.
7. Verify that the seller can update the information and price of existing products.
8. Verify that products created by sellers get visible on the website after a certain period of
time.
9. Verify that updates made by the seller get visible on the website after a certain period of
time.

Test Cases for eCommerce websites


To create practical test cases for ecommerce website, one must understand the structure
of a typical site.
There are many features in an eCommerce website – hero carousel/slider, search, filter,
product details, payments, checkout, etc. each having a pre-defined functionality.
For example, Every search bar should show relevant results, i.e., searching for
electronics should show all categories like mobiles, TVs, cameras, etc.
Here few significant features and listed the test cases for eCommerce website:

General Ecommerce Test Cases

The user should be able to navigate to all the pages in the website

There should be a fallback page for any page load errors

Verify that all the links and banners work properly

Search results should be displayed with the most relevant item being shown first

All data related to the product – title, price, images, and description are all visible clearly

Maintain a session for each user and test verify the session times out after a while

Login/Registration test cases for Online Shopping Website

Test for valid username and password


Test “Forgot Password” and Reset Password functionality

Validate If user is registered or not, and if not, provide an option to create an account

Show Login screen by default for registered user

Test that all fields are mandatory

Seller Product Creation Test Cases

For sellers who want to create their catalog, they should be able to add their products, and this
flow should be tested.

Test that authenticated sellers can access authorized product creation panels under
authorized categories.
Test the maximum product creation limit to avoid adding more products to the catalog.

Test that seller’s products are visible after some time

Test the product creation process is working fine for the seller

Test that there are no duplicate products

Search Bar Test Cases for Online Shopping Website

Test what parameters the search is based on – for example, product name, brand name,
category, etc.
Test if the search results are relevant

Number of results to be displayed per page

Test whether the search API is being called at every keystroke. (This isn’t recommended,
as it would unnecessarily cause multiple API calls to the database)
Filter Results

Example of a filter

Test if the user can filter based on all the parameters on the page

The user should be able to see results with default search criteria when at least one of the
filter parameters isn’t mandatory
Validation messages for invalid filter criteria

When at least one filter criteria are required, and the user selects none, proper error
messages are shown

Product Detail Test Cases


Test that all the product details are displayed correctly and that no empty/invalid details are
displayed.
Product Images should be optimized for size and dimensions, which further helps in
performance testing.
If there’s breadcrumb navigation, each link in the breadcrumb should be functional.

Below is an example of breadcrumb navigation.

All the links (size, Pincode check, etc) about the product should be functional.

Shopping Cart

Test that all items are added into the cart


Test that all added items have at least a quantity, price, and delete option associated with it
Test that the user can increase/decrease the quantity from the cart
If a user adds the same item to the cart the amount of that item should increase in the cart
On closing the tab/leaving the site, the items should still be in the cart upon returning to the
website.
Checkout Page

User should be able to add coupons


User should be shown the total amount with the necessary breakup as applicable.
User should be able to select the desired payment method
On adding more items or increasing/decreasing quantity, the total should change
accordingly
Calculate shipping costs based on shipping methods
Right address should be selected and the user should be able to edit/add the address
Payments
Perform security testing if in case the user’s credit card details need to be saved

For returning customers, they should be redirected to log in for checkout

User should be logged out after the session times out

Emails/test confirmation when the order is confirmed

An eCommerce website has many more tests or features, and testing each is very time-

consuming
and requires
website effort. Thankfully, a few tools and techniques are available to ease the
testing
process. With Browserstack:
One can go for automation test cases for ecommerce website across browsers, devices,
and operating systems.
Test for responsiveness with mobile devices and also perform performance testing
with Speedlab.

Result
[Link]
Test the e-commerce application and report the defects in it.
Date:

Aim
To test the e-commerce application and report the defects in it.

eCommerce website testing involves reviewing the website or web application for any issues
before it goes live and is open to the public. A web application requires testing on various features
like security, functionality, database, etc. The following types of testing willbe carried out here:
Functional Testing
User Interference testing
Security Testing
Browser compatibility Testing
Load and stress Testing
Database Testing

Types of Testing for eCommerce System

Below are the different types of testing for eCommerce systems:


1. Functional Testing: Checking a web application’s requested functionality in the area of basic
usability, its mainline functions, and accessibility is known as functional testing. BVA, decision
table testing, and equivalence class testing among many other methods, may be usedto create
functional test cases for online applications.
The following test cases are a few of many test cases that can be considered for checking the
functional testing:

S
No. Description Inputs Expected Output
Login username,
password If the inputs are then
1. Register on the website. the user is registered.

Items searched are


2. Search a product in the product gallery Search string shown.
S
No. Description Inputs Expected Output
Sign in to the website, choose the item Login Username,
you want to buy and how many of it you password, Item no, Item is added
3.
want to buy, and then add the chosen name of the item, successfully to the
item to your shopping cart. and its quantity shopping cart.

Login Username,
Sign in to the website, choose the item
password Item is successfully
you want to buy and how many of it you
4. want to buy, and then add the chosen Item no. , name of deleted from the
item to your shopping cart and delete the item and its shopping cart if the
one item from the shopping cart quantity deletion is confirmed.

2. User Interface Testing: User interaction aspects are tested for proper operation
during user interface testing. Links, tables, forms, frames, and user interface
elements including text fields, radio buttons, check boxes, list boxes, combo boxes,
command buttons, and dialogue boxes are some of these characteristics. User
interface testing makes ensuring the program responds appropriately to mouse and
keyboard inputs and displays hyperlinks, tables, menus, error message boxes,
dialogue boxes, frames, buttons, and toolbars. There are mainly 2 types of user
interface testing: Navigation Testing: All internal and external links are tested for
functionality during the navigation process. Websites must be tested for their ability
to deliver reliable, well-organized links, as well as other navigational choices like site
maps and search engines. The following checklist can be considered for navigation
testing of an e-commerce site:
S
No. Description Expected Output

1. Check every link on the site. An appropriate page should open.

2. Click on the back button An appropriate page should open.

Click on every link to see how the The website’s contents can effectively be read
3. since appropriate horizontal and vertical scroll bars
material appears on each web page.
are available.

Form-Based Testing: Forms on websites must be tested to ensure that all fields function
properly. These types of forms on e-commerce sites can be seen while the user is registering or
when the user is filling in billing and shipping details. Form-based testing checks the following
concerns:
• Correct use of the tab key to go from one form field to another.
• Verifies that the data submitted in the form is in the correct format.
• Verifies that all necessary fields are filled out on the form.

S
No. Description Inputs Expected Outputs
Navigate using the tab The correct sequence is
1. key for changing the – followed while
field. navigation.

Log in username password and


Check the maximum confirm password (for the Information is added if it
and minimum value of registration page which contains is within the range
2. the length of string that login username, password, and otherwise error message
can be put in the field. confirm password field. ) is displayed.

Log in username password and If all mandatory info is


Check all mandatory confirm password (for the entered into the form then
3. fields log in are entered registration page which contains information is added
in the form. the login username, password, otherwise an error is
and confirm password field. ) displayed.

Browser Testing: There are several browsers available, and each of them behaves differently.
Although testing the web application with all browsers is impracticable, it is vital to validate the
web application with defined and prioritized platforms to assure proper operation. A browser
compatibility matrix may be developed to test the web application on multiple browsers.

Browser Safari Chrome Firefox Brave

Audio

Video

Text
3. Security Testing: Security is the process of protecting data from numerous attacks.
When interacting across a network, it is necessary to secure sensitive and critical
information and data. The user wishes to have a safeguard in place to protect personal,
sensitive, and financial information. We want data that is accurate, dependable, and
secure against illegal access. The primary areas of requirement include:
1. Authentication: Is the data sent by an authorized user?
2. Access Control: Is data secure against unauthorized users?
3. Transparency: Does the user receive exactly what is sent?
4. Delivery: Is the information reaching the intended recipient?
5. Reliability: How frequently does a failure occur? How long does it take for the network
recover after a failure?
to
4. Performance Testing: Performance tests, including load and stress testing, must be carried
out to make sure the web application can handle the demand during peak hours and serve the
user in a timely and dependable way.
The ability for several users to view an eCommerce web application at once is one of its main
benefits. As a result, thorough testing and monitoring of the application’s performance at peak
times is required.
Factors that influence performance testing are:
1. A number of users.
2. Response time.
3. Network Bandwidth.
4. User type.
5. Memory available.
6. Time spent averagely by a user
Performance testing includes:
Load Testing: Load testing comprises simulating several users accessing the web application
at the same time to test the web application under real-world conditions. It puts the web application
through its paces by overloading it. Load testing plans should be developed as early as practicable
in the software life cycle. Load testing includes the following measures to guarantee adequate
performance during peak hours:
1. Defining the load test environment that simulates the e-commerce website.
2. Defining the testing approach and calculating the number of users. By roughly calculating the
proportion of visitors who visit specific parts of the website, the total number of users may be
determined.
3. Identifying suitable metrics enables the practitioner to determine the system performance with
respect to the established quality benchmarks. These metrics are webpage view per hour, day,
and week, the number of concurrent users, wait time, elapsed time, etc.
4. Choosing the correct tool and running the load test. Complex online applications may be tested
using Microsoft’s Application Center Test (ACT) or Empirix’s e-Test tools.
Stress Testing: Stress testing is running a web application under more than maximum and
changing loads for extended periods of time. Unlike performance and load testing, stress testing
assesses the system’s response when it is subjected to a load that exceeds its defined limitations. It
is also used to monitor and test the dependability of a web application when available resources
are being exploited beyond their maximum capacity. The system’s
behavior is observed to identify when the system under stress test fails and how it
recovers from the failure.
The web application may be subjected to stress testing for the following reasons:
CPU and memory utilization.
Response time.
Backend database.
User types.
Concurrent users.
5. Database Testing: E-commerce is database-driven, it is critical that these apps function
effectively and protect the user’s sensitive data, such as personal information and credit
card information. Data-centric web applications must be tested to ensure error-free functioning
and greater client satisfaction. Consider the following scenario: you want to buy something from
the
an online retailer. When a user does a search using keywords and pricing preferences,
database server generates a database query. If the query does not take into account the customer’s
price choices owing to a programming error, the results will be incorrect. During database
testing, several types of defects must be verified and eliminated.
The following checklist can be considered for database testing:

Yes /
Description No

Are the database operations carried out correctly?

Does the database return to a consistent state after a crash recovery?

Are backup and recovery processes designed to assure the user’s uninterrupted
service?

Is concurrent user access to the database handled correctly?

Does the database have adequate capacity and memory to store records and manage
various administrative and user operations?

Features To Be Tested in eCommerce Application


The following are some of the features that can be tested in eCommerce websites:
• Home page: The links to important pages should be visible and functional, correct images
and text are visible on the main page.
• Payment function: At this step, security testing comes into the picture. A number of
variables need to be tested here like Debit/ Credit card details, can the customer pay in
installments, the generation of order confirmation and receipt, etc.
• Order processing mechanism: At the time of placing the order, the users should
be able to select the preferred shipping method, the address should be correctly
mapped to the order, etc. Product Catalog: All the products should be clearly
• listed
the on the site with all
explanatory images, clear product descriptions, images should be of good quality, Add To
Card option should be easily visible, etc.
• Search engine: Users should be able to search the desired product seamlessly and should
be directed to the exact product page, should be able to navigate to important sections like
product categories, cart, etc with few clicks.

Tools for testing ecommerce Site

• Google Analytics
test how well Content Experiments:- Experiments allow you to
different versions of your sites perform in terms of encouraging your users to complete
specified tasks. Test up to five different versions of a page at different URLs to determine
which one generates the most conversions. It helps in usability and performance testing.
• Silverback: Silverback is a Mac-only usability testing application. It enables you to
capture screen activity, record usability testing sessions, assign assignments, and highlight
significant moments within a session.
• [Link]: [Link] offers usability testing on demand. Use one of
the configurable templates to create your exam. Choose participants by selecting
demographics for your intended audience. View videos of participants using your
website, get written responses, and ask follow-up questions.
• [Link]: [Link] lets you help in performance testing.
• Concept feedback: It gives expert opinions on usability testing.
• HotJar: This is the tool that reveals the online behavior and voice of the users.

Result:
[Link]
Develop the test plan and design the test cases for an inventory control
Date: system.

Aim
To develop the test plan and design the test cases for an inventory controlsystem.

Result
[Link]
Execute the test cases against a client server or desktop application and
Date: identify the defects.

Aim
To execute the test cases against a client server or desktop application and identify the defects.

NATURE OF DEFECTS IN DESKTOP APP


While testing desktop applications the nature of defects is usually different as compared to other
apps. Most common defects in the desktop applications are:
• Incorrect shortcut icon
• Unauthorized features which the application might install without taking input from the
user
• The process may still be running in the background even after uninstalling the application
• Platform dependency issues
• Incorrect warning messages
• Unauthorized access to restricted applications from other users
Creating a testing checklist is an integral part of the process of writing test cases. With
the help
of such a checklist, one can easily create hundreds of test cases for testing desktop
applications.
Testing checklist for desktop applications may include the following: 1- Graphical User
Interface Testing 2- Functional Testing
• Check for broken links
• Warning messages
• Resolution change effect on the application
• Print
• Theme change
• Installation Testing (Upgrade/Downgrade)
• Testing with multiple user accounts
• Sleep mode
• Cache
3- Platform Compatibility Testing
• Testing the application on different operating systems
4- Performance Testing
• A long period of continuous use
• Memory
• Generate “Power Efficiency Diagnostics Report” by running the command powercfg
/energy
INDUSTRY TOOLS TO TEST A DESKTOP APP
Here is a list of some tools that are commonly used as an industry practice to test desktop apps.
REGRESSION TESTING TOOLS:
• AutoIt – It is a scripting language that creates automated scripts for Windows programs.
• It is one of the oldest tools in the field and is still widely used today.
• AutoHotkey – It is an opensource custom scripting language for Microsoft Windows,
aimed at providing easy keyboard shortcuts or hotkeys.
• TestSmith – helps automates regression testing.
• QAliber – It is a test automation framework used to build fast, reusable, and reliable
system tests under Windows OS.
STRESS TESTING TOOLS:
• File Fuzzer
• Disk Hog

Result
[Link]
Test the performance of the e-commerce application.
Date:

Aim
To test the performance of the e-commerce application.

The importance of offering a great customer experience cannot be overstated.


That is why retailers must take the proper steps to test their websites and
applications especially when it comes to providing a consistent and stable online
experience during peak sales periods.

In order to assess an application’s scalability, speed, and stability, there are a


number of different performance tests that QA teams should consider.
Executing these tests is the best way to measure the performance of an e-
commerce application or website from a variety of angles.

Load Testing: Measures an application’s performance under normal workloads.


Stress Testing: Checks the behavior of an application under heavy workloads to
determine the application’s breaking point.
Spike testing: Evaluates an application’s performance when there is a sudden increase in
the applications workload.
Scalability Testing: Assesses an application’s ability to scale up in response to an
increase in its workload.
Volume Testing: Gauges the application’s throughput by using a large amount of data in
search workflows.
Endurance Testing: Calculates an application’s performance when under a particular
workload over a long period of time.
Performance Testing Advice
In e-commerce, the performance-testing plan should also incorporate a number of
elements that can affect the speed and scalability of websites and applications.

1) Test across Different Geographical Locations For retailers with an international


customer base, performance tests should be carried out to
ensure the geographical location of online shoppers does not affect the speed of
the site or
application. The point here is to make sure customers in the United States
experience the
same response time as customers in France or Japan.
2) Test All Transactions Because some transactions, like product searches, can be
more network intensive than
others, testing all transactions is critical. At the same time, transactions need to be
tested across
different devices and browsers to make sure the transaction speed is up to par. In
addition, it is crucial to recognize that online shoppers do not all have the same
profile and
nor exhibit
shoppers the same behaviors or tendencies. In fact, it is very common for
to take
several different paths while shopping online. As a result, QA teams must pay careful
attention
3) Test Across Different Devices and Configurations Today’s online consumer uses
to testing every user path possible to measure its impact on the application’s
architecture.
multiple devices before ultimately making a purchase,
whether in-store or online. To offer an optimal user experience, it is vital for
performance tests
to account for the different devices (laptop, tablet, and smartphone) that consumers
use to shop
online.
Additionally, using different browsers, operating systems, smartphone or tablet

models,
4) Test
etc., is Payments
essential Systems and Gateways E-commerce websites and applications
performance of an to determine if certain configurations negatively affect the
need to be able
application to handle multiple transactions at the
or a website.
same time. Testing payment systems is critical step in the QA process, and
should not be
skipped for any reason. Testing the performance of payment systems will help the
QA team
uncover any issues that can disrupt or block transactions, especially when a large
number of
users checkout at the same time. When it comes to third-party payment gateways, it
is important note that testing can be a bit
more
a challenging. This is because most payment gateways providers do not provide
favorable testing environment. While this may sound unreasonable, it is a way for
payment
gateway providers to prevent their portals from being flooded with tons of
virtualusers.
Using a sandbox environment, QA teams can overcome this challenge in creating a

safe testing
environment in order to test key scenarios on an application or site with a fully
integrated payment gateway. Result
[Link]: 7 Automate the testing of e-commerce applications using Selenium.

Date:

Aim
To Automate the testing of e-commerce applications using Selenium.

[Link] the 'User Registration and Login' of Amazon like an e-commerce website
Positive Scenario
1. Test Case - Automate the User Registration process of an e-commerce website.
Steps to Automate:
1. Open this URL [Link]
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.

Selenium code for User Registration:


import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class EcomSignUp {
public static void main(String[] args) {
[Link]().setup();
WebDriver driver=new ChromeDriver();
String URL="[Link]
[Link](URL);
[Link]().timeouts().implicitlyWait(2000, [Link]);
[Link]().window().maximize();
//Click on Sign in
[Link]([Link]("Sign in")).click();
//Enter email address
[Link]([Link]("[name='email_create']")).sendKeys("test1249@[Link]");
//Click on "Create an account"
[Link]([Link]("//button[@name=\"SubmitCreate\"]")).click();
//Select Title
[Link]([Link]("//input[@id=\"id_gender1\"]")).click();
[Link]([Link]("customer_firstname")).sendKeys("Test User");
[Link]([Link]("customer_lastname")).sendKeys("Vsoft");
[Link]([Link]("passwd")).sendKeys("PKR@PKR");
// Enter your address
[Link]([Link]("firstname")).sendKeys("Test User");
[Link]([Link]("lastname")).sendKeys("Vsoft");
[Link]([Link]("company")).sendKeys("Vsoft");
[Link]([Link]("address1")).sendKeys("Test 81/1,2nd cross");
[Link]([Link]("city")).sendKeys("XYZ");
// Select State
WebElement statedropdown=[Link]([Link]("id_state"));
Select oSelect=new Select(statedropdown);
[Link]("4");
[Link]([Link]("postcode")).sendKeys("51838");
// Select Country
WebElement countrydropDown=[Link]([Link]("id_country"));
Select oSelectC=new Select(countrydropDown
[Link]("United States");
//Enter Mobile Number
[Link]([Link]("phone_mobile")).sendKeys("234567890");
[Link]([Link]("//input[@name=\"alias\"]")).clear();
[Link]([Link]("//input[@name=\"alias\"]")).sendKeys("Office")
; [Link]([Link]("submitAccount")).click();
String
userText=[Link]([Link]("//*[@id=\"header\"]/div[2]/div/div/nav/div[1]/a")).getT
e xt();
// Validate that user has created
if([Link]("Vsoft")) {
[Link]("User Verified,Test case Passed");
}
else {
[Link]("User Verification Failed,Test case Failed");
}
}
}

Negative Scenarios
2. Test Case - Verify invalid email address error.
Steps to Automate:
1. Open this URL [Link]
2. Click on the sign-in link.
3. Enter an invalid email address in the email box and click enter.
4. Validate that an error message is displaying saying "Invalid email address."

3. Test Case - Verify error messages for mandatory fields.


Steps to Automate:
1. Open this URL [Link]
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 [Link]
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.

[Link] 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 [Link]
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 [Link]; import
[Link]; import [Link]; import
[Link]; import
[Link]; import
[Link];
import [Link];

public class EcomPractice2{

public static void main(String[] args)throws InterruptedException{

[Link]().setup();
WebDriver driver=new ChromeDriver();
String URL="[Link]
[Link](URL);
[Link]().window().maximize();

// Initialise Actions class object Actions actions=new Actions(driver);


[Link]().timeouts().implicitlyWait(2000, [Link]);
WebElement womenTab=[Link]([Link]("WOMEN"));
WebElement
TshirtTab=[Link]([Link]("//div[@id='block_top_menu']/ul/li[1]/ul/li[1]/ul//a[@ti
t le='T-shirts']"));
[Link](womenTab).moveToElement(TshirtTab).click().perform()
; [Link](2000);

// Get Product Name


String
ProductName=[Link]([Link]("/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();
[Link](ProductName);
[Link]([Link]("search_query_top")).sendKeys(ProductName)
; [Link]([Link]("submit_search")).click();

// Get Name of Searched Product


String
SearchResultProductname=[Link]([Link]("/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([Link](SearchResultProductname)) {
[Link]("Results Matched;Test Case Passed");
}else{
[Link]("Results NotMatched;Test Case Failed");
}

// Close the browser


[Link]();
}

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 [Link]
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.

The following code for Purchase Product is contributed by Uday:


import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

import [Link];

public class EcomExpert {


public static void main(String[] args){
[Link]().setup();
WebDriver driver=new ChromeDriver();
String URL="[Link]
// Open URL and Maximize browser window
[Link](URL);
[Link]().window().maximize();
[Link]().timeouts().implicitlyWait(3000, [Link]);

//Click on Sign in
[Link]([Link]("Sign in")).click();
//Login
[Link]([Link]("email")).sendKeys("test1249@[Link]");
[Link]([Link]("passwd")).sendKeys("PKR@PKR");
[Link]([Link]("SubmitLogin")).click();
//Click on Women
[Link]([Link]("WOMEN")).click();

WebElement
SecondImg=[Link]([Link]("/html/body/div[1]/div[2]/div/div[3]/div[2]/ul/li[2]/div
/div[1]/div/a[1]/img"));
WebElement
MoreBtn=[Link]([Link]("/html/body[1]/div[1]/div[2]/div[1]/div[3]/div[2]/ul/li[2]/
div[1]/div[2]/div[2]/a[2]"));
Actions actions=new Actions(driver);
[Link](SecondImg).moveToElement(MoreBtn).click().perform();
//Change quantity by 2
[Link]([Link]("quantity_wanted")).clear();
[Link]([Link]("quantity_wanted")).sendKeys("2");
//Select size as L
WebElement Sizedrpdwn=[Link]([Link]("//*[@id='group_1']"));
Select oSelect=new Select(Sizedrpdwn);
[Link]("M");
//Select Color
[Link]([Link]("color_11")).click();
//Click on add to cart
[Link]([Link]("//p[@id='add_to_cart']//span[.='Add to cart']")).click();
//Click on proceed
[Link]([Link]("/html//div[@id='layer_cart']//a[@title='Proceed to
checkout']/span")).click();
//Checkout page Proceed
[Link]([Link]("/html/body/div[1]/div[2]/div/div[3]/div/p[2]/a[1]/span")).click();

[Link]([Link]("/html/body/div[1]/div[2]/div/div[3]/div/form/p/button/span")).clic
k();
/Agree terms&Conditions

[Link]([Link]("//*[@id=\"cgv\"]")).click();
[Link]([Link]("/html/body/div[1]/div[2]/div/div[3]/div/div/form/p/button/span")).
click();

//Click on Payby Check

[Link]([Link]("/html/body/div[1]/div[2]/div/div[3]/div/div/div[3]/div[2]/div/p/a")
).click();
//Confirm the order

[Link]([Link]("/html/body/div[1]/div[2]/div/div[3]/div/form/p/button/span")).clic
k();

//Get Text
String
ConfirmationText=[Link]([Link]("//div[@id='center_column']/p[@class='alert
alert-success']")).getText();
// Verify that Product is ordered
if([Link]("complete")) {
[Link]("Order Completed: Test Case Passed");
}
else {

[Link]("Order Not Successfull: Test Case Failed");


}
}
}

2. Test Case - Verify that 'Add to Wishlist' only works after login.
Steps to Automate:
o Open link [Link]
o Move your cursor over the Women's link.
o Click on the sub-menu 'T-shirts'.
o Mouse hover on the second product displayed.
o 'Add to Wishlist' will appear on the bottom of that product, click on it.
o 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 [Link]


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
[Link] Integrate TestNG with the above test automation.

Date:

Aim
To integrate TestNG with the above test automation.

Create a Framework for the testing of web applications using


Selenium Webdriver with TestNG.

Table of Contents
1. Dependency List
2. Implementation Steps
1. Download and Install Java
2. Download and setup Eclipse IDE on the system
3. Setup Maven
4. Create a new Maven Project
5. Add Selenium and TestNG dependencies to the project
6. Create a Test file under src/test/java
7. Test Execution through TestNG
8. Run the tests from [Link]
9. TestNG Report Generation
Dependency List
1. Selenium- 4.12.1
2. Java 8 or above
3. TestNG – 7.8.0
4. Maven – 3.8.1
5. WebdriverManager – 5.5.3
Implementation Steps
Step 1- Download and Install Java
Selenium needs Java to be installed on the system to run the tests. Click hereHow
to learn
to

install Java.
Step 2 – Download and setup Eclipse IDE on the system
The Eclipse IDE (integrated development environment) provides strong support for Java
developers, which is needed to write Java code. Click here to learn How to install Eclipse.
Step 3 – Setup Maven
To build a test framework, we need to add a number of dependencies to the project. It is a very
tedious and cumbersome process to add each dependency manually. So, to overcome this
problem, we use a build management tool. Maven is a build management tool that is used to
define project structure, dependencies, build, and test management. Click here to learn How to
install Maven.
Step 4 – Create a new Maven Project
Click here to learn How to create a Maven project
Below is the Maven project structure. Here,
Group Id – [Link]
Artifact Id – Selenium_TestNGDemo
Version – 0.0.1-SNAPSHOT
Package – com. example. Selenium_TestNGDemo

Step 5 – Add Selenium and TestNG dependencies to the project


As this is a Maven project, we can add the dependencies in [Link] as shown below.
1 <project xmlns="[Link] xmlns:xsi="[Link] hem

2 xsi:schemaLocation="[Link] [Link]
4.0. [Link]
3 <modelVersion>4.0.0</modelVersion>
4
5 <groupId>[Link]</groupId>
6 <artifactId>Log4j2_Demo</artifactId>
7 <version>1.0-SNAPSHOT</version>
8 <packaging>jar</packaging>
9
10 <name>Log4j2_Demo</name>
11 <url>[Link]
12
13 <properties>
14 <[Link]>4.12.1</[Link]>
15 <[Link]>7.8.0</[Link]>
16 <[Link]>5.5.3</[Link]>
17 <[Link]>3.1.2</[Link]>
18 <[Link]>3.11.0</[Link]>
19 <[Link]>UTF-8</[Link]>
20 <[Link]>11</[Link]>
21 <[Link]>11</[Link]>
22 </properties>
23
24 <dependencies>
25
26 <!-- TestNG Dependency -->
27 <dependency>
28 <groupId>[Link]</groupId>
29 <artifactId>testng</artifactId>
30 <version>${[Link]}</version>
31 <scope>test</scope>
32 </dependency>
33
34 <!-- WebDriverManager Dependency -->
35 <dependency>
36 <groupId>[Link]</groupId>
37 <artifactId>webdrivermanager</artifactId>
38 <version>${[Link]}</version>
39 </dependency>
40
41 <!-- Selenium Dependency -->
42 <dependency>
43 <groupId>[Link]</groupId>
44 <artifactId>selenium-java</artifactId>
45 <version>${[Link]}</version>
46 </dependency>
47
48 </dependencies>
49
50 <build>
51
52 <plugins>
53 <plugin>
54 <groupId>[Link]</groupId>
55 <artifactId>maven-surefire-plugin</artifactId>
56 <version>${[Link]}</version>
57 <configuration>
58 <skipTests>false</skipTests>
59 <skip>false</skip>
60 <testFailureIgnore>true</testFailureIgnore>
61 </configuration>
62 </plugin>
63
64 <plugin>
65 <groupId>[Link]</groupId>
66 <artifactId>maven-compiler-plugin</artifactId>
67 <version>${[Link]}</version>
68 <configuration>
69 <source>${[Link]}</source>
70 <target>${[Link]}</target>
71 <fork>true</fork>
72 </configuration>
73 </plugin>
74 </plugins>
75
76 </build>
77
78
</project>
After the addition of dependencies in [Link], the Maven Dependencies folder will be updated
automatically with all the JAR file related to the dependencies.
Step 6 – Create a Test file under src/test/java
@BeforeMethod – This annotated method will be run before each test method i.e say
there are
three test methods (i.e test cases), then @BeforeMethod annotated method will be
called thrice
before each test method. @AfterMethod – methods under this annotation will be
executed after each Test method. @Test – The annotated method is part of a test case.
Description – You can describe your test case under the description, stating what it
1 description = "This test validates title of login functionality"
does.
Priority – You can prioritize the order of your test methods by defining a priority. Based
on the
defined priority, the test shall execute in that order.
1priority = [Link];
import
import [Link];
1 import
import [Link];
[Link];
import
import [Link];
5 6 7 [Link];
2 3 4import 9 10 11
[Link];
import [Link];
import [Link];
12 import [Link];
13 14
15
16 17
18
19

20

public class TestNG_Demo {


WebDriver driver;

By
By userName
passWord == [Link]("password");
[Link]("username");

By loginBtn =
[Link]("//*[@id='app']/div[1]/div/div[1]/div/div[2]/div[2]/form/div[3]/button");
21 By loginTitle = [Link]("//*[@id='app']/div[1]/div/div[1]/div/div[2]/h5");
22
23 By dashboardPage = [Link]("//*[@id='app']/div[1]/div[1]/header/div[1]/div[1]/span/h6");
24
25
26 @BeforeMethod
27 public void setUp() {
28
29 [Link]("Open a Chrome Web Browser");
30 [Link]().setup();
31 ChromeOptions options=new ChromeOptions();
32 [Link]("--start-maximized");
33 driver=new ChromeDriver(options);
34 [Link]().timeouts().implicitlyWait(10, [Link]);
35 [Link]("[Link]
36
[Link]("Open the application");37
}
38
39 @Test(description = "This test validates title of login functionality", priority = 0)
40 public void verifyLoginPageTitle() {
41
42 [Link]("Verify the Login page title");
43 String expectedTitle = [Link](loginTitle).getText();
44
45 [Link]("Actual Title :" + expectedTitle);
46 [Link]([Link]("Login"));47
}
48
49 @Test(description = "This test validates successful login to Home page", priority = 1)
50 public void verifyloginPage() {
51
52 [Link]("Enter Username");
53 [Link](userName).sendKeys("Admin");
54
55 [Link]("Enter Password");
56 [Link](passWord).sendKeys("admin123");
57
58 [Link](loginBtn).submit();
59
60 [Link]("New page - Dashboard is opened");
61 String newPageText = [Link](dashboardPage).getText();
62
63 [Link]("Heading of new page :" + newPageText);
64 [Link]([Link]("Dashboard"));
65
66 }
67

68 @AfterMethod
69 public void teardown() {
70
71 [Link]("Close the webpage");
72 [Link]();
73 }
74
}
Step 7 – Test Execution through TestNG
Go to the Runner class and right-click Run As TestNG Test. The tests will run as TestNG tests.
Step 8 – Run the tests from [Link]
Create a [Link] as shown below and run the tests as TestNG.
1 <?xml version = "1.0"encoding = "UTF-8"?>
2 <!DOCTYPE suite SYSTEM "[Link]
3 <suite name = "Suite1">
4 <test name = "TestNG Demo">
5 <classes>
6 <class name = "[Link].Selenium_TestNGDemo.TestNG_Demo"/>
7 </classes>
8 </test>
9 </suite>
Step 9 – TestNG Report Generation
TestNG generates various types of reports under test-output folder like [Link],
[Link], [Link].
We are interested in the “[Link]” report. Open “[Link]“, as this
is an HTML report, and open it with the browser. The below image shows emailable-
[Link].
TestNG also produces [Link]
“ ” report, and it resides under the
test-outputfolder. The
below image shows the
[Link] report. This is the latest theme of the report.

The links present on the left side are clickable. I have clicked the Times link, and you can see the
details on the right side.

Result
[Link] a) Mini Project:
Build a data-driven framework using Selenium and TestNG
Date:

Aim
To build a data-driven framework using Selenium and TestNG

TestNG provides built-in support for data-driven testing, allowing you to execute test cases with
different sets of test data. To perform data-driven testing with Selenium and TestNG, follow
these steps:
1. Use TestNG's @DataProvider annotation to define a data provider method that supplies
test data.
2. In the test method, specify the data provider method using the dataProvider attribute of
the @Test annotation.
3. Inside the data provider method, create a two-dimensional array or an iterator that
represents the test data.
4. Use the test data within the test method to perform various test actions or assertions.
Here's an example that demonstrates data-driven testing with TestNG and Selenium:
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class DataDrivenTest {


private WebDriver driver;
@BeforeMethod
public void setUp() {
// Set up the WebDriver instance
[Link]("[Link]", "path/to/chromedriver");
driver = new ChromeDriver();
[Link]().window().maximize();
}

@DataProvider(name = "searchKeywords")
public Object[][] searchKeywordsProvider() {
return new Object[][]{
{"TestNG tutorial"},
{"Selenium WebDriver"},
{"Automated testing"}
};
}
@Test(dataProvider = "searchKeywords")
public void searchTest(String searchKeyword) {
// Open the application URL
[Link]("[Link]

// Perform search
WebElement searchField = [Link]([Link]("searchField"));
WebElement searchButton = [Link]([Link]("searchButton"));
[Link](searchKeyword);
[Link]();
// Verify search results
WebElement searchResults = [Link]([Link]("searchResults"));
[Link]([Link]());
}
@AfterMethod
public void tearDown() {
// Close the browser
[Link]();
}
}
In this, the searchTest method is executed multiple times with different search
keywords provided by the data provider method searchKeywordsProvider.

Result
[Link] b) Build Page object Model using Selenium and TestNG

Date:

Aim

To build Page object Model using Selenium and TestNG

Create Page Objects representing pages of a web application that we want to test
Create methods for these Page Objects that represent actions we want to perform within
the pages that they represent
Create tests that perform these actions in the required order and performs checks that
make up the test scenario
Run the tests as TestNG tests and inspect the results

Creating Page Objects for our test application


As an example, this is the code for the login page:
package [Link];

import [Link];
import [Link];

public class LoginPage {

private WebDriver driver;

public LoginPage(WebDriver driver) {

[Link] = driver;

if(![Link]().equals("ParaBank | Welcome | Online Banking")) {


[Link]("[Link]
}
}
public ErrorPage incorrectLogin(String username, String password) {

[Link]([Link]("username")).sendKeys(username);
[Link]([Link]("password")).sendKeys(password);
[Link]([Link]("//input[@value='Log In']")).click();
return new ErrorPage(driver);
}

public HomePage correctLogin(String username, String password) {

[Link]([Link]("username")).sendKeys(username);
[Link]([Link]("password")).sendKeys(password);
[Link]([Link]("//input[@value='Log In']")).click();
return new HomePage(driver);
}
} It contains a constructor that returns a new instance of the LoginPage object as well
as two
methods
and that we can use in our tests: incorrectLogin, which sends us to the error page
correctLogin, which sends us to the home page. Likewise, I’ve constructed Page
Objects for
these two pages as well. A link to those implementations can be found at the end of
this post.
Note that this code snippet isn’t optimized for maintainability – I used direct

references
A good example can be seen in the implementation of the error page Page Object:
to element properties rather than some sort of element-level abstraction, such as an
Object
package [Link];
Repository. Creating methods that perform actions on the Page Objects
import [Link];
import [Link];
public class ErrorPage {
private WebDriver driver;

public ErrorPage(WebDriver driver) {

[Link] = driver;
}

public String getErrorText() {

return [Link]([Link]("error")).getText();
}
} By implementing a getErrorText method to retrieve the error message that is
displayed on the
error page, we can call this method in our actual test script. It is considered good
practice to
separate the implementation of your Page Objects from the actual assertions that are
performed
in your test script (separation of responsibilities). If you need to perform additional
checks, just
add a method that returns the actual value displayed on the screen to the associated
page object
and add assertions to the scripts where this check needs to be performed.
Create tests that perform the required actions and execute the required checks
Now that we have created both the page objects and the methods that we want to use
for the
checks in our test scripts, it’s time to create these test scripts. This is again pretty
straightforward, as thisdriver;
WebDriver example shows (imports removed for brevity):
package [Link];
@BeforeSuite
public class TestNGPOM {
public void setUp() {
driver = new FirefoxDriver();
[Link]().timeouts().implicitlyWait(10, [Link]);
}
@Parameters({"username","incorrectpassword"})
@Test(description="Performs an unsuccessful login and checks the resulting error
message")
public void testLoginNOK(String username, String incorrectpassword) {
LoginPage lp = new LoginPage(driver);
ErrorPage ep = [Link](username, incorrectpassword);
[Link]([Link](), "The username and password could not be
verified.");
}
@AfterSuite
public void tearDown() {
[Link]();
}
}
Note the use of the page objects and the check being performed using methods in
these page
object implementations – in this case the getErrorText method in the error page page
object.
As we have designed our tests as Selenium + TestNG tests, we also need to definea
[Link] file that defines which tests we need to run and what parameter values the
parameterized testLoginOK test takes. <!DOCTYPE suite SYSTEM
<suite name="My first TestNG test>suite" verbose="1" >
"[Link]
<parameter name="username" value="john"/>
<parameter name="password" value="demo"/>
<test name="Login tests">
<packages>
<package name="[Link]" />
</packages>
</test>
</suite>
Run the tests as TestNG tests and inspect the results
Finally, we can run our tests again by right-clicking on the [Link] file in the Package
Explorer and selecting ‘Run As > TestNG Suite’. After test execution has finished, the test
results will appear in the ‘Results of running suite’ tab in Eclipse. Again, please note that
using meaningful names for tests and test suites in the [Link] file make these results much
easier to read and interpret.

Result
[Link] c)
Build BDD framework with Selenium, TestNG and Cucumber
Date:

Aim
To build BDD framework with Selenium, TestNG and Cucumber

Dependency List:
1. Cucumber Java- 7.14.0
2. Cucumber TestNG – 7.14.0
3. Java 17
4. TestNG – 7.8.0
5. Maven – 3.9.5
6. Selenium – 4.15.0
7. Maven Compiler Plugin- 3.11.0
8. Maven Surefire Plugin – 3.2.1

Project Structure
Implementation Steps
Step 1- Download and Install Java
Cucumber and Selenium need Java to be installed on the system to run the tests. Click here to
know How to install Java.
Step 2 – Download and setup Eclipse IDE on the system
The Eclipse IDE (integrated development environment) provides strong support for Java
developers, which is needed to write Java code. Click here to know How to install Eclipse.
Step 3 – Setup Maven
To build a test framework, we need to add a number of dependencies to the project. It is a very
tedious and cumbersome process to add each dependency manually. So, to overcome this
problem, we use a build management tool. Maven is a build management tool that is used to
define project structure, dependencies, build, and test management. Click here to know How to
install Maven. Step 4 – Install Cucumber Eclipse Plugin (Only for Eclipse IDE)
The Cucumber Eclipse plugin is a plugin that allows eclipse to understand the Gherkin syntax.
The Cucumber Eclipse Plugin highlights the keywords present in Feature File. Click here to
know more – Install Cucumber Eclipse Plugin
Step 5 – Download and install TestNG plugin
TestNG plugin is needed to run the tests as TestNG tests as mentioned in step 13. Click here to
know – How to download and install TestNG in Eclipse.
Step 6 – Create a new Maven Project
Click here to know How to create a Maven project
Below is the Maven project structure. Here,
Group Id – [Link]
Artifact Id – Cucumber_TestNG_Demo
Version – 0.0.1-SNAPSHOT
Package – com. example. Cucumber_TestNG_Demo
Step 7 – Create source folder src/test/resources to create test scenarios in Feature file
When a new Maven Project is created, it has 2 folders –
src/main/java andsrc/test/javaas shown
below image. To create test scenarios, we need a new source folder called – .
src/test/resources
To create this folder, right-click on your maven project ->select New -
>Java, and then Source Folder.

Step 8 – Add Selenium, TestNG, and Cucumber dependencies to the project


Add the below-mentioned Selenium, TestNG, and Cucumber dependencies to the project.
1 <properties>
2 <[Link]>UTF-8</[Link]>
3 <[Link]>7.14.0</[Link]>
4 <[Link]>4.15.0</[Link]>
5 <[Link]>5.3.2</[Link]>
6 <[Link]>7.8.0</[Link]>
7 <[Link]>3.11.0</[Link]>
8 <[Link]>3.2.1</[Link]>
9 <[Link]>17</[Link]>
10 <[Link]>17</[Link]>
11
</properties>
12
13 <dependencies>
14
15 <dependency>
16 <groupId>[Link]</groupId>
17 <artifactId>cucumber-java</artifactId>
18 <version>${[Link]}</version>
19 </dependency>
20 <dependency>
21
22 <groupId>[Link]</groupId>
23 <artifactId>cucumber-testng</artifactId>
24 <version>${[Link]}</version>
25 <scope>test</scope>
26 </dependency>
27
28 <!-- Selenium -->
29 <dependency>
30 <groupId>[Link]</groupId>
31 <artifactId>selenium-java</artifactId>
32 <version>${[Link]}</version>
33
</dependency>
34 <!-- Web Driver Manager -->
35 <dependency>
36
37
38 <groupId>[Link]</groupId>
39 <artifactId>webdrivermanager</artifactId>
40 <version>${[Link]}</version>
41 </dependency>
42 <!-- TestNG -->
43 <dependency>
44
45 <groupId>[Link]</groupId>
46 <artifactId>testng</artifactId>
47 <version>${[Link]}</version>
48 <scope>test</scope>
49 </dependency>
50
</dependencies>
Step 9 – 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, which are already bound to specific phases of the default lifecycle:
compile – compile main source files
testCompile – compile test source files
1 <build>
2 <plugins>
3 <plugin>
4 <groupId>[Link]</groupId>
5 <artifactId>maven-compiler-plugin</artifactId>
6 <version>${[Link]}
7 </version> <configuration>
8 <source>${[Link]}</source>
9 <target>${[Link]}</target>
10 </configuration>
11 </plugin>
12 <plugin>
13 <groupId>[Link]</groupId>
14 <artifactId>maven-surefire-plugin</artifactId>
15 <version>${[Link]}</version>
16 <configuration>
17 <suiteXmlFiles>
18 <suiteXmlFile>[Link]</suiteXmlFile>
19
</suiteXmlFiles>
20
</configuration>
21
</plugin>
22
23 </plugins>
</build>
If you don’t add a compiler plugin to the [Link] and when you will try to run the
tests through Maven, then the build will fail with the below message.

The complete [Link] is shown below.


1 <project xmlns="[Link] xmlns:xsi="[Link]
2 xsi:schemaLocation="[Link] [Link]
3 <modelVersion>4.0.0</modelVersion>
4
5 <groupId>[Link]</groupId>
6 <artifactId>Cucumber_TestNG_Demo</artifactId>
7 <version>1.0-SNAPSHOT</version>
8 <packaging>jar</packaging>
9 <name>Cucumber_TestNG_Demo</name>
10 <url>[Link]
11
12 <properties>
13
14 <[Link]>UTF-8</[Link]>
15 <[Link]>7.14.0</[Link]>
16 <[Link]>4.15.0</[Link]>
17 <[Link]>5.3.2</[Link]>
18 <[Link]>7.8.0</[Link]>
19 <[Link]>3.11.0</[Link]>
20 <[Link]>3.2.1</[Link]>
21 <[Link]>17</[Link]>
22 <[Link]>17</[Link]>
23 </properties>
24 <dependencies>
25
26
27 <dependency>
28 <groupId>[Link]</groupId>
29 <artifactId>cucumber-java</artifactId>
30 <version>${[Link]}</version>
31
</dependency>
32 <dependency>
33
34
35 <groupId>[Link]</groupId>
36 <artifactId>cucumber-testng</artifactId>
<version>${[Link]}</version>
37
<scope>test</scope>
38
39 </dependency>
40 <!-- Selenium -->
41 <dependency>
42
43 <groupId>[Link]</groupId>
44 <artifactId>selenium-java</artifactId>
45 <version>${[Link]}</version>
46 </dependency>
<!-- Web Driver Manager -->
47 <dependency>
48
49
50 <groupId>[Link]</groupId>
51 <artifactId>webdrivermanager</artifactId>
52 <version>${[Link]}</version>
53 </dependency>
54
55 <!-- TestNG -->
56 <dependency>
57 <groupId>[Link]</groupId>
58 <artifactId>testng</artifactId>
59 <version>${[Link]}</version>
<scope>test</scope>
60 </dependency>
61
62 </dependencies>
63 <build>
64 <plugins>
65 <plugin>
66 <groupId>[Link]</groupId>
67 <artifactId>maven-compiler-plugin</artifactId>
68 <version>${[Link]}</version>
69 <configuration>
70 <source>${[Link]}</source>
71 <target>${[Link]}</target>
72 </configuration>
73 </plugin>
74 <plugin>
75 <groupId>[Link]</groupId>
76 <artifactId>maven-surefire-plugin</artifactId>
77 <version>${[Link]}</version>
78 <configuration>
79
<suiteXmlFiles>
80
<suiteXmlFile>[Link]</suiteXmlFile>
81
</suiteXmlFiles>
82
</configuration>
83
84 </plugin>
85 </plugins>
86 </build>
87
</project>

Step 10 – Create a feature file under src/test/resources/features


It is recommended to create a features folder in src/test/resources directory. Create all the feature
files in this features folder. Feature file should be saved as an extension of .feature. The test
scenarios in the Feature file are written in Gherkins language. Add the test scenarios in this feature
file. I have added sample test scenarios.
1 Feature: Login to HRM Application
2 Background:
3
4 Given User is on HRMLogin page "[Link]
5 @ValidCredentials
6 Scenario: Login with valid credentials
7
8
9 When User enters username as "Admin" and password as "admin123"
10 Then User should be able to login sucessfully 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 |
Step 11 – Create the step definition class in src/test/java
Create the step definition class corresponding to the feature file to test the scenarios in the
inthis
src/test/java directory. The StepDefinition files should be created
definitions directory within the folder called definitions.

Below is the step definition of the LoginPage feature file.


1 package [Link];
2 import [Link];
3 import [Link];
4 import [Link];
5 import [Link];
6 import [Link];
7 import [Link];
8 import [Link];
9 import [Link];
10 import [Link];
11 import [Link];
12 import [Link];
13 import [Link];
14
15
16 public class LoginPageDefinitions {
17 private static WebDriver driver;
18 public final static int TIMEOUT = 5;
19 @Before
20 public void setUp() {
21
22
23 [Link]().setup();
24 ChromeOptions options = new ChromeOptions();
25 [Link]("--start-maximized");
26 driver = new ChromeDriver(options);
27 [Link]().timeouts().implicitlyWait([Link](TIMEOUT));
28
29 }
30 @Given("User is on HRMLogin page {string}")
31 public void loginTest(String url) {
32
33
34 [Link](url);
35
36 }
37
38 @When("User enters username as {string} and password as {string}")
39 public void goToHomePage(String userName, String passWord) {
40
41
// login to application
42
[Link]([Link]("username")).sendKeys(userName);
43
[Link]([Link]("password")).sendKeys(passWord);
44
[Link]([Link]("//*[@class='oxd-form']/div[3]/button")).submit();
45
46 // go the next page
47
48 }@Then("User should be able to login successfully and new page open")
49 public void verifyLogin() {
50
51
52
53 String homePageHeading = [Link]([Link]
54 ("//*[@class='oxd-topbar-header-breadcrumb']/h6")).getText();
55 //Verify new page - HomePage
56 [Link](homePageHeading, "Dashboard");
57
58 }
59
60 @Then("User should be able to see error message {string}")
61 public void verifyErrorMessage(String expectedErrorMessage) {
62 String actualErrorMessage = [Link]([Link]("//*[@class='orangehrm-login-
63 error']/d
64 // Verify Error Message
65 [Link](actualErrorMessage, expectedErrorMessage);
66
67 }
68
69 @After
70 public void teardown() {
71
72 [Link]();
73 }
74
75 }

assertThat() and containsString are imported from package:-


1 import static [Link];
2 import static [Link];
Step 12 – Create a TestNG Cucumber Runner class in src/test/java
We need to create a class called Runner class to run the tests. This class will use the TestNG tation
anno@RunWith(), which tells TestNG what is the test runner class. TestRunner should eated be
crunder src/test/java within the folder called runner.

Below is the code for the Cucumber Runner


[Link]
1 2 3 [Link];
import [Link];
4 @CucumberOptions(tags = "", features = {"src/test/resources/features/[Link]"}, glue
5 plugin = {})
6
7 public class CucumberRunnerTests extends AbstractTestNGCucumberTests {
8 }
9
AbstractTestNGCucumberTests – Runs each cucumber scenario found in the features as a
sep rate test.
Step 13 – Test Execution through TestNG
Go to the Runner class and right-click “Run As TestNG Test”. The tests will run as TestNG
tests. This is for Eclipse.

“Run CucumberRunner Tests “.


In case you are using IntelliJ, then select
This is what the execution console will look like in Eclipse.

Note:- If the test execution fails with the below-shown error, that means you have Chrome
Version 111 installed on your machine which is not compatible with Selenium Version 4.8.2
and below. Please refer to this tutorial to fix the issue – Selenium Tests failing on Chrome
Version 111.

Step 14 – Run the tests from [Link]


Create a [Link] shown below and run the tests as TestNG.
Below is an example of [Link].
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE suite SYSTEM "[Link]
3 <suite name="Suite">
4 <test name="Cucumber with TestNG Test">
5 <classes>
6 <class name="[Link]"/>
7 </classes>
8 </test> <!-- Test -->
9 </suite> <!-- Suite -->
Step 15 – Run the tests from Command Line
Run the below command in the command prompt to run the tests and to get the test execution
report.
1 mvn clean test
The execution screen looks like something as shown below.

Step 16 – Cucumber Report Generation


Add [Link] undersrc/test/resourcesand add the below instruction in the file.
1 [Link]=true
Below is the image of the Cucumber Report generated using the Cucumber Service.

Step 17 – TestNG Report Generation


TestNG generates various types of reports under the
test-outputor target folder likeemailable-
[Link], [Link], [Link].
We are interested in the ‘[Link]’ report. Open “[Link]“, as
this is an HTML report, and open it with the browser. The below image shows emailable-
[Link].
[Link]
[Link]
TestNG also produce “[Link]” report, and it resides under test-outputfolder. The
[Link] report.
below image shows the

Result

Common questions

Powered by AI

TestNG paired with Maven enhances integration testing of e-commerce platforms by streamlining the testing and build process. TestNG provides advanced testing capabilities such as annotations, grouping, and parallel execution, facilitating structured and comprehensive test setups. Maven automates dependency management, project configuration, and builds processes, all critical for maintaining consistent test environments. This combination allows for easier integration of various tests into the continuous integration pipeline, improving test reliability and reducing manual overhead .

Load testing is critical early in the software life cycle of an e-commerce application to identify potential performance bottlenecks and ensure the application can handle expected user traffic effectively before significant deployment and marketing investments. Establishing load testing plans early allows for timely adjustments based on performance insights, mitigating risks of service interruptions post-launch. Commonly used tools for load testing include Microsoft Application Center Test (ACT) and Empirix’s e-Test, which provide capabilities to simulate real-world user conditions and measure system robustness under load .

The primary components to test in an e-commerce application for security include authentication, access control, transparency, delivery, and reliability. Authentication ensures the data is sent by authorized users, preventing impersonation. Access control secures data against unauthorized users, protecting sensitive user information like financial data. Transparency ensures that the user receives exactly what is sent, preventing data tampering during transmission. Delivery guarantees the information reaches the intended recipient without interception. Reliability checks ensure minimal service disruption, maintaining consistent data protection and availability, even under stress conditions .

Security testing ensures the payment processing functions of an e-commerce site are free from vulnerabilities that could expose sensitive financial data. Key elements include testing for secure transmission protocols to safeguard data during transfers, validating encryption of payment information to prevent interception, and conducting penetration testing to identify potential entry points for unauthorized access. Additionally, testing for robust authentication and authorization processes ensures that only legitimate transactions are processed, reducing risk from fraudulent activities and enhancing consumer trust .

Integrating Selenium with a Maven project benefits automated testing frameworks by managing dependencies and builds effortlessly, facilitating the integration of Selenium’s web automation capabilities. Steps to set up such a framework include installing Java and Maven, setting up the Eclipse IDE, creating a Maven project, and adding Selenium dependencies in the pom.xml file. This configuration allows for creating and running Selenium test scripts, managing them with Maven for build consistency, and using TestNG for executing and reporting, significantly improving testing efficiency and reducing complexity .

Browser compatibility testing ensures a web application behaves consistently across different web browsers, which is crucial for user experience and accessibility in e-commerce. Challenges include dealing with unique rendering engines and JavaScript engines of different browsers, making exhaustive testing impractical due to the sheer number of browser versions. An effective approach involves using a browser compatibility matrix to identify high-priority browsers and platforms, focused testing on these platforms to ensure general functionality, and employing automated tools to streamline the process and detect discrepancies .

Functional testing ensures that an e-commerce application's features work as intended, covering areas such as usability, mainline functionalities, and accessibility. Boundary value analysis (BVA) contributes by identifying defects at the edge of input ranges, ensuring robust handling of input limits. Equivalence class testing simplifies the process by categorizing inputs into equivalent partitions where test cases validate one representative input per class. These methods help efficiently create functional test cases, minimizing redundant tests and revealing potential issues with both normal and edge-case inputs .

Database testing in e-commerce applications focuses on verifying data integrity, security, and performance. Methods include ensuring that database operations such as backups, crash recovery, and transactions return the database to a consistent state and verifying the correctness of concurrent access controls to prevent data corruption. Additionally, capacity testing checks the database's ability to store and manage large volumes of data efficiently. These methods are significant as they safeguard sensitive user data from unauthorized access and ensure reliable service performance even under concurrent user demands, essential for maintaining user trust .

Key functionalities in user interface testing for an e-commerce site include verifying the proper operation of links, forms, and various interface elements like text fields, radio buttons, and checkboxes. Ensuring the correct display and responsiveness of navigational components like menus and error messages is also crucial. These functionalities are critical as they directly impact usability, influencing the ease with which users interact with the site, make purchases, and access needed information without errors or frustrations, thus enhancing the overall user experience .

Performance testing evaluates if an e-commerce application can handle the demand during peak hours by monitoring its responsiveness, stability, and scalability. Load testing, a subset of performance testing, simulates a specified number of users to verify the application can manage expected user traffic by measuring metrics like response time and throughput under common maximum loads. Stress testing goes beyond typical limits, applying extreme conditions to identify application breaking points and assess recovery capabilities, focusing on system behavior under overloads. Key metrics include the number of concurrent users, response time, network bandwidth, and system recovery time after failures .

You might also like