10/04/2018 How to Write Test Cases: Sample Template with Examples
(https://www.guru99.com/)
Home (/) Testing
SAP Web Must Learn! Big Data
Live Projects Blog (/blog/)
How to Write Test Cases: Sample Template
with Examples
What is Test Case?
A Test Case is a set of actions executed to
verify a particular feature or functionality of
your software application.
This tutorial describes test case designing and
the importance of its various components.
Now, consider the Test Scenario (/test-
scenario.html)Check Login Functionality there
many possible cases like
Test Case 1: Check results on entering valid
User Id & Password
Test Case 2: Check results on entering Invalid User ID & Password
Test Case 3: Check response when User ID is Empty & Login Button is pressed, and many
more
This is nothing but Test Case. Test scenarios are rather vague and cover a wide range of
possibilities. Testing is all about being very specific.Hence, we need Test Cases
https://www.guru99.com/test-case.html 1/9
10/04/2018 How to Write Test Cases: Sample Template with Examples
How to write a Test Case? Software Testing Tutorial 13
Please be patient. The Video will load in some time. If you still face issue viewing video click
here (/faq.html#1)
Video Transcript
Now just Consider the test case, Check the response on entering valid Agent Name and
password. It's obvious that this test case needs input values viz.Agent Name & Password
This is nothing but Test Data. Identifying test data can be time-consuming and may
sometimes require creating test data afresh. The reason it needs to be documented
Before we proceed ahead consider a quote from a witty man who said "To ensure perfect
aim, shoot first and call whatever you hit the target" But if you do not live by this
philosophy, which I am sure most of you do not then your Test case must have an
expected result.
For our test case, expected result would be, Login should be successful
If expected results are not documented, we may miss out on small differences in
calculations in results that otherwise look OK.
Consider this example, where you are calculating monthly pay for an employee which
involves lots of calculations. The need for documenting expected results becomes
obvious.
Suppose the author of the test case has left the organization or is on a vacation or is sick
and off duty or is very busy with other critical tasks and you are recently hired and have
been asked to execute the test case.Since you are new, it would certainly help to have
test steps documented which, in this case, would be Launch application, Enter Agent
Name, Enter Password, Click OK
You may wonder that for this simple test steps, documentation is not required
But what is your test steps looked something like this? (pic in video) I think the need will
become instantaneously obvious.
That apart your test case -may have field like, Pre - Condition which specifies things that
must in place before the test can run
https://www.guru99.com/test-case.html 2/9
For
10/04/2018 our test case, a pre-condition
How towould beCases:
Write Test Flight Reservation
Sample Application
Template with Examples should be
installed, which I am sure 50% of the people watching this tutorial do not have
Also, your test case may also include Post - Conditions which specifies anything that
applies after the test case completes.
For our test case, a post - condition would be time & date of login is stored in the
database
During test case execution, you will document the results observed in the Actual Results
column and may even attach some screen shots and based on the results give PASS &
FAIL status.
This entire table may be created in Word, Excel or any other Test management
tool.That's all to Test Case Design
Format of Standard Test Cases
Below is format of a standard login Test case
Test Test Test Steps Test Expected Actual Pass
Case Scenario Data Results Results
ID
TU01 Check Userid = User As Pass
Customer 1. Go to site guru99 should Expected
Login http://demo.guru99.com Password Login into
with valid (http://demo.guru99.com) = pass99 application
Data 2. Enter UserId
3. Enter Password
4. Click Submit
TU02 Check Userid = User As Pass
Customer 1. Go to site guru99 should not Expected
Login http://demo.guru99.com Password Login into
with (http://demo.guru99.com) = glass99 application
invalid 2. Enter UserId
Data 3. Enter Password
4. Click Submit
While drafting a test case do include the following information
The description of what requirement is being tested
The explanation of how the system will be tested
The test setup like: version of application under test, software, data files, operating
system, hardware, security access, physical or logical date, time of day, prerequisites
such as other tests and any other setup information pertinent to the requirements being
tested
Inputs and outputs or actions and expected results
Any proofs or attachments
https://www.guru99.com/test-case.html 3/9
Use
10/04/2018 active case language How to Write Test Cases: Sample Template with Examples
Test Case should not be more than 15 steps
Automated test script is commented with inputs, purpose and expected results
Setup offers alternative to pre-requisite tests
With other tests, it should be incorrect business scenario order
Best Practice for writing good Test Case Example.
1. Test Cases need to be simple and transparent:
Create test cases that are as simple as possible. They must be clear and concise as the
author of test case may not execute them.
Use assertive language like go to home page, enter data, click on this and so on. This
makes the understanding the test steps easy and test execution faster.
2. Create Test Case with End User in Mind
Ultimate goal of any software project is to create test cases that meets customer
requirements and is easy to use and operate. A tester must create test cases keeping in
mind the end user perspective
3. Avoid test case repetition.
Do not repeat test cases. If a test case is needed for executing some other test case, call the
test case by its test case id in the pre-condition column
4. Do not Assume
Do not assume functionality and features of your software application while preparing test
case. Stick to the Specification Documents.
5. Ensure 100% Coverage
Make sure you write test cases to check all software requirements mentioned in the
specification document. Use Traceability Matrix (/traceability-matrix.html)to ensure no
functions/conditions is left untested.
6. Test Cases must be identifiable.
Name the test case id such that they are identified easily while tracking defects or identifying
a software requirement at a later stage.
https://www.guru99.com/test-case.html 4/9
7. Implement
10/04/2018 Testing Techniques
How to Write Test Cases: Sample Template with Examples
It's not possible to check every possible condition in your software application. Testing
techniques help you select a few test cases with the maximum possibility of finding a defect.
Boundary Value Analysis (BVA): As the name suggests it's the technique that defines
the testing of boundaries for specified range of values.
Equivalence Partition (EP): This technique partitions the range into equal parts/groups
that tend to have the same behavior.
State Transition Technique: This method is used when software behavior changes
from one state to another following particular action.
Error Guessing Technique: This is guessing/anticipating the error that may arise while
testing.This is not a formal method and takes advantages of a tester's experience with
the application
8. Self cleaning
The test case you create must return the Test Environment (/test-environment-software-
testing.html)to the pre-test state and should not render the test environment unusable. This
is especially true for configuration testing.
9. Repeatable and self-standing
The test case should generate the same results every time no matter who tests it
10. Peer Review.
After creating test cases, get them reviewed by your colleagues. Your peers can uncover
defects in your test case design, which you may easily miss.
Test Case Management Tools
Test management tools are the automation tools that help to manage and maintain the Test
Cases. Main Features of a test case management tool are
1. For documenting Test Cases: With tools you can expedite Test Case creation with use
of templates
2. Execute the Test Case and Record the results: Test Case can be executed through
the tools and results obtained can be easily recorded.
3. Automate the Defect Tracking: Failed tests are automatically linked to the bug tracker ,
which in turn can be assigned to the developers and can be tracked by email
notifications.
4. Traceability: Requirements, Test cases, Execution of Test cases are all interlinked
through the tools, and each case can be traced to each other to check test coverage.
https://www.guru99.com/test-case.html 5/9
5. Protecting
10/04/2018 Test Cases: Test How
cases should
to Write be reusable
Test Cases: and with
Sample Template should be protected from
Examples
being lost or corrupted due to poor version control. Test Case Management Tools offer
features like
Naming and numbering conventions
Versioning
Read only storage
Controlled access
Off-site backup
Popular Test Management tools are : Quality Center (/quality-center-tutorials.html) and JIRA
(/jira-tutorial-a-complete-guide-for-beginners.html)
Resources
Please note that the template used will vary from project to project. Read this Article
(/download-sample-test-case-template-with-explanation-of-important-fields.html)to Learn
Test Case Template with Explanation of Important Fields
Download the above Test Case Template Excel (.xls) (https://drive.google.com/uc?
export=download&id=0ByI5-ZLwpo25eXFlcU5ZMTJsT28)
Prev (/test-scenario.html) Report a Bug
Next (/test-basis.html)
YOU MIGHT LIKE:
SOFTWARE TESTING SOFTWARE TESTING SOFTWARE TESTING
(/application-testing.html) (/localization-testing.html) (/age-testing.html)
(/application- (/localization- (/age-testing.html)
testing.html) testing.html) What is Defect Age in
Application Testing Localization Testing Software Testing?
Tutorial: Methodology, Tutorial: Learn with (/age-testing.html)
Tools, Test Plan, Best Sample Test Cases
Practices (/localization-testing.html)
(/application-testing.html)
https://www.guru99.com/test-case.html 6/9
SOFTWARE
10/04/2018 TESTING SOFTWARE TESTING
How to Write Test Cases: Sample Template SOFTWARE
with Examples TESTING
(/recovery-testing.html) (/what-is-backend- (/agile-vs-scrum.html)
(/recovery- testing.html) (/what- (/agile-vs-
testing.html) is-backend- scrum.html)
Recovery Testing in testing.html) Agile Vs Scrum: Know
Software Testing: What is Backend the Difference
Realistic Test Testing? (/agile-vs-scrum.html)
(/recovery-testing.html) (/what-is-backend-
testing.html)
Testing Tutorials
1) Introduction (/software-testing-introduction-importance.html)
2) Seven Principles (/software-testing-seven-principles.html)
3) SDLC vs STLC (/software-testing-lifecycle.html)
4) Testing Life Cycle (/software-testing-life-cycle.html)
5) Manual Testing (/manual-testing.html)
6) Automation Testing (/automation-testing.html)
7) Unit Testing (/unit-testing-guide.html)
8) Integration Testing (/integration-testing.html)
9) System Testing (/system-testing.html)
10) Smoke-Sanity Testing (/smoke-sanity-testing.html)
11) Regression Testing (/regression-testing.html)
12) Non Functional Testing (/non-functional-testing.html)
13) Test Formality (/test-tutorial.html)
14) Test Scenario (/test-scenario.html)
15) Test Case Design (/test-case.html)
16) Test Basis (/test-basis.html)
17) Traceability Matrix (/traceability-matrix.html)
18) Design your Test Data (/software-testing-test-data.html)
19) Sample Test Case Template (/download-sample-test-case-template-with-explanation-of-important-
fields.html)
20) BVA & EP (/equivalence-partitioning-boundary-value-analysis.html)
21) Decision Table Testing (/software-testing-techniques-1.html)
https://www.guru99.com/test-case.html 7/9
10/04/2018 How to Write Test Cases: Sample Template with Examples
About
About US (/about-us.html)
Advertise with Us (/advertise-us.html)
Write For Us (/become-an-instructor.html)
Contact US (/contact-us.html)
Career Suggestion
SAP Career Suggestion Tool (/best-sap-module.html)
Software Testing as a Career (/software-testing-career-
complete-guide.html)
Top Tools List (/testing-development-tools.html)
Certificates (/certificate-it-professional.html)
Interesting
https://www.guru99.com/test-case.html 8/9
10/04/2018 Books to Read! (/books.html)
How to Write Test Cases: Sample Template with Examples
Suggest a Tutorial
Blog (/blog/)
Quiz (/tests.html)
Execute online
Execute Java Online (/try-java-editor.html)
Execute Javascript (/execute-javascript-online.html)
Execute HTML (/execute-html-online.html)
Execute Python (/execute-python-online.html)
© Copyright - Guru99 2018
Privacy Policy (/privacy-policy.html)
https://www.guru99.com/test-case.html 9/9