0% found this document useful (0 votes)
3 views43 pages

ST Practical

The document outlines practical exercises related to software testing, including the creation of a glossary of testing terminologies, the importance of SDLC and STLC, and various testing methodologies such as Waterfall and Agile. It also includes practical programming examples with corresponding test cases for control statements and modules like OTP verification and sales invoice management. Additionally, it emphasizes the use of testing techniques like equivalence partitioning and boundary value analysis to design effective test cases.

Uploaded by

bariyasandeep295
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views43 pages

ST Practical

The document outlines practical exercises related to software testing, including the creation of a glossary of testing terminologies, the importance of SDLC and STLC, and various testing methodologies such as Waterfall and Agile. It also includes practical programming examples with corresponding test cases for control statements and modules like OTP verification and sales invoice management. Additionally, it emphasizes the use of testing techniques like equivalence partitioning and boundary value analysis to design effective test cases.

Uploaded by

bariyasandeep295
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Software Testing (4360706) 239810307003

Practical:-1
Aim:-A). Create a glossary of at least five software testing terminologies
with explanations.
Software Testing is the process of evaluating a software application to ensure that it meets
specified requirements and works correctly without defects. It helps in identifying errors,
gaps, or missing requirements.
1. Test Case
A Test Case is a set of conditions, inputs, execution steps, and expected results designed to
verify a particular functionality of a software application.
2. Bug (Defect)
A Bug or Defect is an error or flaw in the software that causes it to produce incorrect or
unexpected results or behave differently from the specified requirements.
3. Verification
Verification is the process of checking whether the software is being developed according to
the specified requirements and design documents. It answers the question: “Are we building
the product right?”
4. Validation
Validation is the process of checking whether the developed software meets the user’s needs
and expectations. It answers the question: “Are we building the right product?”
5. Test Plan
A Test Plan is a formal document that describes the scope, objectives, testing approach,
resources, and schedule of testing activities.
6. Regression Testing
Regression Testing is performed to ensure that new changes or updates in the software do not
negatively affect existing functionality.

1
Software Testing (4360706) 239810307003

B). Describe why both SDLC and STLC are essential in the software
development process
1. SDLC (Software Development Life Cycle)
SDLC is a structured process followed to develop software in systematic phases such as:
 Requirement Analysis
 Design
 Implementation (Coding)
 Testing
 Deployment
 Maintenance

[SDLC]

Importance of SDLC:
 Provides a clear roadmap for software development.
 Ensures proper planning and documentation.
 Reduces project risk and development cost.
 Improves software quality.
 Helps complete the project within time and budget.

2. STLC (Software Testing Life Cycle)


STLC is a systematic process of performing testing activities in different phases such as:

2
Software Testing (4360706) 239810307003

 Requirement Analysis
 Test Planning
 Test Case Development
 Test Environment Setup
 Test Execution
 Test Closure

[STLC]

Importance of STLC:
 Ensures thorough and structured testing.
 Helps detect defects at early stages.
 Improves software reliability and performance.
 Ensures the product meets quality standards.
 Reduces maintenance cost after deployment.
Why Both SDLC and STLC Are Essential
 SDLC focuses on developing the software.
 STLC focuses on validating and verifying the software.
 SDLC ensures the product is built properly.
 STLC ensures the product works correctly and meets user requirements.

3
Software Testing (4360706) 239810307003

 Together, they ensure high-quality, reliable, and error-free software.

Practical 2
Aim:-Enlist and present at least three popular testing methodology (e.g.,
Agile, Waterfall) with its advantages and disadvantages.
Theory:
A Testing Methodology is a systematic approach used to perform software testing activities
during the Software Development Life Cycle (SDLC). Different methodologies are used
depending on project requirements, size, complexity, and client needs.
Below are three popular testing methodologies:
1. Waterfall Model
Description:
The Waterfall Model is a linear and sequential software development methodology where
each phase must be completed before the next phase begins. Testing is performed only after
the development phase is completed.

[Waterfall Model]

Phases:
 Requirement Analysis
 Design
 Implementation
 Testing

4
Software Testing (4360706) 239810307003

 Deployment
 Maintenance
Advantages:
 Simple and easy to understand.
 Clear documentation at every stage.
 Suitable for small projects with fixed requirements.
 Easy to manage due to defined stages.
Disadvantages:
 Testing starts very late.
 Difficult to make changes once development begins.
 Not suitable for complex or large projects.
 Higher risk if requirements change.

2. Agile Methodology
Description:
Agile is an iterative and incremental methodology where development and testing are
performed simultaneously in small cycles called Sprints. It focuses on customer collaboration
and continuous improvement.

[Agile model]

Features:
 Short development cycles (2–4 weeks).
 Continuous feedback from clients.

5
Software Testing (4360706) 239810307003

 Frequent releases.
Advantages:
 Flexible to requirement changes.
 Early detection of defects.
 Faster delivery of working software.
 Improved customer satisfaction.
Disadvantages:
 Less documentation.
 Requires skilled team members.
 Difficult to estimate cost and time accurately.
 Scope may expand frequently.

3. V-Model (Verification and Validation Model)


Description:
The V-Model is an extension of the Waterfall Model where testing activities are planned
parallel to development activities. Each development phase has a corresponding testing
phase.
Structure:
 Requirement → Acceptance Testing
 System Design → System Testing
 High-Level Design → Integration Testing
 Low-Level Design → Unit Testing

[V-model]
6
Software Testing (4360706) 239810307003

Advantages:
 Early test planning.
 Defects are identified at early stages.
 Clear relationship between development and testing.
 Suitable for projects with well-defined requirements.
Disadvantages:
 Not flexible to requirement changes.
 No early working prototype.
 Not suitable for dynamic projects.
Conclusion of Comparison
 Waterfall is best for small, fixed-requirement projects.
 Agile is best for dynamic and changing requirements.
 V-Model is best when quality assurance and early testing are priorities.

7
Software Testing (4360706) 239810307003

Practical 3
Aim:-Write program and design test cases for the following Control and
decision-making statement. 1) For... Loop 2) Switch...case 3) Do... While 4)
If...else
1) For Loop
Program (C Language Example)
#include <stdio.h>
int main() {
int i, sum = 0;
for(i = 1; i <= 5; i++) {
sum = sum + i;
}
printf("Sum = %d", sum);
return 0;
}
Test Cases

Test Case Input Value Expected Actual Status


ID Output Output
TC1 Loop from 1 to 5 Sum = 15 Sum = 15 Pass
TC2 Loop from 1 to 1 Sum = 1 Sum = 1 Pass
TC3 Loop condition false (i=1; Sum = 0 Sum = 0 Pass
i<=0)

2) Switch Case
Program
#include <stdio.h>
int main() {
int choice = 2;
switch(choice) {
case 1:
printf("Addition");

8
Software Testing (4360706) 239810307003

break;
case 2:
printf("Subtraction");
break;
case 3:
printf("Multiplication");
break;
default:
printf("Invalid Choice");
}
return 0;
}

Test Cases

Test Case ID Input (choice) Expected Output Actual Output Status


TC1 1 Addition Addition Pass
TC2 2 Subtraction Subtraction Pass
TC3 3 Multiplication Multiplication Pass
TC4 5 Invalid Choice Invalid Choice Pass

3) Do While Loop
Program
#include <stdio.h>
int main() {
int i = 1;
do {
printf("%d ", i);
i++;
} while(i <= 5);

9
Software Testing (4360706) 239810307003

return 0;
}

Test Cases

Test Case ID Initial Value Expected Output Actual Output Status


TC1 i=1 12345 12345 Pass
TC2 i=6 6 (runs once) 6 Pass
TC3 i=5 5 5 Pass

4) If Else Statement
Program
#include <stdio.h>
int main() {
int number = 10;
if(number % 2 == 0) {
printf("Even Number");
} else {
printf("Odd Number");
}
return 0;
}
Test Cases

Test Case ID Input (number) Expected Output Actual Output Status

TC1 10 Even Number Even Number Pass

TC2 7 Odd Number Odd Number Pass

TC3 0 Even Number Even Number Pass

TC4 -3 Odd Number Odd Number Pass

10
Software Testing (4360706) 239810307003

Practical 4
Aim:-Design test cases for different tasks (OTP Verification, Image upload,
Age verification in Registration) in any software modules using
Equivalence partitioning, boundary value analysis, and decision table
testing techniques of Black Box Testing.
Equivalence Partitioning (EP)
 Boundary Value Analysis (BVA)
 Decision Table Testing
1) OTP Verification Module
Assumption:
 OTP must be 6-digit numeric
 Valid range: 000000 to 999999
 OTP expires in 2 minutes
A) Equivalence Partitioning (EP)

Partition Type Test Data Expected Result


Valid (6-digit number) 123456 OTP Accepted
Invalid (Less than 6 digits) 12345 Error Message
Invalid (More than 6 digits) 1234567 Error Message
Invalid (Alphabets) abc123 Error Message
Invalid (Special Characters) 12@456 Error Message

B) Boundary Value Analysis (BVA)

Boundary Condition Test Data Expected Result

Minimum - 1 digit 99999 Error

Minimum valid 100000 Accepted

Maximum valid 999999 Accepted

Maximum + 1 digit 1000000 Error

C) Decision Table Testing

11
Software Testing (4360706) 239810307003

Condition Correct OTP Expired OTP Output


Case 1 Yes No Accept
Case 2 No No Reject

Case 3 Yes Yes Expired Message


Case 4 No Yes Reject

2) Image Upload Module


Assumption:
 Allowed formats: .jpg, .png
 Max size: 2MB
A) Equivalence Partitioning (EP)

Partition Type Test Data Expected Result


Valid format & size [Link] (1MB) Upload Success
Invalid format [Link] Error
File size > 2MB [Link] (3MB) Error
No file selected — Error
B) Boundary Value Analysis (BVA)

Boundary Condition Test Data Expected Result

Just below limit 1.9MB Success

Exactly 2MB 2MB Success

Just above limit 2.1MB Error

C) Decision Table Testing

Format Valid Size Valid Output

Yes Yes Upload Success

Yes No Size Error

No Yes Format Error

No No Upload Failed

3) Age Verification in Registration


Assumption:
12
Software Testing (4360706) 239810307003

 Minimum age: 18 years


 Maximum age: 60 years
A) Equivalence Partitioning (EP)

Partition Type Test Data Expected Result


Valid Age 25 Accepted
Below 18 16 Rejected
Above 60 65 Rejected
Negative Age -5 Error
Non-numeric "abc" Error
B) Boundary Value Analysis (BVA)

Boundary Condition Test Data Expected Result

Below Minimum 17 Rejected

Minimum 18 Accepted

Maximum 60 Accepted

Above Maximum 61 Rejected

C) Decision Table Testing

Age ≥18 Age ≤60 Output


Yes Yes Registration Success
No Yes Rejected (Underage)
Yes No Rejected (Overage)
No No Invalid Input

Overall Explanation
 Equivalence Partitioning reduces the number of test cases by dividing input into valid
and invalid classes.
 Boundary Value Analysis focuses on edge values where defects are most likely.
 Decision Table Testing is used when output depends on multiple conditions.

Practical 5
Aim:-A) Identify system specification & design test cases for Sales Invoice
Management.
13
Software Testing (4360706) 239810307003

1) System Specification – Sales Invoice Management System


Purpose:
The system is used to generate and manage sales invoices for customers.
Functional Requirements:
1. User Login (Admin/Staff)
2. Create New Invoice
3. Add Customer Details
4. Add Product Details (Product Name, Quantity, Price)
5. Calculate Total Amount (Subtotal + Tax − Discount)
6. Generate Invoice Number Automatically
7. Save, Print, or Delete Invoice
8. Search Invoice by Invoice Number
Non-Functional Requirements:
 System should calculate total accurately.
 Response time should be less than 2 seconds.
 Data should be stored securely.
 System should handle multiple invoices.
Test Cases for Sales Invoice Management System
1) Login Module

Test Case Test Scenario Input Expected Result Status


ID

TC1 Valid Login Correct username & password Login Successful Pass
TC2 Invalid Correct username, wrong Error Message Pass
Password password

TC3 Empty Fields Blank username & password Validation Pass


Message

2) Create Invoice

Test Case ID Test Scenario Input Expected Result

TC4 Add valid product Product A, Qty=2, Price=500 Subtotal = 1000

14
Software Testing (4360706) 239810307003

TC5 Quantity = 0 Qty=0 Error Message


TC6 Negative price Price=-100 Error Message

3) Tax and Discount Calculation


Assume:
 Tax = 18%
 Discount = 10%

Test Case ID Input Expected Result


TC7 Subtotal = 1000 Total = 1000 + 180 − 100 = 1080
TC8 No Discount Subtotal = 1000
TC9 Invalid Discount (>100%) 150%

4) Invoice Search

Test Case ID Input Expected Result


TC10 Valid Invoice No Display Invoice
TC11 Invalid Invoice No Invoice Not Found

B) Design Test Cases for Flight Ticket Booking System


System Specification – Flight Ticket Booking System
Functional Requirements:
1. User Registration & Login
2. Search Flights (From, To, Date)
3. Select Flight
4. Enter Passenger Details
5. Seat Selection
6. Payment Gateway
7. Generate E-Ticket
8. Cancel Ticket
Test Cases for Flight Ticket Booking

15
Software Testing (4360706) 239810307003

1) Flight Search Module

Test Case Test Scenario Input Expected Result


ID
TC1 Valid Search From: Delhi, To: Mumbai, Flight List
Date: Valid Displayed
TC2 Same Source & Delhi to Delhi Error Message
Destination
TC3 Past Date Yesterday's Date Error Message
TC4 Empty Fields Blank Validation
Message

2) Passenger Details

Test Case ID Input Expected Result


TC5 Valid Name & Age John, 25
TC6 Age < 0 -5
TC7 Empty Name Blank

3) Seat Selection

Test Case ID Input Expected Result


TC8 Available Seat A1
TC9 Already Booked Seat A1

4) Payment Module

Test Case ID Input Expected Result


TC10 Valid Card Details Correct Data
TC11 Invalid Card Number 1234
TC12 Insufficient Balance —

5) Ticket Cancellation

Test Case ID Input Expected Result


TC13 Valid Ticket ID Ticket Cancelled
TC14 Invalid Ticket ID Error Message
Practical 6
Aim:- Develop test scenarios and test cases for the login functionality of a
social media application

16
Software Testing (4360706) 239810307003

1) System Description – Login Functionality


The Login module allows registered users to access their social media account using:
 Username / Email / Mobile Number
 Password
 OTP (if enabled)
 Forgot Password option

2) Test Scenarios for Login Functionality


Test Scenario 1: Verify login with valid credentials
Test Scenario 2: Verify login with invalid credentials
Test Scenario 3: Verify login with empty fields
Test Scenario 4: Verify password masking
Test Scenario 5: Verify “Forgot Password” functionality
Test Scenario 6: Verify account lock after multiple failed attempts
Test Scenario 7: Verify login using mobile number
Test Scenario 8: Verify login with inactive/blocked account
Test Scenario 9: Verify Remember Me functionality
Test Scenario 10: Verify OTP-based login (if applicable)

3) Test Cases for Login Functionality


A) Positive Test Cases

Test Test Test Steps Test Data Expected Result Status


Case Scenario
ID
TC1 Valid Login Enter valid user123 / Login Pass
username & Pass@123 Successful,
password → Click Redirect to
Login Home Page
TC2 Login with Enter valid email user@[Link] Login Successful Pass
Email & password
TC3 Login with Enter valid mobile 9876543210 Login Successful Pass
Mobile & password

17
Software Testing (4360706) 239810307003

TC4 Remember Select Remember Valid Data User remains Pass


Me Me → Login logged in

B) Negative Test Cases

Test Test Scenario Test Steps Test Data Expected


Case ID Result
TC5 Invalid Enter correct username & user123 / Error Message
Password wrong password wrong123
TC6 Invalid Enter wrong username & wronguser / Error Message
Username correct password Pass@123
TC7 Empty Leave username blank — Validation
Username Message
TC8 Empty Leave password blank — Validation
Password Message
TC9 Both Fields Leave both blank — Validation
Empty Message

C) Boundary & Validation Test Cases

Test Case ID Test Scenario Test Data Expected Result

TC10 Minimum Password Length 6 characters Accepted (if allowed)

TC11 Less than Min Length 3 characters Error Message

TC12 Maximum Length 20 characters Accepted

TC13 Special Characters in Password Pass@123 Accepted

D) Security Test Cases

Test Case ID Test Scenario Expected Result

TC14 Password Masking Password should appear as ******

TC15 SQL Injection Attempt System should not allow login


TC16 Multiple Failed Attempts (5 times) Account should be temporarily locked

TC17 Blocked Account Login Access Denied Message

E) Forgot Password Test Cases

Test Case ID Test Scenario Expected Result

TC18 Click Forgot Password Redirect to Reset Page

18
Software Testing (4360706) 239810307003

TC19 Enter Registered Email OTP/Reset Link Sent

TC20 Enter Unregistered Email Error Message

4) Additional Considerations
 Login should work on different browsers.
 Response time should be less than 2 seconds.
 Session should expire after logout.
 System should prevent unauthorized access.

Practical 7
Aim:-Develop an RTM and measure testing metrics for any two dynamic
web pages of an e-commerce website.
1) Selected Dynamic Web Pages

19
Software Testing (4360706) 239810307003

We consider the following two dynamic pages of an E-commerce website:


1. Product Details Page
2. Shopping Cart Page
These pages dynamically display data based on user interaction and database content.

2) System Requirements
A) Product Details Page – Requirements

Requirement ID Requirement Description

R1 System should display product name, price, image, and description

R2 System should display product availability (In Stock / Out of Stock)

R3 User should be able to select quantity

R4 User should be able to add product to cart

R5 System should show customer reviews

B) Shopping Cart Page – Requirements

Requirement ID Requirement Description

R6 System should display added products

R7 System should update quantity

R8 System should calculate total price correctly

R9 System should allow product removal

R10 System should redirect to checkout

3) Requirements Traceability Matrix (RTM)


RTM ensures that all requirements are covered by test cases.

Requirement ID Test Case ID Test Case Description Status

20
Software Testing (4360706) 239810307003

R1 TC1 Verify product details display correctly Pass

R2 TC2 Verify stock availability message Pass

R3 TC3 Verify quantity selection Pass

R4 TC4 Verify Add to Cart button Pass

R5 TC5 Verify product reviews section Pass

R6 TC6 Verify products displayed in cart Pass

R7 TC7 Verify quantity update in cart Pass

R8 TC8 Verify total price calculation Pass

R9 TC9 Verify remove product from cart Pass

R10 TC10 Verify checkout redirection Pass

RTM helps to:


 Ensure 100% requirement coverage
 Track missing functionality
 Identify untested requirements
4) Test Cases Summary
Total Test Cases Designed = 10
Total Test Cases Executed = 10
Total Test Cases Passed = 9
Total Test Cases Failed = 1
5) Testing Metrics Calculation
Testing metrics help measure quality and testing performance.
1) Test Case Execution Rate
Formula:
Test Execution Rate = (Executed Test Cases / Total Test Cases) × 100
= (10 / 10) × 100
= 100%
2) Test Pass Percentage
Formula:
Pass Percentage = (Passed Test Cases / Executed Test Cases) × 100

21
Software Testing (4360706) 239810307003

= (9 / 10) × 100
= 90%
3) Test Fail Percentage
Formula:
Fail Percentage = (Failed Test Cases / Executed Test Cases) × 100
= (1 / 10) × 100
= 10%
4) Defect Density (Example)
Assume:
 Total Defects Found = 2
 Total Pages Tested = 2
Defect Density = Total Defects / Total Modules
=2/2
= 1 defect per module
5) Interpretation of Metrics
 Test Execution Rate = 100% → All test cases executed.
 Pass Percentage = 90% → Good quality but needs minor fixes.
 Defect Density = 1 → Moderate defect presence.

Practical 8
Aim:-Execute test cases for a travel booking app and prepare a test
summary report.

22
Software Testing (4360706) 239810307003

1) System Description – Travel Booking Application


The application allows users to:
 Register and Login
 Search Flights/Hotels
 Select Travel Date
 Enter Passenger Details
 Make Payment
 Generate E-Ticket
 Cancel Booking

2) Test Case Execution


Below are sample executed test cases:

A) Login Module

Test Case ID Test Scenario Expected Result Actual Result Status

TC1 Valid Login Login Successful Login Successful Pass

TC2 Invalid Password Error Message Error Message Pass


TC3 Empty Fields Validation Message Validation Message Pass

B) Flight Search Module

Test Case Test Scenario Expected Result Actual Result Status


ID
TC4 Valid Search (Delhi to Flight List Flight List Pass
Mumbai) Displayed Displayed
TC5 Same Source & Error Message Error Message Pass
Destination
TC6 Past Date Error Message Flights Displayed Fail

C) Passenger Details Module

Test Case ID Test Scenario Expected Result Actual Result Status

23
Software Testing (4360706) 239810307003

TC7 Valid Passenger Details Accepted Accepted Pass

TC8 Invalid Age (-5) Error Message Error Message Pass


TC9 Empty Name Validation Message Validation Message Pass

D) Payment Module

Test Case ID Test Scenario Expected Result Actual Result Status

TC10 Valid Card Details Payment Successful Payment Successful Pass

TC11 Invalid Card Number Payment Failed Payment Failed Pass


TC12 Insufficient Balance Transaction Failed Transaction Failed Pass

3) Test Execution Summary


Total Test Cases Designed = 12
Total Test Cases Executed = 12
Total Test Cases Passed = 11
Total Test Cases Failed = 1

4) Defect Details

Defect ID Module Description Severity Status

D1 Flight Search System allows booking for past date High Open

5) Testing Metrics
1) Test Execution Rate
= (Executed / Designed) × 100
= (12 / 12) × 100
= 100%

2) Pass Percentage
= (Passed / Executed) × 100
= (11 / 12) × 100
= 91.67%
3) Fail Percentage

24
Software Testing (4360706) 239810307003

= (Failed / Executed) × 100


= (1 / 12) × 100
= 8.33%
6) Test Summary Report
Project Name:
Travel Booking Application
Testing Type:
Functional Testing (Black Box Testing)
Testing Period:
[Enter Testing Dates]
Modules Tested:
 Login
 Flight Search
 Passenger Details
 Payment
Total Test Cases:
12
Passed:
11
Failed:
1
Major Defects:
Booking allowed for past date (High Severity)
Overall Status:
Application is mostly stable, but one critical defect must be fixed before production release.

Practical 9
Aim:-Prepare defect report after executing test cases for registration page.
1) Module Description – Registration Page
The Registration Page allows new users to create an account by entering:
 Full Name
25
Software Testing (4360706) 239810307003

 Email Address
 Mobile Number
 Password
 Confirm Password
 Date of Birth
 Gender
 Submit Button
2) Test Execution Summary
Total Test Cases Executed = 10
Total Passed = 7
Total Failed = 3
Failed test cases resulted in defects.
3) Defect Report
A Defect Report is a document that contains detailed information about identified bugs
during testing.
Defect 1

Field Details
Defect ID DEF-01
Module Registration Page
Title System accepts invalid email format
Description The system accepts email without “@” symbol (example:
[Link])
Steps to 1. Open Registration Page 2. Enter invalid email 3. Click Submit
Reproduce
Expected Result System should display validation error message
Actual Result Registration successful
Severity High
Priority High
Status Open
Reported By Tester
Date [Enter Date]

Defect 2

Field Details

26
Software Testing (4360706) 239810307003

Defect ID DEF-02
Module Registration Page
Title Password accepted with less than minimum length
Description System accepts password with 4 characters while minimum required
is 8

Steps to Enter short password and submit


Reproduce

Expected Result Display error message


Actual Result Registration successful
Severity Medium
Priority High
Status Open

Defect 3

Field Details
Defect ID DEF-03
Module Registration Page
Title Age validation not working properly
Description System allows user with age below 18 years
Steps to Reproduce Enter DOB making age 15 years
Expected Result Registration should be rejected
Actual Result Registration successful
Severity High
Priority Medium
Status Open

4) Defect Summary

Defect ID Severity Priority Status


DEF-01 High High Open
DEF-02 Medium High Open
DEF-03 High Medium Open

27
Software Testing (4360706) 239810307003

5) Conclusion of Defect Report


 Total Defects Identified = 3
 High Severity Defects = 2
 Medium Severity Defects = 1
 Immediate fixing required before production release

Practical 10
Aim:-Prepare defect report after executing test cases for Withdrawn of
amount from ATM Machine.
1) Module Description – ATM Withdrawal Functionality
The ATM Withdrawal module allows a user to:
 Insert ATM Card

28
Software Testing (4360706) 239810307003

 Enter PIN
 Select Withdrawal Option
 Enter Amount
 Confirm Transaction
 Receive Cash
 Print Receipt
2) Test Execution Summary
Total Test Cases Executed = 12
Total Passed = 9
Total Failed = 3
The failed test cases resulted in the following defects.
3) Defect Report
A Defect Report contains detailed information about the bugs identified during testing.
Defect 1

Field Details
Defect ID ATM-DEF-01
Module Withdrawal
Title System allows withdrawal with insufficient balance
Description When account balance is ₹1000 and user enters ₹2000, the system
processes transaction instead of showing insufficient balance message
Steps to 1. Insert card 2. Enter correct PIN 3. Select Withdraw 4. Enter amount
Reproduce greater than balance 5. Confirm
Expected System should display "Insufficient Balance" message
Result
Actual Result Transaction processed
Severity Critical
Priority High
Status Open
Reported By Tester
Date [Enter Date]
Defect 2

Field Details
Defect ID ATM-DEF-02
Module PIN Validation

29
Software Testing (4360706) 239810307003

Title ATM does not block card after 3 incorrect PIN attempts
Description Card remains active even after entering wrong PIN more than 3
times
Steps to Enter wrong PIN 4 times
Reproduce
Expected Result Card should be blocked after 3 failed attempts
Actual Result System allows further attempts
Severity High
Priority High
Status Open
Defect 3

Field Details
Defect ID ATM-DEF-03
Module Amount Entry
Title ATM accepts invalid denomination amount
Description System accepts ₹125 which is not multiple of ₹100
Steps to Reproduce Enter ₹125 and confirm
Expected Result System should show "Enter amount in multiples of 100"
Actual Result Transaction processed
Severity Medium
Priority Medium
Status Open
4) Defect Summary

Defect ID Module Severity Priority Status


ATM-DEF-01 Withdrawal Critical High Open
ATM-DEF-02 PIN Validation High High Open
ATM-DEF-03 Amount Entry Medium Medium Open
5) Testing Metrics
Total Defects Found = 3
Critical Defects = 1
High Severity Defects = 1
Medium Severity Defects = 1
Defect Density (Example)
If total functions tested = 6
Defect Density = 3 / 6 = 0.5 defects per function

30
Software Testing (4360706) 239810307003

6) Observation
 Critical defect in balance validation must be fixed immediately.
 Security defect in PIN validation is high priority.
 Minor validation defect found in denomination check.

Practical 11
Aim:-A) Install and set up the Selenium WebDriver and necessary drivers
(e.g., Chrome Driver, Gecko Driver) on your system.
1) Software Requirements
 Java JDK (Version 8 or above)
 Eclipse IDE or IntelliJ IDEA
 Selenium WebDriver JAR files

31
Software Testing (4360706) 239810307003

 Chrome Browser
 Mozilla Firefox Browser
 Chrome Driver
 Gecko Driver
Step 1: Install Java JDK
1. Download Java JDK from official Oracle website.
2. Install JDK on your system.
3. Set Environment Variables:
o Set JAVA_HOME path

o Add JDK bin folder path in System PATH

4. Verify installation using command:


5. java -version
Step 2: Install Eclipse IDE
1. Download Eclipse IDE for Java Developers.
2. Install and launch Eclipse.
3. Create a New Java Project.
Step 3: Download Selenium WebDriver
1. Download Selenium Java Client Driver (.zip file).
2. Extract the zip file.
3. In Eclipse:
o Right click Project → Properties

o Java Build Path → Add External JARs

o Add all Selenium JAR files

Step 4: Setup ChromeDriver


1. Download ChromeDriver according to your Chrome browser version.
2. Extract [Link] file.
3. Place it in a folder (e.g., C:\WebDriver).
4. Add this path in System Environment Variables (PATH).
Example Code to Test ChromeDriver:

32
Software Testing (4360706) 239810307003

import [Link];
import [Link];

public class TestChrome {


public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
[Link]("[Link]
}
}
If browser opens successfully, setup is correct.
Step 5: Setup GeckoDriver (Firefox)
1. Download GeckoDriver from Mozilla website.
2. Extract and place it in C:\WebDriver folder.
3. Add path to Environment Variables.
Example Code:
import [Link];
import [Link];

public class TestFirefox {


public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
[Link]("[Link]
}
}

B) Install JUnit, TestNG using an IDE (Integrated Development


Environment) like Eclipse or IntelliJ.
1) Install JUnit in Eclipse
JUnit is used for unit testing in Java.
Steps:

33
Software Testing (4360706) 239810307003

1. Right click on Project → Properties


2. Go to Java Build Path → Libraries
3. Click Add Library
4. Select JUnit → Next
5. Choose JUnit 4 or JUnit 5 → Finish
Now JUnit is added to the project.
Example JUnit Test:
import [Link];
import static [Link].*;

public class SampleTest {

@Test
public void testAddition() {
assertEquals(5, 2 + 3);
}
}
2) Install TestNG in Eclipse
TestNG is an advanced testing framework similar to JUnit but more powerful.
Steps:
1. Open Eclipse
2. Go to Help → Eclipse Marketplace
3. Search "TestNG"
4. Click Install
5. Restart Eclipse
After installation:
1. Right click Project → Configure → Convert to TestNG
2. TestNG library will be added.
Example TestNG Test:

34
Software Testing (4360706) 239810307003

import [Link];

public class TestNGExample {

@Test
public void testMethod() {
[Link]("TestNG is working");
}
}
IntelliJ Installation (Alternative)
In IntelliJ:
 JUnit and TestNG can be added through:
o File → Project Structure → Libraries

o Or using Maven dependencies

Verification Checklist
✔ Java installed correctly
✔ Selenium JAR files added
✔ ChromeDriver working
✔ GeckoDriver working
✔ JUnit installed
✔ TestNG installed

Practical 12
Aim:-Design and run test script for a registration page using Selenium tool
and JUnit.
1) Objective
To automate testing of the Registration Page using:
 Selenium WebDriver
 JUnit Framework
 Chrome Browser

35
Software Testing (4360706) 239810307003

2) Preconditions
 Java installed
 Selenium WebDriver configured
 ChromeDriver added to system path
 JUnit added to project
 Registration page URL available
Example URL (Assumption):
[Link]
3) Test Scenario
Test Scenario: Verify successful registration with valid data.
4) Test Script using Selenium + JUnit
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import static [Link].*;

public class RegistrationTest {

WebDriver driver;

@Before
public void setUp() {
driver = new ChromeDriver();
[Link]().window().maximize();
[Link]("[Link]
}
36
Software Testing (4360706) 239810307003

@Test
public void testRegistration() {

// Enter Name
WebElement name = [Link]([Link]("name"));
[Link]("John Doe");

// Enter Email
WebElement email = [Link]([Link]("email"));
[Link]("john123@[Link]");

// Enter Password
WebElement password = [Link]([Link]("password"));
[Link]("Pass@123");

// Confirm Password
WebElement confirmPassword = [Link]([Link]("confirmPassword"));
[Link]("Pass@123");

// Click Submit Button


WebElement submit = [Link]([Link]("registerBtn"));
[Link]();

// Verify Success Message


String expectedMessage = "Registration Successful";
String actualMessage = [Link]([Link]("successMsg")).getText();

assertEquals(expectedMessage, actualMessage);

37
Software Testing (4360706) 239810307003

@After
public void tearDown() {
[Link]();
}
}
5) Explanation of Script
 @Before → Opens browser and loads registration page
 @Test → Executes test case steps
 @After → Closes browser
 assertEquals() → Validates expected and actual result
6) Test Execution Result

Test Case Expected Result Actual Result Status

Valid Registration Registration Successful Registration Successful Pass

7) Additional Negative Test Example


Example: Invalid Email Test
@Test
public void testInvalidEmail() {
[Link]([Link]("name")).sendKeys("John");
[Link]([Link]("email")).sendKeys("john123");
[Link]([Link]("password")).sendKeys("Pass@123");
[Link]([Link]("confirmPassword")).sendKeys("Pass@123");
[Link]([Link]("registerBtn")).click();

String errorMsg = [Link]([Link]("emailError")).getText();


assertEquals("Enter valid email address", errorMsg);
}
8) Advantages of Automation Testing

38
Software Testing (4360706) 239810307003

 Faster execution
 Reusable scripts
 Reduces human error
 Suitable for regression testing

Practical 13
Aim:-Design and run test script for a Login page and home page using
Selenium tool and TestNG.
1) Objective
To automate the testing of:
 Login Page functionality
 Successful redirection to Home Page
Using:
 Selenium WebDriver

39
Software Testing (4360706) 239810307003

 TestNG
 Chrome Browser
2) Preconditions
 Java installed
 Selenium configured
 ChromeDriver added to system path
 TestNG installed in Eclipse/IntelliJ
 Application URL available
Example URL (Assumption):
[Link]
3) Test Scenarios
Scenario 1:
Verify login with valid username and password.
Scenario 2:
Verify error message for invalid login.
Scenario 3:
Verify user is redirected to Home Page after successful login.
4) Test Script using Selenium + TestNG
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];

public class LoginTest {

WebDriver driver;

40
Software Testing (4360706) 239810307003

@BeforeMethod
public void setUp() {
driver = new ChromeDriver();
[Link]().window().maximize();
[Link]("[Link]
}

@Test(priority = 1)
public void validLoginTest() {

[Link]([Link]("username")).sendKeys("testuser");
[Link]([Link]("password")).sendKeys("Pass@123");
[Link]([Link]("loginBtn")).click();

String expectedTitle = "Home Page";


String actualTitle = [Link]();

[Link](actualTitle, expectedTitle);
}

@Test(priority = 2)
public void invalidLoginTest() {

[Link]([Link]("username")).sendKeys("wronguser");
[Link]([Link]("password")).sendKeys("wrongpass");
[Link]([Link]("loginBtn")).click();

String errorMsg = [Link]([Link]("errorMsg")).getText();


[Link](errorMsg, "Invalid Username or Password");

41
Software Testing (4360706) 239810307003

@AfterMethod
public void tearDown() {
[Link]();
}
}
5) Explanation of Script
 @BeforeMethod → Opens browser and loads Login page before each test
 @Test → Executes test case
 priority → Defines execution order
 [Link]() → Validates expected result
 @AfterMethod → Closes browser after test execution
6) Home Page Verification Logic
After successful login:
 Page title should be "Home Page"
OR
 URL should change to /home
OR
 Logout button should be visible
Example Additional Validation:
[Link]([Link]([Link]("logoutBtn")).isDisplayed());
7) Test Execution Result

Test Case Expected Result Actual Result Status

Valid Login Redirect to Home Page Redirected Successfully Pass

Invalid Login Error Message Displayed Error Message Displayed Pass

8) Advantages of Using TestNG


 Supports priority execution
 Supports parallel testing
42
Software Testing (4360706) 239810307003

 Generates HTML reports automatically


 Supports grouping of test cases

43

You might also like