Professional Documents
Culture Documents
Test and Quality Module2 Test Case
Test and Quality Module2 Test Case
is a document, which has a set of test data, preconditions, expected results and post
conditions, developed for a particular test scenario in order to verify compliance against a
specific requirement.
acts as the starting point for the test execution, and after applying a set of input values,
the application has a definitive outcome and leaves the system at some end point or also
known as execution post condition.
is a set of conditions or variables under which a tester will determine whether a system
under test satisfies requirements or works correctly.
is defined as a set of actions executed to verify a particular feature or functionality of the
software application. A test case is an indispensable component of the Software Testing
LifeCycle that helps validate the AUT (Application Under Test).
The process of developing test cases can also help find problems in the requirements or
design of an application.
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 Suite ID The ID of the test suite to which this test case belongs.
Test Case ID The ID of the test case.
Test Case
The summary / objective of the test case.
Summary
Related
The ID of the requirement this test case relates/traces to.
Requirement
Any prerequisites or preconditions that must be fulfilled prior to executing
Prerequisites
the test.
Test Procedure Step-by-step procedure to execute the test.
The test data, or links to the test data, that are to be used while conducting
Test Data
the test.
Expected Result The expected result of the test.
Actual Result The actual result of the test; to be filled after executing the test.
Pass or Fail. Other statuses can be ‘Not Executed’ if testing is not performed
Status
and ‘Blocked’ if testing is blocked.
Remarks Any comments on the test case or test execution.
Created By The name of the author of the test case.
Date of Creation The date of creation of the test case.
Executed By The name of the person who executed the test.
Date of Execution The date of execution of the test.
Test The environment (Hardware/Software/Network) in which the test was
Environment executed.
Example:
Let us say that we need to check an input field that can accept maximum of 10 characters.
While developing the test cases for the above scenario, the test cases are documented the
following way. In the below example, the first case is a pass scenario while the second case is a
FAIL.
If the expected result doesn't match with the actual result, then we log a defect. The defect goes
through the defect life cycle and the testers address the same after fix.
This is a fairly common structure that contains a number of important points. The test case has
multiple test steps, some of which have expected result and some which do not.
You should have 3-8 test steps in a test case. If you only have a few test steps, you should
probably consider making a checklist instead – it’s not worth your while to keep track of a lot of
small test cases when a checklist will do the job just as well.
When testers report defects based on the test case, they should indicate which test step failed,
in order to make troubleshooting easier.
When you write a test case, you don’t need to specify the expected result for each test step if
the result is obvious. In the above example there are unnecessary outcomes of several test steps.
For example, if the browser doesn’t open, the tester won’t be able to proceed to the next step.
If your test case has too many test steps you ought to think about breaking up the test case
into a set of smaller ones. If the test case contains a long list of test steps, and an error occurs,
the developer will have to backtrack and repeat all the test steps, which he or she might not do by
accident, or out of laziness.
Having too many test steps can be a disadvantage for the tester, too. The tester may have to
repeat each one of the test steps to ensure that the bug is fixed.
Sometimes the test case template contains a field for pre-conditions. In practice only a few of the
test cases need them, so the field is often left empty. An example of a pre-condition is that to
change the customer’s address you have to enter a customer first. You can use this field to
reference to other test cases, for example by entering a test case ID here.
Test cases are often grouped in test runs. A test run is simply a collection of test cases that testers
should perform in a particular order. Rather that inserting pre-conditions into each test case, you
could put them in the beginning of a test run instead. An example of pre-condition for a bunch of
test cases could be to put the system in a certain state, for example, loading a certain set of
customers into the system before testing begins.
If you put your test data in a separate file and reference it from the test case, you’ll be able to use
a single test case to test many different variations of the data. This is a better solution than
explicitly stating test data in the test case.
A test data file can be created in Excel, in Notepad, or included in a database. In the test case
above, the “Testaccounts.txt” file might consist of one column for the user name and one for the
password. Each line in the test data file represents a unique combination of inputs. The test case
will be very efficient because only one test case is needed to test multiple combinations. It also
means that the choice of which test data to use is not just left up to the tester’s discretion.
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 Password:
1
password is entered 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
Email:
Address
guru99@email.com
Check response when valid email and
1
password is entered 2) Enter 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 is to check behavior the AUT for an expected result. This needs to
be documented as below
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
Test Case Expected Actual
Case Test Data Pass/Fail
Description Result Result
#
Check response when
Email: guru99@email.com Login should Login was
1 valid email and Pass
Password: lNf9^Oti7^2h be successful successful
password is entered
Step 5) That apart your test case -may have a field like, Pre - Condition which specifies things
that must 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
The format of Standard Test Cases
Below is a format of a standard login Test case
Test
Test Expected Actual
Case Test Steps Test Data Pass/Fail
Scenario Results Results
ID
1. Go to site
http://demo.guru99.c
Check Userid =
om User should
Customer guru99 As
TU01 2. Enter UserId Login into an Pass
Login with Password = Expected
3. Enter Password application
valid Data pass99
4. Click Submit
1. Go to site
http://demo.guru99.c
Check Userid = User should
om
Customer guru99 not Login As
TU02 2. Enter UserId Pass
Login with Password = into an Expected
3. Enter Password
invalid Data glass99 application
4. Click Submit
This entire table may be created in Word, Excel or any other Test management tool. That's all to
Test Case Design
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.
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
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.
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.
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
experience with the application
8. Self-cleaning
The test case you create must return the Test Environment to the pre-test state and should not
render the test environment unusable. This is especially true for configuration testing.
The test case should generate the same results every time no matter who tests it
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.
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.
5. Protecting Test Cases: Test cases should be reusable and should be protected from
being lost or corrupted due to poor version control. Test Case Management Tools offer
features like