How To Write Test Cases
How To Write Test Cases
For a Test Scenario: Check Login Functionality there are many possible
test cases:
Step 2) In order to execute the test case, you would need Test Data.
Adding it below
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 the behavior of AUT for an
expected result. This needs to be documented as below
During test execution time, the tester will check expected results against
actual results and assign a pass or fail status
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
Test Case Test Scenario Test Steps Test Data Expected Actual Pass/Fail
ID Results Results
TU01 Check Userid = User As Pass
Customer Go to site user.name should Expected
Login with valid http://example.co Password = Login into
Data m pass99 an
Enter UserId application
Enter Password
Click Submit
TU02 Check Go to site Userid = User As Pass
Customer http://example.co user.name should not Expected
Login with m Password = Login into
invalid Data Enter UserId glass99 an
Enter Password application
Click Submit
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
Name the test case id such that they are identified easily while tracking
defects or identifying a software requirement at a later stage.
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.
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.