Test Case in Software Testing
Test Case in Software Testing
descrip
tion of
what
working or not.
needs
Here we check for
to be
different
perfor
conditions
med
regarding the
based
same.
on the
use
case.
provide
sa
small
descrip
tion,
parameters.
mostly
one-
line
statem
ents.
level
actions
.
etc.
It
focuses
It focuses on more
Objectiv
"What to test" and on
e
"How to test". 'What
to
test".
write
test
scenari
os.
require
less
time.
They
require
Mainten They are hard to less
ance maintain. time to
maintai
n.
When do we Write Test Cases?
Test cases are written in different
situations:
Before development: Test cases
could be written before the actual
coding as that would help to identify
the requirement of the
product/software and carry out the
test later when the
product/software gets developed.
After development: Test cases are
also written directly after coming up
with a product/software or after
developing the feature but before
the launching of a product/software
as needed to test the working of
that particular feature.
During development: Test cases are
sometimes written during the
development time, parallelly. so
whenever a part of the
module/software gets developed it
gets tested as well.
So, test cases are written in such cases,
as test cases help in further
development and make sure that we
are meeting all the needed
requirements.
Why Write Test Cases?
Test cases are one of the most
important aspects of software
engineering, as they define how the
testing would be carried out. Test cases
are carried out for a very simple
reason, to check if the software works
or not. There are many advantages of
writing test cases:
To check whether the software
meets customer expectations: Test
cases help to check if a particular
module/software is meeting the
specified requirement or not.
To check software consistency with
conditions: Test cases determine if a
particular module/software works
with a given set of conditions.
Narrow down software
updates: Test cases help to narrow
down the software needs and
required updates.
Better test coverage: Test cases help
to make sure that all possible
scenarios are covered and
documented.
For consistency in test
execution: Test cases help to
maintain consistency in test
execution. A well-documented test
case helps the tester to just have a
look at the test case and start
testing the application.
Helpful during maintenance: Test
cases are detailed which makes
them helpful during the
maintenance phase.
Test Case Template
A Test Case Template is a simple,
organized format used in software
testing to create test cases. It helps
ensure that all tests are written clearly
and consistently.
Let's look at a basic test case template
for the login functionality.
The Test case template contains the
header section which has a set of
parameters that provide
information about the test case
such as the tester's name, test case
description, Prerequisite, etc.
The body section contains the actual
test case content, such as test ID,
test steps, test input, expected
result, etc.
Below is the table that shows the
basic template of a test case:
Fields Description
have a proper
description to let
Description
testers know what the
test case is about.
cases.
Conditions need to be
Post fulfilled when the test
Condition cases are successfully
executed.
cases.
In the given template below it's
identifiable that the section from
module name to test scenario is the
header section while the table that lies
below the test scenario (from test case
ID to comments) is the body of the test
case template.
Here a test case template for login
functionality has been created with its
parameters and values.
Test Case Template
Best Practice for Writing Test Case
There are certain practices that one
could follow while writing the test
cases that would be considered
beneficial.
Simple and clear: Test cases need to
be very concise, clear, and
transparent. They should be easy
and simple to understand not only
for oneself but for others as well.
Maintaining the
client/customer/end-user
requirements must be
unique : While writing the test
cases, it's necessary to make sure
that they aren't being written over
and over again and that each case is
different from the others.
Zero Assumptions: Test cases
should not contain assumed data,
and don't come up with
features/modules that don't exist.
Traceability: Test cases should be
traceable for future reference, so
while writing it's important to keep
that in mind,
Different input data: While writing
test cases, all types of data must be
taken into consideration.
Strong module name: The module
name should be self-explanatory
while writing the test case.
Minimal Description: The
description of a test case should be
small, one or two lines are normally
considered good practice, but it
should give the basic overview
properly.
Maximum conditions: All kinds of
conditions should be taken into
consideration while writing a test,
increasing the effectiveness.
Meeting requirements: While
writing the test case the
client/customer/end-user
requirements must be met.
Repetitive Results: The test case
must be written in such a way that it
should provide the same result.
Different Techniques: Sometimes
testing all conditions might not be
possible but using different
testing with different test cases
could help to check every aspect of
a software.
Create test cases with the end
user's perspective: Create test cases
by keeping end-user in mind and
the test cases must meet customer
requirements.
Use unique Test Case ID: It is
considered a good practice to use a
unique Test Case ID for the test
cases following a naming
convention for better
understanding.
Add proper preconditions and
postconditions: Preconditions and
postconditions for the test cases
must be mentioned properly and
clearly.
Test cases should be
reusable: There are times when the
developer updates the code, then
the testers need to update the test
cases to meet the changing
requirements.
Specify the exact expected
outcome: Include the exact
expected result, which tells us what
will be result of a particular test
step.
Test Case Management Tools
Test case management tools are
important in managing test cases
efficiently, making the testing process
faster and less time-consuming
compared to traditional methods.
These tools provide features such
as advanced dashboards, bug
tracking, progress tracking, custom
templates, and integration with other
testing tools. Test case management
tools help testers organize, manage,
and execute their tests more
effectively.
Here are some of the most popular
test case management tools:
1. TestLink: TestLink is a widely
used test management tool that
offers easy integration with bug
tracking systems and provides a
user-friendly interface to manage
test cases, test plans, and test runs.
2. X-ray: X-ray is a test
management tool for Jira, designed
to manage both manual and
automated tests. It integrates
seamlessly with Jira, providing
robust reporting, traceability, and
tracking for test cases.
3. TestRail: TestRail helps manage
test cases, test plans, and test runs.
It offers real-time insights into
testing progress and enables better
collaboration between QA teams,
helping them streamline their test
case management processes.
4. PractiTest Ltd.: PractiTest is a test
case management tool that focuses
on organizing test cases, creating
test plans, and offering detailed
reports. It allows for seamless
integration with popular bug
tracking systems and other testing
tools.
5. TestCollab: TestCollab is a tool
for managing test cases, test plans,
and testing progress. It provides
strong reporting and analytics
features to give teams insights into
their testing efforts.
6. Kualitee: Kualitee is a
comprehensive test case
management platform that supports
manual and automated testing. It
provides features for test case
creation, execution, and tracking,
along with strong integration with
bug tracking tools.
7. Qase: Qase is an easy-to-use test
management tool that supports
manual test execution and test case
management. It integrates with
various CI/CD tools and offers
powerful reporting and analytics
features.
8. Testiny: Testiny is a lightweight
test management tool that provides
an intuitive interface for managing
test cases. It allows easy tracking of
test executions and facilitates
collaboration within teams.
9. TestMonitor: TestMonitor is a
test case management platform
designed to enhance collaboration
among teams. It offers
comprehensive features like test
case management, test plan
creation, bug tracking, and detailed
reporting.
10. SpiraTest: SpiraTest is a test
management tool that allows users
to manage test cases, bugs, and
requirements in one integrated
platform. It provides full traceability
and powerful reporting for effective
test case management.
Formal and Informal Test Case:
Formal Test Cases: Formal test cases
are test cases that follow the basic
test case format. It contains the test
case parameters such as conditions,
ID, Module name, etc. Formal Test
cases have set input data and
expected results, they are
performed as per the given order of
steps.
Informal Test Cases: Informal test
cases are test cases that don't
follow the basic test case format. In
these, as the tests are performed
the test cases are written in real-
time then pre-writing them, and the
input and expected results are not
predefined as well.
Types of Test Cases
Here are some of the Types of Test
Cases:
Functionality Test
Case: The functionality test case is
to determine if the interface of the
software works smoothly with the
rest of the system and its users or
not. Black box testing is used while
checking for this test case, as we
check everything externally and not
internally for this test case.
Unit Test Case: In unit test case is
where the individual part or a single
unit of the software is tested. Here
each unit/ individual part is tested,
and we create a different test case
for each unit.
User Interface Test Case: The UI
test or user interface test is when
every component of the UI that the
user would come in contact with is
tested. It is to test if the UI
components requirement made by
the user are fulfilled or not.
Integration Test Case: Integration
testing is when all the units of the
software are combined and then
they are tested. It is to check that
each component and its units work
together without any issues.
Performance Test
Case: The performance test case
helps to determine response time as
well as the overall effectiveness of
the system/software. It's to see if
the application will handle real-
world expectations.
Database Test Case: Also known
as back-end testing or data
testing checks that everything
works fine concerning the database.
Testing cases for tables, schema,
triggers, etc. are done.
Security Test Case: The security
test case helps to determine that
the application restricts actions as
well as permissions wherever
necessary. Encryption and
authentication are considered as
main objectives of the security test
case. The security test case is done
to protect and safeguard the data of
the software.
Usability Test Case: Also known as
a user experience test case, it
checks how user-friendly or easy to
approach a software would be.
Usability test cases are designed by
the User experience team and
performed by the testing team.
User Acceptance Test
Case: The user acceptance test case
is prepared by the testing team but
the user/client does the testing and
review if they work in the real-world
environment.
What is a QA test case?
A QA (Quality Assurance) test case is a
document that specifies a set of
conditions or variables under which a
tester will determine whether a
system, software application, or one of
its features is working as expected. A
well-written test case helps ensure that
the software behaves as intended and
meets the specified requirements. It
provides us Consistency, Traceability
and efficiency of System.
Benefits of writing high-quality test
cases
Writing high-quality test cases offers
numerous benefits that contribute to
the effectiveness and efficiency of
the software testing process. Some
benefits are listed below:
Improved Test Coverage
Enhanced Communication
Consistency and Repeatability
Efficient Defect Identification
Improved Test Automation
Increased Confidence in Software
Quality
Example test cases for a login page
Below is an example of preparing
various test cases for a login page with
a username and password.
Unit Test case: Here we are only
checking if the username validates
at least for the length of eight
characters.
Te Test
st Exp
T Test St ecte Act
e Con e d ual St Re
st diti p Test Res Res at ma
Id on s Input ult ult us rks
t of
thirt
een
char
acte
rs.
Here it is only checked whether the
passing of input of thirteen characters
is valid or not. So since the character
word 'geeksforgeeks' is entered then
the test is successful it would have
failed for any other test case.
Functionality Test case: Here it is
checked whether the username and
password both work together on
the login click.
Tes Test
t Exp
T Co Tes ecte Actu
e ndi t Test d al St Re
st tio Ste Inpu Res Res at ma
Id n ps t ult ult us rks
h rna geek
the me s
cor 2. pass
rec Ent word
t er :
use the geek
rna pas sfore
me sw ver
an ord
d
3.
pas
Clic
Tes Test
t Exp
T Co Tes ecte Actu
e ndi t Test d al St Re
st tio Ste Inpu Res Res at ma
Id n ps t ult ult us rks
sw
ord k
abl on
e the
to logi
log n
in.
pas
sw
Clic
ord
k
abl
on
e
the
to
logi
not
n
logi
n.
Here it is being checked whether
passing wrong and right inputs and if
the login functionality is working or
not, it's showing login is successful for
the right credentials and unsuccessful
for the wrong ones, hence both tests
have passed otherwise would have
failed.
User Acceptance Test Case: Here the
user feedback is taken if the login page
is loading properly or not.
Test
Te Exp
Test Tes st ect Act
Te Con t In ed ual St
st diti Ste p Res Res at Rema
Id on ps ut ult ult us rks
the ck n me me page
load on e to to is not
ing th the the loade
pag e logi logi d due
e log n n to a
load in pag pag brow
ing bu e. e. ser
effic tto comp
ientl n. atibili
y ty
for issue
Test
Te Exp
Test Tes st ect Act
Te Con t In ed ual St
st diti Ste p Res Res at Rema
Id on ps ut ult ult us rks
on
the
the
clie
user's
nt.
side.
Here it is being checked in by clicking
on the login button if the page is
loaded and the 'Welcome to login
page' message is displayed. The test
has failed here as the page was not
loaded due to a browser compatibility
issue, it would have loaded if the test
had passed.
Related Posts:
Software Testing Tutorial
What is Software Testing?
Manual Testing - Software Testing
Software Testing - Use Case Testing
Unit Testing - Software Testing
Conclusion
Writing effective test cases is a
important part of software testing. It
helps ensure that the software is
thoroughly tested, and any issues are
found and fixed early in the
development process. Good test cases
should be clear, easy to understand,
and cover all possible scenarios. This
ensures that the software works
properly, performs well, and is reliable.
By following a well-organized approach
to writing test cases, testers can
improve software quality, reduce
defects, and make sure the software
meets the needs and expectations of
the users and stakeholders.