AMITY UNIVERSITY, MADHYA PRADESH
BATCH: 2022-2026
SESSION: 2025-2026(Semester 8)
Assignment
SOFTWARE TESTING AND QUALITY
ASSURANCE LAB
Course Code: CSE822
SUBMITTED TO: SUBMITTED BY:
Ms Arunima Shivhare Manthan Shekhawat
Assistant Professor B. TECH (CSE) SEM 8th C
ASET – CSE [Link]: A60205222137
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING (AMITY
SCHOOL OF ENGINEERING AND TECHNOLOGY)
Design a test cases for:
Q.1) Write a function that return what action a driver should take based on a traffic
light.(branch testing)
Q.2) Write a function that assign a grade based on marks.90+ ->A,80-89 ->B, 70-79 ->C ,60-
69 ->D, 50-59 ->fail. .(branch testing)
Q.3) Write a function that checks if a number is divisible by 3 and 5. .(branch testing)
Q.4) Check if a number is positive, negative or zero. .(branch testing)
Q.5) Write a program to check if a given year is a leap year or not. .(statement coverage
testing)
Q.6) Write a program to check if a person is eligible to vote based on their age. .( statement
coverage testing)
Q.7) Check if a number is prime or not. .(loop coverage testing)
Q.8) Write a program to check a number is even or odd. .( statement coverage testing)
Q.9) Write a program to print numbers in right angled triangle.(loop coverage testing)
1
12
123
1234
12345
Q.10) Write a program to print stars in right angled triangle(loop coverage testing)
*
**
***
****
*****
Q.11) Write a program to print stars in triangle. .(loop coverage testing)
*
**
***
****
Q.12) Write a program to find the largest number among three variable. (statement coverage
testing)
Q.13) Write a test cases on hospital management system in black box testing.
Q.14) Write a test cases on ticket booking system in black box testing.
Q.15) Write a test cases on login page in black box testing.
ANSWERS
Q1) Traffic Light Action (Branch Testing)
Logic:
Red → Stop
Yellow → Ready
Green → Go
Test Cases:
Test Case Input Expected Output
TC1 Red Stop
TC2 Yellow Ready
TC3 Green Go
TC4 Blue (invalid) Invalid Input
Q2) Grade Assignment (Branch Testing)
Test Case Marks Expected Output
TC1 95 A
TC2 85 B
TC3 75 C
TC4 65 D
TC5 55 Fail
TC6 49 Fail
Test Case Marks Expected Output
TC7 100 A
TC8 -5 Invalid
Q3) Divisible by 3 and 5 (Branch Testing)
Test Case Input Expected Output
TC1 15 Divisible by both
TC2 9 Divisible by 3 only
TC3 10 Divisible by 5 only
TC4 7 Not divisible
TC5 0 Divisible by both
Q4) Positive / Negative / Zero (Branch Testing)
Test Case Input Expected Output
TC1 10 Positive
TC2 -5 Negative
TC3 0 Zero
Q5) Leap Year (Statement Coverage)
Condition:
Divisible by 400 → Leap
Divisible by 4 but not 100 → Leap
Test Case Year Expected Output
TC1 2000 Leap
TC2 2024 Leap
TC3 1900 Not Leap
TC4 2023 Not Leap
Q6) Voting Eligibility (Statement Coverage)
Test Case Age Expected Output
TC1 18 Eligible
TC2 25 Eligible
TC3 17 Not Eligible
TC4 0 Not Eligible
Q7) Prime Number (Loop Coverage)
Test Case Input Expected Output
TC1 2 Prime
TC2 7 Prime
TC3 4 Not Prime
TC4 1 Not Prime
TC5 0 Not Prime
Q8) Even or Odd (Statement Coverage)
Test Case Input Expected Output
TC1 4 Even
TC2 7 Odd
TC3 0 Even
Q9) Number Triangle (Loop Coverage)
Output:
1
12
123
1234
12345
Test Cases:
Test Case Input (n) Expected
TC1 1 Single row
TC2 5 Full triangle
TC3 0 No output
TC4 -1 Invalid
Q10) Star Triangle (Right Angled)
*
**
***
****
*****
Test Case Input Expected
TC1 1 *
TC2 5 Full pattern
TC3 0 No output
Q11) Star Triangle Pattern
*
**
***
****
Test Case Input Expected
TC1 1 *
TC2 4 Full triangle
TC3 0 No output
Q12) Largest of Three Numbers (Statement Coverage)
Test Case Input (a,b,c) Expected Output
TC1 5, 3, 1 5
Test Case Input (a,b,c) Expected Output
TC2 2, 8, 6 8
TC3 4, 4, 4 4
TC4 -1, -5, -3 -1
Q13) Hospital Management System (Black Box Testing)
Test Case Scenario Expected Output
TC1 Register patient with valid data Success
TC2 Missing patient name Error
TC3 Invalid age (-5) Error
TC4 Book appointment valid doctor Confirmed
TC5 Doctor unavailable Error
TC6 Billing calculation Correct bill
Q14) Ticket Booking System (Black Box Testing)
Test Case Scenario Expected Output
TC1 Valid booking Ticket Confirmed
TC2 Invalid date Error
TC3 No seats available Booking Failed
TC4 Payment success Ticket Generated
TC5 Payment failure Retry option
Q15) Login Page (Black Box Testing)
Test Case Input Expected Output
TC1 Valid username & password Login Success
TC2 Wrong password Error
TC3 Empty fields Validation error
Test Case Input Expected Output
TC4 SQL injection attempt Blocked
TC5 Invalid email format Error