KEMBAR78
How To Write Test Cases - Sample Template With Examples | PDF | Password | Software Testing
0% found this document useful (0 votes)
283 views7 pages

How To Write Test Cases - Sample Template With Examples

The document discusses how to write test cases for software testing. It provides a sample template for a test case with examples, including sections for the test case description, test data, test steps, expected results, and actual results. It also outlines best practices like including preconditions and postconditions. The template standardizes test cases with an ID, description, steps, data, expected and actual results, and pass/fail status. Documenting test cases clearly and systematically is important for testing software requirements effectively.

Uploaded by

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

How To Write Test Cases - Sample Template With Examples

The document discusses how to write test cases for software testing. It provides a sample template for a test case with examples, including sections for the test case description, test data, test steps, expected results, and actual results. It also outlines best practices like including preconditions and postconditions. The template standardizes test cases with an ID, description, steps, data, expected and actual results, and pass/fail status. Documenting test cases clearly and systematically is important for testing software requirements effectively.

Uploaded by

Florin Condurat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

10/27/21, 11:01 PM How to Write Test Cases: Sample Template with Examples

How to Write Test Cases: Sample Template with


Examples
By Thomas Hamilton Updated October 19, 2021

What is a Test Case?


A TEST CASE is a set of actions executed to verify a particular feature or functionality of your
software application. A Test Case contains test steps, test data, precondition, postcondition
developed for specific test scenario to verify any requirement. The test case includes specific
variables or conditions, using which a testing engineer can compare expected and actual
results to determine whether a software product is functioning as per the requirements of
the customer.

Test Scenario Vs Test Case


Test scenarios are rather vague and cover a wide range of possibilities. Testing is all about
being very specific.

For a Test Scenario: Check Login Functionality there many possible test cases are:

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 a User ID is Empty & Login Button is pressed, and
many more

This is nothing but a Test Case.

In this tutorial, you will learn how to write test cases in manual testing with example –

How to Write Test Cases in Manual Testing


The format of Standard Test Cases
Best Practice for writing good Test Case Example.
Test Case Management Tools
Resources
https://www.guru99.com/test-case.html 1/10
10/27/21, 11:01 PM How to Write Test Cases: Sample Template with Examples

How to write a TEST CASE? Software Testing Tutorial

Click here if the video is not accessible

How to Write Test Cases in Manual Testing


Let’s create a Test Case for the scenario: Check Login Functionality

Step 1) A simple test case to explain the scenario would be

Test Case # Test Case Description


https://www.guru99.com/test-case.html 2/10
10/27/21, 11:01 PM How to Write Test Cases: Sample Template with Examples

1 Check response when valid email and password is entered

Step 2) In order to execute the test case, you would need Test Data. Adding it below

Test
Test Case Description Test Data
Case #

Check response when valid email and Email: guru99@email.com


1
password is entered Password: lNf9^Oti7^2h

Identifying test data can be time-consuming and may sometimes require creating test data
afresh. The reason it needs to be documented.

Step 3) In order to execute a test case, a tester needs to perform a specific set of actions on
the AUT. This is documented as below:

Test
Test Case Description Test Steps Test Data
Case #

1) Enter Email
Address Email:
guru99@email.com
Check response when valid email and 2) Enter
1
password is entered Password Password:
lNf9^Oti7^2h
3) Click Sign in

Many times the Test Steps are not simple as above, hence they need documentation. Also,
the author of the test case may leave the organization or go on a vacation or is sick and off
duty or is very busy with other critical tasks. A recently hire may be asked to execute the test
case. Documented steps will help him and also facilitate reviews by other stakeholders.

Step 4) The goal of test cases in software testing is to check behavior of the AUT for an
expected result. This needs to be documented as below
https://www.guru99.com/test-case.html 3/10
10/27/21, 11:01 PM How to Write Test Cases: Sample Template with Examples

Test Test Case Description Test Data Expected Result


Case #

Email:
Check response when valid email and guru99@email.com
Login should be
1
password is entered Password: successful
lNf9^Oti7^2h

During test execution time, the tester will check expected results against actual results and
assign a pass or fail status

Test
Expected Actual
Case Test Case Description Test Data Pass/Fail
Result Result
#

Email:
Check response Login
guru99@email.com Login was
1 when valid email and should be Pass
Password: successful
password is entered successful
lNf9^Oti7^2h

Step 5) That apart your test case -may have a field like, Pre – Condition which specifies
things that must be in place before the test can run. For our test case, a pre-condition would
be to have a browser installed to have access to the site under test. A test case may also
include Post – Conditions which specifies anything that applies after the test case completes.
For our test case, a postcondition would be time & date of login is stored in the database

https://www.guru99.com/test-case.html 4/10
10/27/21, 11:01 PM How to Write Test Cases: Sample Template with Examples

The format of Standard Test Cases


Below is a format of a standard login Test cases example.

Test
Test Case Expected Actual
Case Test Steps Test Data Pa
Description Results Results
ID

1. Go to site User
Check Userid =
http://demo.guru99.com should
Customer guru99 As
TU01 2. Enter UserId Login into Pa
Login with Password Expected
3. Enter Password an
valid Data = pass99
4. Click Submit application

TU02 Check Userid = User As Pa


Customer 1. Go to site guru99 should not Expected
https://www.guru99.com/test-case.html 5/10
10/27/21, 11:01 PM How to Write Test Cases: Sample Template with Examples

Login with http://demo.guru99.com Login into


2. Enter UserId
invalid 3. Enter Password Password an
Data 4. Click Submit = glass99 application

This entire table may be created in Word, Excel or any other Test management tool. That’s all
to Test Case Design

While drafting a test case to 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 a version of an 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
Use active case language
Test Case should not be more than 15 steps
An automated test script is commented with inputs, purpose and expected results
The setup offers an alternative to pre-requisite tests
With other tests, it should be an 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 the test case may not execute them.

Use assertive language like go to the home page, enter data, click on this and so on. This
makes the understanding the test steps easy and tests execution faster.

2. Create Test Case with End User in Mind

The ultimate goal of any software project is to create test cases that meet customer
https://www.guru99.com/test-case.html 6/10
10/27/21, 11:01 PM How to Write Test Cases: Sample Template with Examples
The ultimate goal of any software project is to create test cases that meet 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 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.

7. Implement Testing Techniques

It’s not possible to check every possible condition in your software application. Software
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 a 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
doing manual testing. This is not a formal method and takes advantages of a tester’s
https://www.guru99.com/test-case.html 7/10

You might also like