0% found this document useful (0 votes)
4 views44 pages

STA Lab Manuel Student

The document outlines the development of a test plan and test cases for an e-commerce web/mobile application, focusing on key components such as main pages, product pages, and shopping cart functionalities. It details the scope, objectives, roles, responsibilities, and methodologies for testing various features, including user navigation, product creation, and payment processes. Additionally, it emphasizes the importance of thorough testing to ensure the application's functionality, usability, and security.

Uploaded by

leodhasannan
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)
4 views44 pages

STA Lab Manuel Student

The document outlines the development of a test plan and test cases for an e-commerce web/mobile application, focusing on key components such as main pages, product pages, and shopping cart functionalities. It details the scope, objectives, roles, responsibilities, and methodologies for testing various features, including user navigation, product creation, and payment processes. Additionally, it emphasizes the importance of thorough testing to ensure the application's functionality, usability, and security.

Uploaded by

leodhasannan
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

TABLE OF CONTENTS

[Link] Date Title Page Marks Signature


No.
Develop the test plan for testing an e-
commerce web/mobile application
([Link]).
1.
Design the test cases for testing the e-
commerce application
2.

Test the e-commerce application and


report the defects in it.
3.

Develop the test plan and design the


test cases for an inventory control
system.
4.

5. Execute the test cases against a client


server or desktop application and
identify the defects.

Test the performance of the e-


commerce application.
6.

Automate the testing of e-commerce


applications using Selenium.
7.

Integrate TestNG with the above test


automation.
8.
[Link]. 1
Date: Develop the test plan for testing an e-commerce web/mobile application

Aim:
To develop the test plan for testing an e-commerce web/mobile application.

Procedures:

Ecommerce application architecture:

 An eCommerce application has 4 important elements – Main Pages, Product Pages,


Product Description Pages, and Shopping Cart. Understand these in detail to test e-
commerce websites and applications efficiently.
 Main Pages include homepage, privacy page, about us page, careers, etc. Product Page
includes different options for the product such as size, color, and other attributes. Sorting
and filtering features are considered as part of product type pages along with add-to-cart
and wishlist features.
 Product description page includes title, description, images, add to cart feature and
additional info, etc. The shopping cart page should include payment options and removing
a product from the cart.
 Overall, an eCommerce website or an application includes different user roles such as
customers, partners, staff, and service agents. Backend infrastructures include rules,
analytics, security, logging, and content management.
 The first layer which is revealed to the users is the presentation layer that includes the UI
for mobile, desktops. Responsiveness is kept in mind when designing this presentation
layer.
 Core Functionality includes Content, Marketing, Inventory Management, Orders, and
Catalog. Back-office functionality includes fulfillment, inventory, payment, and Catalog
staging. The conceptional view is shown below
Test Plan document for web application (Guru99 Bank):

1 Introduction
The Test Plan is designed to prescribe the scope, approach, resources, and schedule of all testing
activities of the project Guru99 Bank.

The plan identify the items to be tested, the features to be tested, the types of testing to be performed,
the personnel responsible for testing, the resources and schedule required to complete testing, and the
risks associated with the plan.

Scope
In Scope
All the feature of websiteGuru99 Bank which were defined in software requirement specs are need to
be tested

Module Name Applicable Roles Description


Customer: A customer can have multiple bank accounts. He can
Manager view balance of his accounts only
Balance Enquiry
Customer Manager: A manager can view balance of all the customers who
come under his supervision
Customer: A customer can have transfer funds from his “own”
Manager account to any destination account.
Fund Transfer
Customer Manager: A manager can transfer funds from any source bank
account to destination account
A Mini statement will show last 5 transactions of an account
Manager Customer: A customer can see mini-statement of only his “own”
Mini Statement
Customer accounts
Manager: A manager can see mini-statement of any account
A customized statement allows you to filter and display
transactions in an account based on date, transaction value
Customized Manager Customer: A customer can see Customized- statement of only
Statement Customer his “own” accounts
Manager: A manager can see Customized -statement of any
account
Customer: A customer can change password of only his account.
Manager
Change Password Manager: A manager can change password of only his account.
Customer
He cannot change passwords of his customers
New Customer Manager Manager: A manager can add a new customer.
Manager: A manager can edit details like address, email,
Manager
telephone of a customer.
Currently system provides 2 types of accounts
• Saving
• Current
A customer can have multiple saving accounts (one in his name,
other in a joint name etc).
New Account Manager
He can have multiple current accounts for different companies
he owns.
Or he can have a multiple current and saving accounts.
Manager: A manager can add a new account for an existing
customer.
Manager: A manager can add a edit account details for an existing
Edit Account Manager
account
Delete Account Manager Manager: A manager can add a delete an account for a customer.
A customer can be deleted only if he/she has no active current or saving
Delete Customer Manager accounts
Manager: A manager can delete a customer.
Manager: A manager can deposit money into any account.
Deposit Manager
Usually done when cash is deposited at a bank branch.
Manager: A manager can withdraw money from any account.
Withdrawal Manager
Usually done when cash is withdrawn at a bank branch.

Out of Scope
These feature are not be tested because they are not included in the software requirement specs

 User Interfaces
 Hardware Interfaces
 Software Interfaces
 Database logical
 Communications Interfaces
 Website Security and Performance

Quality Objective
The test objectives are to verify the Functionality of website Guru99 Bank, the project should focus
on testing the banking operation such as Account Management, Withdrawal, and Balance…etc.
to guarantee all these operation can work normally in real business environment.

Roles and Responsibilities


The project should use outsource members as the tester to save the project cost.

No. Member Tasks


Manage the whole project
1. Test Manager Define project directions
Acquire appropriate resources
Identifying and describing appropriate test techniques/tools/automation architecture
Verify and assess the Test Approach
2. Test
Execute the tests, Log results, Report the defects.
Outsourced members
Developer in
3. Implement the test cases, test program, test suite etc.
Test
Test Builds up and ensures test environment and assets are managed and maintained
4.
Administrator Support Tester to use the test environment for test execution
Take in charge of quality assurance
5. SQA members Check to confirm whether the testing process is meeting specified requirements
2 Test Methodology

Overview

Test Levels
In the project Guru99 Bank, there’re 3 types of testing should be conducted.

 Integration Testing (Individual software modules are combined and tested as a group)
 System Testing: Conducted on a complete, integrated system to evaluate the system’s
compliance with its specified requirements
 /[Link]: Test all the APIs create for the software under tested
Bug Triage

Suspension Criteria and Resumption Requirements


If the team members report that there are 40% of test cases failed, suspend testing until the
development team fixes all the failed cases.

Test Completeness

 Specifies the criteria that denote a successful completion of a test phase


 Run rate is mandatory to be 100% unless a clear reason is given.
 Pass rate is 80%, achieving the pass rate is mandatory

Project task and estimation and schedule


Task Members Estimate effort
Create the test specification Test Designer 170 man-hour
Perform Test Execution Tester, Test Administrator 80 man-hour
Test Report Tester 10 man-hour
Test Delivery 20 man-hour
Total 280 man-hour
Schedule to complete these tasks

3. Test Deliverables
Test deliverables are provided as below

Before testing phase

 Test plans document.


 Test cases documents
 Test Design specifications.

During the testing

– Test Tool Simulators.

– Test Data

– Test Trace-ability Matrix – Error logs and execution logs.

After the testing cycles is over

 Test Results/reports
 Defect Report
 Installation/ Test procedures guidelines
 Release notes
4. Resource & Environment Needs

4.1 Testing Tools

No. Resources Descriptions

Need a Database server which install MySQL server


1. Server
Web server which install Apache Server

Develop a Test tool which can auto generate the test result to the predefined form and
2. Test tool
automated test execution

3. Network Setup a LAN Gigabit and 1 internet line with the speed at least 5 Mb/s

5. Computer At least 4 computer run Windows 7, Ram 2GB, CPU 3.4GHZ

Test Environment
It mentions the minimum hardware and software requirements that will be used to test the
Application.

Following software’s are required in addition to client-specific software.

 Windows 11 and above


 Office 2021 and above
 MS Exchange, etc.

Result:
Thus the test plan for testing the e-commerce web application has been developed
successfully.
Ex. No. 2
Date: Develop the test case for testing the e-commerce application

Aim:
To develop the test case for testing the e-commerce application.

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
i. 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

ii. 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

iii. 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)
iv. Filter Results

 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

Example of a filter
v. 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.
vi. 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.
vii. 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

viii. 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
As you can see, an eCommerce website has many more tests or features, and testing
each is very time-consuming and requires effort.

Result:
Thus the test cases for testing the e-commerce web application has been developed
successfully.
Ex. No. 3
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.

E-Commerce Testing – How to Test an eCommerce Website/Application

In today’s world, I bet you won’t find anyone who hasn’t shopped online. E-commerce/Retail is
a business that thrives on its online customers. Shopping in person vs. shopping online has many
advantages. Convenience, time-saving and easy access to products worldwide, etc.

A good E-commerce/Retail site is key to its success. It must be a worthy counterpart to the
storefront. Because, when you go shopping at a physical store, the customer has already made a
commitment to visit and might give the brand a chance.

The better the site, the better the [Link] so much lays on the application, it is
critical that it undergoes thorough testing.

E-commerce application/sites are web applications or mobile application too. So, they
undergo all the typical test types.
 Functional Testing
 Usability Testing
 Security Testing
 Performance Testing
 Database Testing
 Mobile Application Testing
 A/B testing.
1) Homepage – Hero Image
Homepages of retail sites are busy. They have a lot going on. But almost all of them
have a Hero Image:

This is the kind of the clickable image (a slideshow of sorts) that occupies the majority
of the page.

The following are a few things to test:


 Is it going to auto scroll?
 If yes, at what interval will the image be refreshed?
 When the user hovers over it, is it still going to scroll to the next one?
 Can it be hovered on?
 Can it be clicked on?
 If yes, is it taking you to the right page and right deal?
 Is it loading along with the rest of the page or loads last in comparison to the
other elements on the page?
 Can the rest of the content be viewed?
 Does it render the same way in different browsers and different screen
resolutions?
2) Search
Search algorithms are very important for the success of a retail site because we can’t
always place what the users want to see right in front of their eyes.

Common tests are:


 Search based on the Product name, brand name, or something more broadly, the
category. For example Camera, Canon EOS 700D, electronics, etc. 
 Search Results have to be relevant
 Different sort options have to be available- based on Brand, Price, and
Reviews/ratings etc. 
 How many results to display per page?
 For multi-page results, are there options to navigate to them
 Also, search happens in many places. Please take the search drilling down into
multiple levels into consideration when validating this functionality. For
example: When I search on the home page, I might see something like this:

3) Product Details Page


Once a user finds a product either through search or by browsing or by clicking on it
from the homepage, the user will be taken to the product information page.

Check:
 Image or images of the product
 Price of the product
 Product specifications
 Reviews
 Check out options
 Delivery options
 Shipping information
 In-stock/Out of stock
 Multiple color or variations options
 Breadcrumb navigation for the categories (highlighted in Red below). If
navigation such as that is displayed, make sure every element of it is functional.
4) Shopping Cart

This is the penultimate stage before the user commits to the purchase.

Test the following:


 Add items to the cart and continue shopping
 If the user adds the same item to the cart while continuing to shop, the item
count in the shopping cart should get incremented
 All items and their totals should be displayed in the cart
 Taxes as per location should be applied
 A user can add more items to the cart- total should reflect the same
 Update the contents added to the cart- total should reflect that too
 Remove items from the cart
 Proceed to checkout
 Calculate Shipping costs with different shipping options
 Apply coupons
 Don’t check out, close the site, and come back later. The site should retain the
items in the cart
5) Payments

 Check different payment options


 If allowing check out as Guest, simply finish the purchase and provide an option
to register at the end
 Returning customers – Login to check out
 User sign up
 If storing customer Credit card or any other financial information, perform
security testing around this to make sure it is secure.(PCI compliance is a must)
 If the user is signed up for a long time, make sure the session is timed out or not.
Every site has a different threshold. For some, it is 10 minutes. For some, it
might be different.
 Emails/Text confirmation with the order number generated
6) Categories/Featured Products/Related or Recommended Products
The most popular FAQ I get from E-commerce testers is: Do I have to test every
category/every product?
The answer is NO.
If you are a returning customer you will be shown some recommended products on the
home page or in your shopping cart.

Featured products also change almost every day.

Since these are dynamic elements, the best way to test these parts of the application is to
test the algorithm based on which these sections are populated.

Check your Data mining/BI systems and check from the backend the queries that
populate these sections.

7) After-Order Tests

Check:
 Change the Order
 Cancel the Order
 Track the Order
 Returns
8) Other Tests
 Login
 FAQs
 Contact Us page
 Customer Service page etc.

Result:
Thus the e-commerce application has been tested successfully.
Ex. No. 4
Date: Develop the test plan and design the test cases for an inventory control system

Aim:
To develop the test plan and design the test cases for an inventory control system.

Inventory Business Processes


 To make sure nothing gets missed, each test deliverable should be assigned to a specific
person on your team in a section on roles and responsibilities.
 It’s important to remember that this is just a basic framework of what to include in a test
plan. Over time, you’ll create your own library of test plan templates that will serve as
guides for new product releases, updates, and features.
 Analyze the product or feature you’re testing
 You need to have a deep understanding of the product or feature before you can start
creating a test plan for it. For example, let’s say you’ve just gone through a website
redesign and want to test it before launch.
 Talk with the designer and developer to understand the scope, objectives, and
functionality of the site.
 Review the project documentation (such as your SOW, project proposal, or even the tasks
in your project management tool).
 Perform a product walkthrough to understand the functionality, user flow, and limitations.
 This step is what gives you the context to write your test plan introduction and objectives
and start to plan out the resources you’ll need to complete it.
What Is Test Case Design?
To begin a software project, engineers should plan and document tests within the project’s scope.
This is part of a test case design.

More specifically, a test case design is a document that includes the test’s scope, the test strategy,
the test environment, the software pieces for testing, the intended test actions within the project,
the resources, and a schedule.

Thus, developing test case designs aims to define the test strategy within the project; plan resource
allocation; and clarify responsibilities, risks, and priorities.

However, as applications change, test cases may require updates. Therefore, preparing test case
designs begins with the early stages of the software lifecycle. A test case design plan is sometimes
a product or tool for performing necessary functions within a project’s scope.

After an engineer completes the test case planning process, the test case design process begins.
This process includes

 preparing the test environment;


 writing test cases for integration, system, and acceptance testing; and
 preparing test procedures.

Expand Your Test Coverage


Fast and flexible authoring of AI-powered end-to-end tests — built for scale.
Preparing the Test Case Design Environment

Test engineers run various tests in an environment that includes the software and hardware they
describe. While preparing the test environment, engineers develop auxiliary test software to use
in the tests.

Then, they may use some helpers in testing software, including:

1. Test data generators—This software produces the test input data necessary to execute test
cases.
2. Debugger—This software enables errors encountered during the tests to be found on the
source code.
3. Emulators and simulators—These software types imitate the real hardware that the
software needs; they provide the hardware data necessary for the tests.
4. Stubs and drivers—These small pieces of software replace nonfunctional system
components required for tests.

Engineers must record the test environment used for testing, hardware specifications, software
versions, etc., so that if the same test must run again, these records are available for reuse.

Writing Test Case Design

After a software project’s requirements are approved, the test case design phase begins. While
system analysts, system engineers, and software engineers prepare the system requirements and
software requirements, the test team determines the test strategy suitable for the project and
updates the relevant test plans.

Then, while system and software developers perform preliminary design and detailed designs, the
test team starts to create test cases.
Engineers can validate a requirement with one test case or multiple test cases. For this purpose,
they should write at least one test case for each requirement to demonstrate that the developed
software meets all of its specifications.

However, these written test cases are usually positive test cases that’ll test the requirement’s
positive side. In addition, the necessary requirements should also include test cases that show how
the software will behave in negative situations.

When the developed software performs all of the expected behaviors, this indicates that all
software test cases have been tested.

A test case is an input used to demonstrate that a particular part of the program works, or that a
requirement is verified, the necessary steps taken, and the test has yielded the expected results.

Test Case Content


A test case should include

1. the purpose and conditions for its execution,


2. a step-by-step setup of the test environment,
3. input data,
4. the expected result,
5. the actual result,
6. a version description of the software,
7. the software’s working environment, and
8. the test ID.

Engineers should only test one item property at a time. Thus, if the test case runs and fails, it’s
easy to see which feature is problematic. In addition, test cases should include known inputs.
Moreover, these inputs and expected outputs are given as validation points in test cases.

If the software gives the expected inputs and expected result, the relevant test case passed.

Furthermore, tests performed when all or a specified proportion of the tested item’s test cases pass
are considered successful.

Test Case Format


Here are some various test case format templates.

Example Test Case :

Name make all test for src folder

Case Author John Doe


Tester Name Jane Doe

Project ID / Name Fedora Neural Network Library

Test Loop ID 0053

Date Tested April 23, 2022

Example Test Case :

Test Test
Expected Actual Requirement
Case Objective Category Condition
Results Results ID
ID ID

CMake
Server- (previous
0048 0011 Passes Failed 00132
Side version
will used)

Example Test Case :

Test Case ID :
Comments Incorporated By: Date
Reviewer :
Incorporated :
Date of Review :
New Version :
Version :

Severity
C – Critical Close
No Page No Step No Comments Action
M – Major (Y/ N)
S – Small

4
Test Case ID : Reviewer
Comments Incorporated By:
:
Date Incorporated :
Date of Review :
Version : New Version :

Engineers can implement these test cases and write test scripts to record the results manually or
automatically. Whether test case applications are manual or automatic, they should be recorded
under all circumstances.

Test Types for Test Case Design

Tests in software projects are carried out in four different stages. As these tests’ detail levels
increase, the size of the piece tested decreases.

These test stages are

1. unit tests,
2. software integration tests,
3. system tests, and
4. acceptance tests.

Unit Tests

Unit tests confirm that small pieces of code, such as methods, procedures, or classes, are working
correctly. In order to do this, separate the unit tested from other units. Then, use stubs of those
methods instead of other units that’ll provide the necessary inputs for the unit under test.

Thus, a possible error in the other unit will not affect the unit under test.

Test cases are created according to the task performed by the unit being tested. Using these
situations, the unit test is run, and the results are compared with the expected results to decide
whether the tests were successful or not.

Unit Test Example


For example, let’s say there’s a method called isitPositive (int k). In this method, if the integer
variable k is negative, the method returns as true, and if the k integer variable is positive, the
method returns as false. The following snippet is an example of this method:

public bool isitPositive(int k)

{
if(k<0)

return true;

else(k>0)

return false;

To test this method, the cases where the k value is tested by first giving values less than 0 and then
greater than 0 are shown:

public void testCase_1()

bool tc1 = false;

int m = 3;

td1 = isitPositive(m);

if(tc1 == true)

[Link]("Test Case 1: Passed");

else

[Link]("Test Case 1: Fail");

public void testCase_2()

bool tc2 = true;

int m = 4;

tc2 = isitPositive(m);

if(tc2 == false)

[Link]("Test Case 2: Passed");

else
[Link]("Test Case 2: Fail");

Integration Tests

After successfully concluding unit tests in software projects, integration tests begin. Although unit
tests serve to verify that the individual modules perform their expected functions, integration tests
aim to verify that the components in an integrated software work in harmony with each other.

In tests, both positive and negative test cases use the appropriate parameters. Then, the results are
compared with the expected values to verify that the system performs the expected behavior.

Integration tests can use different strategies, including big bang, bottom-up, or top-down.

Big Bang Strategy


After integrating with each other all the high- and low-level modules developed according to the
big bang strategy, the tests begin.

In this strategy, since the tests involve considering the system as a whole, performing them is fast
and saves time. However, it’s difficult to determine at which level layer or from which module an
error occurs.

Big Bang diagram


Bottom-Up Strategy
First, the bottom-up integration testing strategy starts with running unit tests.

Then, lower-level modules that successfully complete unit tests are integrated with each other.
After this, integration tests are performed on low-level modules.

Following the successful completion of these tests, a system of upper-layer modules is integrated,
and the necessary integration tests are performed. This integration continues until the whole
system is built and the integration tests are completed successfully.

In this approach, the basic condition is that the unit tests of the modules to be integrated are
successfully completed. This approach can help easily determine how much of the targeted system
is completed and tested, represented as a percentage.
Bottom-up diagram
Top-Down Strategy
The top-down integration testing strategy starts with testing the top module (the outermost
module, usually the user GUI module) for the system. This module uses the stubs of the required
submodules.

Top-down diagram
The number of test cases run reaching a certain rate or passing all of them indicates completed
integration tests. Engineers should report errors found at this stage to software developers
according to a defined error-reporting mechanism.

System Tests

System tests evaluate the developed software’s features including performance, reliability, and
functionality. It’s verified that the software developed in unit tests and integration tests is
developed in accordance with the design.

On the other hand, system tests aim to verify what the customer wants from the system. For this
reason, in system test cases, scenarios encountered in the real environment are defined based on
the system requirements.
Steps
The first step of system testing is verifying the functional requirements performed. As a result of
this verification, engineers can see that the system works functionally. After verifying
functionality, they perform non-functional tests.

Nonfunctional Tests

 stress tests—These tests help observe the system’s behavior when the input rate to the
system exceeds the system design rate.
 performance tests—These tests evaluate whether the system outputs can be produced
within the specified and acceptable time frame.
 configuration and compatibility tests—These tests evaluate how the developed system
behaves on different platforms and hardware.
 security tests—These tests evaluate the system’s behavior in unauthorized use attempts.
 usability tests—These tests evaluate user-system interaction and ergonomics.
 rollback tests—These tests evaluate the system’s automatic or manual recovery in the
event of a failure.
 user interface tests—These tests evaluate how the user and the software will interact as a
graphical representation, and how the system will process the inputs that the user will give
to the system with the keyboard, screen, or mouse (i.e., the touchpad).

The system that has its nonfunctional tests completed is now ready for user acceptance tests. Errors
that occur during system tests are reported according to the project error management process, and
necessary corrections are made.

After the necessary fixes, the system undergoes iterative tests to evaluate that the fixes did not
affect the rest of the system.
Acceptance Tests

Project acceptance tests validate customer requirements.

For this purpose, test cases serve to validate each user requirement. In the developed system, these
defined test cases are applied in accordance with the “acceptance test plan” with the customer’s
participation.

To sum up, after the entire system passes these tests, the customer can accept the system.

Conclusion
To summarize, we’ve highlighted how important test case design is. Software testing becomes
much more important in very large projects because a product on the market that is constantly
causing problems due to malfunctions causes a great loss of time and money.

For example, test engineers with good theoretical knowledge are very important for projects that
have an important place in software technologies such as banking software, military software,
public software, and games.

To that end, the need for good testers and good coders increases day by day.

Result:
Thus, the test plan and test case has been developed and designed for the inventory
management system.
Ex. No. 5 Execute the test cases against a client server or desktop application and identify
Date: the defects

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

Client Server
The Client-Server application consists of two systems, one is the Client and the other is the Server.
Here, the client and server interact with each other over the computer network.
In Client-Server application testing, the client sends requests to the server for specific information
and the server sends the response back to the client with the requested information. Hence, this
testing is also known as two-tier application testing.

Few client-server applications are Email, Web Server, FTP, etc

This type of testing is usually done for 2 tier applications (usually developed for LAN). We will
be having Front-end and Backend here.

Applications launched on the front-end will have forms and reports which will be monitoring and
manipulating data.

Types of Testing to Perform


Below are the different testing techniques to be performed:


GUI Testing (UI Testing)

Functional Testing

Manual Testing

Configuration Testing

Load Testing (Back-end Testing)

Performance Testing

Interoperability Testing

Compatibility Testing (Software/Hardware)
Merits & Demerits
Merits:
 All the data is located at the central location (Server), hence data is protected
easily by providing access to authorized users.
 Data can be accessed efficiently even if the server is located away from the
clients.
Demerits:
 If multiple clients send requests to the same server in parallel, it leads to
congestion in the network because the server may get overloaded.
 Due to any reason, if a server fails then none of the client requests can be fulfilled
and this leads to the disruption of the client-server network.
 The cost of setting up and maintaining the server is high.
What Is Web Testing?
Testing Web Applications is a bit different and complicated when compared with Desktop
Application testing and Client-Server application Testing.

As the name hints, any application which is accessed over the internet through a browser is known
as a web application. Testing performed on these applications is known as Web Application
testing. Web Applications are launched using a URL in a browser. Web testing is performed on
different browsers and in different operating systems.

Here browser sends the request to the web server and the web server sends the same request to the
database and the database sends the response to the web server and the web server redirects the
same response to the browser. Hence, this is also known as three-tier application testing.

Few Web Applications are Yahoo, Facebook, Twitter, etc.

The picture below depicts what the Web application looks like:

This is done for 3 tier applications (developed for Internet/intranet/xtranet). Here we will be
having Browser, web server and DB server.

The applications accessible in the browser would be developed in HTML, DHTML, XML,
JavaScript, etc. (We can monitor through these applications).

Applications for the webserver will be developed in Java, ASP, JSP, VBScript, JavaScript, Perl,
Cold Fusion, PHP, etc. (All the manipulations are done on the webserver with the help of these
programs developed)

The DB server would have Oracle, SQL Server, Sybase, MySQL, etc. (All data is stored in the
database available on the DB server).

Web Application is a Three-Tier Application:


This has a browser (monitors data) [monitoring is done using HTML, Dhtml, XML, JavaScript] -
> webserver (manipulates data) [manipulations are done using programming languages or scripts
like adv java, asp, JSP, VBScript, JavaScript, Perl, ColdFusion, php] -> database server (stores
data) [data storage and retrieval is done using databases like Oracle, SQL Server, Sybase,
MySQL].

Characteristics:

 Internet connectivity is required to work on the web.


 The GUI feature is available on Web Applications.
 Can be accessed from anywhere with no location constraints.
Types of Testing to Perform
Below are the different testing techniques to be performed:

 GUI Testing (UI Testing)


 Functional Testing
 Manual Testing
 Security Testing
 Exploratory Testing
 Load Testing (Back-end Testing)
 Performance Testing
 Interoperability Testing
 Browser Compatibility Testing
 Storage and data volume testing
Merits & Demerits
Merits:
 Platform independent.
 Improves user experience and makes sure all functionalities are working fine.
 Ensure a high-quality web application as an end result.
 Can be accessed by multiple users at a time.
Demerits:
 Internet connectivity is required.
 Browser dependency.
 Applications can’t be accessed if the server is down.
What Is Desktop Testing?
A Desktop Application is a software program that is used to run on a personal computer, machine,
or laptop. Required applications or software are installed on a stand-alone machine and the
installed application is accessible by only one user at a time. Hence, desktop application testing is
also known as stand-alone application testing.

Few desktop applications are MS-Office, Calculator, Adobe Acrobat Reader, etc.

The image below depicts what the desktop application looks like:

Characteristics
 These applications are highly-developed to execute the applications on particular
operating systems.
 No internet connectivity is required to work on desktop applications.
Types of Testing to perform
Below are the different testing techniques to be performed:
 Usability Testing
 Functional Testing
 Load Testing (Back-end Testing)
 Performance Testing
 Security Testing
 Regression Testing
 Compatibility Testing (Software/Hardware)
Merits & Demerits
Merits:
 Doesn’t require any internet connection.
 Can be accessed very quickly.
 Hacking these applications is impossible because of high security.
Demerits:
 Confined to only one user to access the desktop application at a time.
 It is not possible to share the data.
 High maintenance is required as these applications need some storage to install.
Difference Between Desktop, Client-Server, And Web Application Testing

Desktop Application:
 Application runs in single memory (Front end and Back end in one place)
 Single user only
Client/Server Application:
 Applications run in two or more machines.
 Applications are menu-driven.
 Connected mode (connection always exists until logout).
 A limited number of users.
 Less number of network issues when compared to the web app.
Web Application:
 Applications run in two or more machines.
 URL-driven
 Disconnected mode (stateless)
 Unlimited number of users.
 Many issues like Hardware Compatibility, Browser Compatibility, Version
Compatibility, Security Issues, Performance Issues, etc.
As per the difference in both, the applications come from where and how to access the resources.
In Client-Server, once the connection is made, it will be in the state on connected, whereas in case
the web testing HTTP protocol is stateless, then there comes logic of cookies, which is not in
Client-Server.

For Client-Server application, users are well known, whereas for web application any user can log
in and access the content, he/she will use it as per his intentions.

Result:
Thus the test cases against a client server or desktop application and to identify the defects has
been developed and executed successfully.
Ex. No. 6
Date: Test the performance of the e-commerce application

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

Procedure:
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 the same behaviors or tendencies. In fact, it is very common for shoppers to take several
different paths while shopping online. As a result, QA teams must pay careful attention to testing
every user path possible to measure its impact on the application’s architecture.

3) Test Across Different Devices and Configurations

Today’s online consumer uses 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, etc., is
essential to determine if certain configurations negatively affect the performance of an application
or a website.

4) Test Payments Systems and Gateways

E-commerce websites and applications need to be able to handle multiple transactions at the 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
challenging. This is because most payment gateways providers do not provide a 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 virtual users.

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.

As online sales continue to grow and represent an important channel for retailers, performance
testing will continue to enable them to deliver high quality applications and sites. For help
planning or executing effective performance tests, do not hesitate to contact us.

Result:
Thus the performance procedure of the e-commerce application has been developed
successfully.
Ex. No. 7 Automate the testing of e-commerce applications using Selenium
Date:

Aim:
To automate the testing of e-commerce application using Selenium.

Procedure:
1. What should you know before automating this automation assignment?
You should know the following topics, before starting this project assignment:
• Software Testing Concepts
• Core Java Concepts
• Locators and Find Element Commands
• Selenium Webdriver Commands
• Actions Class Commands
• Selenium Wait Commands
2. Which functionalities will we automate in this project assignment?
We will learn to automate multiple test scenarios of an e-commerce website in this project like:

 Learn to automate User Registration and Login using Selenium commands


 Learn to automate clicking the slide-over menus with the Mouse hover command
 Learn to automate scroll action using the Mouse Events of Actions class
 Learn to automate Search Product
 Learn to automate Add to Cart Page
 At last, we'll learn to automate the end-to-end functionality of Buy Product,
 And we'll automate some other website filters

[Link] a Test Plan for [Link] like E-Commerce Website


Let's create a Test Plan for the functionalities which we are going to automate. You can create
positive and negative test cases around the following scenarios. We will be using this dummy
Online shopping website for this Project Assignment - [Link]
This website works exactly similar to any real e-commerce website like Amazon or Flipkart.
Testing Registration and Login of the Online Shopping Website

 Can a guest purchase product as a guest user?


 Can a guest able to register on the website easily?
 Once registered, can a user able to log in successfully?
 Can a registered user able to view all the products listed on the website?
 Are the user sessions being maintained for the intended time period?
 Is the user’s session timing out and expiring after a defined time?
 Is the registered user able to view and modify its user account information?
 Is the registered user not able to access the user account after logout?

Testing Search Feature of the Online Shopping Website

 Is the website having multiple filters to search products like., price range, category,
brands, etc.?
 Are relevant Products displaying after applying single or multiple search filters?
 Is there an option to display a fixed number of products on the search page?
 Is there any sort option available on the search page and is that working properly?

Testing the Product Details Page of the Online Shopping Website

 Is the page displaying all the product information on that page?


 Can a user select different sizes, colors, and quantities of the product?
 Is the page displaying any offers if applicable to the product?
 Is the page displaying the stock information correctly?
 Is the product getting added cart after doing so?

Testing the Shopping Cart of the e-commerce website

 Is the correct price getting displayed in the shopping cart for the selected product/s?
 Is there an option to apply coupon codes?
 Can a user increase or decrease the quantity of a product from the shopping cart?
 Can a user remove the product from the shopping cart?

Testing the Checkout Flow and Order Confirmation of the Online shopping website

 Does the user able to enter shipping and billing information or is it auto-filled, if the user
already saved it?
 Are all the supported payment methods working?
 Is the user's sensitive information handled securely, like credit/debit card info, address,
bank details etc?
 Is the user receives an email or sms on order confirmation?
 Can the user track the order?

[Link] the 'User Registration and Login' of Amazon like an e-commerce website
This section is focused on covering all the scenarios for User Registration for an e-commerce
website. In this assignment, you will learn the different Selenium commands which are used to
handle the web form. A web form is generally a collection of web elements like text boxes, radio
buttons, selection boxes, etc. And in web testing, we mostly face web forms and 90% of testing
revolves around web forms. We are going to cover both positive and negative scenarios for User
Registration.

Positive Scenarios:
 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:

This code is contributed by Uday. We have provided the code for only positive scenarios, you
should try automating negative scenarios yourself.

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
ext();

// Validate that user has created


if([Link]("Vsoft")) {
[Link]("User Verified,Test case Passed");
}
else {
[Link]("User Verification Failed,Test case Failed");
}
}
}

Negative Scenarios
 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."

 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.

 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.
Try automating the above scenarios using Selenium commands, if you face any difficulty please
refer to the Selenium Tutorial series.

 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:

The following code is contributed by Uday.

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
tle='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]();
}

5. 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.
 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]/di
v/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");
}

}
}
You should try automating the below-mentioned scenarios yourself for your practice. You can
also send your code to us via email or post in the comment section, we would be happy to share
your hard work on our website with your credentials.
 Test Case - Verify that 'Add to Wishlist' only works after login.
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. 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.'
 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:
Thus the automation of e-commerce application using Selenium has been written, executed and
verified successfully.
Ex No. 8 Integrate testNG with selenium automation
Date:

Aim:
To integrate testNG with selenium automation.
Implementation Steps:
1. Download and Install Java on the system
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. Run the tests from [Link]
8. TestNG Report Generation
Step 1- Download and Install Java
Selenium needs 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 – 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 – 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<!-- [Link] -->


2 <dependency>
3 <groupId>[Link]</groupId>
4 <artifactId>selenium-java</artifactId>
5 <version>3.141.59</version>
6 </dependency>
7
8<!-- [Link] -->
9 <dependency>
10 <groupId>[Link]</groupId>
11 <artifactId>testng</artifactId>
12 <version>7.4.0</version>
13 <scope>test</scope>
14 </dependency>
15
16
17 <!-- [Link] -->
18 <dependency>
19 <groupId>[Link]</groupId>
20 <artifactId>hamcrest</artifactId>
21 <version>2.2</version>
22 <scope>test</scope>
23 </dependency>
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
@BeforeTest – methods under this annotation will be executed prior to the first test case in the
TestNG file.
Advertisement
@AfterTest – methods under this annotation will be executed after all test cases in the TestNG
file are executed.
@Test – The annotated method is part of a test case.
Description – You can describe your test case under the description, stating what it does.
1 description = "This test validates title of login functionality"
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.
1 priority = 0
1public class TestNG_Demo {
2
3 WebDriver driver;
4
5 @BeforeTest
6 public void setUp() {
7 [Link]("[Link]",
8 "C:\\Users\\Vibha\\Software\\geckodriver-v0.26.0-win64\\[Link]");
9
10 driver = new FirefoxDriver();
11 [Link]("[Link]
12
13 [Link]().window().maximize();
14 [Link]().timeouts().implicitlyWait(30, [Link]);15
}
16
17 @Test(description = "This test validates title of login functionality", priority = 0)
18 public void verifyLoginPage() {
19
20 String expectedTitle = [Link]([Link]("//*[@id='logInPanelHeading']")).getText();
21
22 [Link]("Title :" + expectedTitle);
23 assertTrue([Link]("LOGIN Panel"));24
}
25
26 @Test(description = "This test validates successful login to Home page", priority = 1)
27 public void verifyHomePage() {
28
29 [Link]("Username Entered");
30 [Link]([Link]("txtUsername")).sendKeys("Admin");
31
32 [Link]("Password Entered");
33 [Link]([Link]("txtPassword")).sendKeys("admin123");
34
35 [Link]([Link]("btnLogin")).submit();
36
37 String newPageText = [Link]([Link]("welcome")).getText();
38 [Link]("newPageText :" + newPageText);
39 assertThat(newPageText, containsString("Welcome"));40
}
41
42 @AfterTest
43 public void teardown() {
44
45 [Link]();
46 }
47
48 }

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

TestNG also produces an “[Link]” report, and it resides under the test-output folder. 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:
Thus the steps to integrate TestNG with the automation of Selenium has been written, executed
and verified successfully.

You might also like