You are on page 1of 6

STQA - Lab Assignment: - 3

Unit Testing is a level of software testing where individual units/ components of software are
tested. The purpose is to validate that each unit of the software performs as designed.

Writing Test Cases

What is a” test case”?

1. Test case is “Documentation specifying inputs, predicted results, and a set of execution
conditions for a test item.”

2. The aim is to divide the software function into small units of function that is testable with
input and producing result that is measurable.

3. A test case is a feature/function description that should be executed with a range of input,
given certain preconditions, and the outcome measured against expected result.

What is a Test Case?

Set of steps and expected conditions/results.

It is collection of Inputs for writing test cases, Test case syntax steps, expected results, actual
result, Test Case ID, Req ID, Test data, Passed/Failed/Blocked, Notes.

Description- Explain the function under test. Clearly state exactly what attribute is under test
and under what condition?

Prerequisites- Every test needs to follow a sequence of actions, which lead to the function under
test. It could be a certain page that a user needs to be on, or certain data that should be in the
system (like registration data to login to the system), or certain action. State this precondition
clearly in the test case. This helps to define specific steps for manual testing, and more so for
automated testing, where the system needs to be in a particular base state for the function to be
tested.

Steps- Sequence of steps to execute the specific function.


Input- Specify the data used for a particular test or if it is a lot of data, point to a file where this
data is stored.

Expected result – Clearly state the expected outcome in terms of the page/ screen that should
appear after the test, changes that should happen to other pages, and if possible, changes that
should happen to the database.

Actual result – State the actual result of the function execution. Especially in case the test case
fails, the information under ‘actual result’ will be very useful to the developer to analyse the
cause of the defect.

Status- Write status separately for tests done using different environments, e.g. various
OS/browser combinations. Test case status could be-

• “Passed” – The expected and actual results match.

• “Failed”- The actual result does not match the expected result.

• “Not tested”- The test case has not been executed for the test run, maybe is a lower
priority test case.

• “Not Applicable”-The test case does not apply to the feature any more since the
requirement changed.

• “Cannot be tested” – May be the prerequisite/ precondition is not met. There could be a
defect in one of the steps leading up to the function under test.

Comments- Write additional information under this column. For e.g. the actual result occurs only
under a particular condition or a defect is reproducible only sometimes. This information gives
the developer/ client additional info about the feature behavior which can be very useful in
determining the root cause of a problem. It is especially useful for ”failed” cases, but also serves
as a feedback if additional observation is mentioned in the “passed” cases.

References- Refer / map a test case to the corresponding requirement spec or use case or any
other reference material that you used. This information helps gauge the test coverage against
the documented requirements.
Prepare at least 07 test cases to test all the testing elements of the Gmail login page.

Project name Test Case for Gmail login page


Version 1
Module name Gmail login page
Pre-requisite Go to www.Gmail.com using any browser
Type of testing Unit Testing

Serial Require- Test Test Case Pre Description Input Expected Actual Result
No ment Case Objective requisite Data Output Output
ID

1 Verify that test_1 To check Open Check for To check Available Available Pass
Username / Usernam website Username / Usernam
Email Box e / Email Gmail.co Email Box e / Email
must be Box must m from Box must
Available be any be
Available browser Available
2 Verify that test_2 To check Run Check for Clicking Fields Clickable Pass
Username / Usernam program Username / on should be
Email Box e / Email Email Specified Clickable
must be Box must address area
Clickable be Box is
Clickable clickable
3 Verify that test_3 To check Run Check Checking Page Yes, Pass
Username / Usernam program whether should be Informati
Email Box e / Email Username / Informati ve
must be Box must Email ve
Informative be address
Informati Box is
ve Informative
4 Verify that test_4 To Verify Run Check Type Verified Verified Pass
Email that Email program whether Email
should not should Email address
start with not start should not
Capital with start with
letter or Capital Capital
Number
letter or letter or
Number Number
5 Verify that test_5 To Verify Run Verify that Check Cursor Focused Pass
the cursor that program whether where the should in
focuses in whether the cursor cursor is Focused required
text area as the cursor focus in focusing in area
Gmail Login focus in text area as required
page Loads text area Gmail Login area
as Gmail page Loads
Login
page
Loads
6 Verify Email test_6 Verify Run Check Provide It should Checked Pass
should be Email program whether Email Verify and
combinatio should be the Email is with Verified
n of Letters combinati combinatio combinati
and on of n of Letters on of
Numbers Letters and Letters
and Numbers and
Numbers Numbers
7 Verify test_7 Verify Run Check Press Tab Cursor Cursor is Pass
whether whether program whether key after must Moved to
cursor cursor the cursor entering Move to next field
moves to moves to moves to Email next field
next field next field next field
on pressing on on pressing
Tab key pressing Tab key
Tab key

2. Prepare at least 10 test cases to test all the testing elements of the IRCTC ticket booking
site.

Project name Test Case for IRCTC Ticket Booking Website


Version 1
Module name Gmail login page
Pre-requisite Go to www.Gmail.com using any browser
Type of testing Unit Testing
Serial Require- Test Test Case Pre Description Input Expected Actual Result
No ment Case Objective requisite Data Output Output
ID

1 Verify the test_1 To Verify Go to Check for Enter URL Correct Correct Pass
specified the www.irctc URL in any
URL is specified .co.in browser
correct or URL is using any
not correct or browser
not
2 Check test_2 To Check Search for Check Enter It should Available Pass
whether whether train whether your show
there is a there is a there is a Destinatio trains if
train for train for train for n available
your your your
destination destinatio destination
n
3 Check the test_3 Check the Checking Check the Enter Page Showing Pass
availability availabilit Availabilit availability Date of should
of seats on y of seats y of Seat of seats on Journey show
the on the the available
required required required seats
date date date
4 Check test_4 Check Checking Check the Check Page Showing Pass
whether whether Type type of availabilit should be
the the available available y show
available available of Seat seat like available
seats type seats type A/c or seats as
A/c or A/c or Sleeper per types
Sleeper Sleeper coaches
coaches coaches
5 Check test_5 To Check Checking Check Check Page Displaying Pass
upper position position position of seats as should
middle, of seat of seat upper per your show
lower births upper available middle, requirem available
for middle, seats lower ent seats as
available lower births for per births
seats births for available
available seats
seats
6 Ticket fare test_6 Checking Provide Provide Provide Page Showing Pass
for Ticket Details to details and Details should Total Fare
correspondi Fare check check show
ng criteria Fare Ticket Fare total Fare
as per
requirem
ent
7 Book the test_7 To Book Book Provide Enter Page Showing Pass
tickets with the Tickets payment payment should Available
correspondi tickets method methods show Payment
ng criteria with available Methods
by cash or correspon Payment
card ding Methods
criteria
by cash
or card
8 Check any test_8 To Check Check Provide Passenger It should Providing Pass
concession for any Concessio passenger Details provide concessio
for senior concessio n if details to concessio n for
citizen if n for applicable Check for n if Senior
applicable senior any applicable Citizens
citizen if concession
applicable for senior
citizen if
applicable
9 To print the test_9 To print Print Printing the Provide It should Printing Pass
ticket the ticket Ticket booked Details print the Ticket
ticket and make passenger
successful s booked
payment ticket

10 To Cancel test_1 To cancel Cancelling Cancelling Provide Page Allowing Pass


booked 0 the ticket Ticket booked booked should to cancel
ticket ticket due ticket cancel the booked
to some details ticket if ticket
problem and applicable
confirm
cancellati
on

You might also like