What is a Test Case?
IEEE Standard 610 (1990) defines test case as follows:
“(1) A set of test inputs, execution conditions, and expected results developed for a
particular objective, such as to exercise a particular program path or to verify compliance
with a specific requirement.
“(2) (IEEE Std 829-1983) Documentation specifying inputs, predicted results, and a set
of execution conditions for a test item.”
Why do we write Test Case?
The primary objective of a test case is to validate that all the parts of the requirements are covered. This is an integral part of software testing which would help validate that all the functionalities are working as specified in requirement. The outcome of testing results is important in determining the quality of the final product and in deciding whether or not to release the product.
What is needed to write a Test Case?
Before we start writing test cases, the following information is needed:
- Requirements should be analyzed to derive the scenarios that will be tested
- Test Data – To write a test case, one should know the inputs/user actions and corresponding output/system behavior.
- Identify Test Environment
Qualities of a good test case:
Test Case is an important component of “Testware”. Over time, different testers will be using the test case which means it is not necessary that the test case designer will be sole user of the test case. Also at times it may happen that test case will be designed by a particular group in a team and will be excecuted by another group. This makes it very important that a test case is written in a layman’s language – easy, crisp and clear. Anyone who takes a look at the test case should be able to understand the objective of the test case, what it is meant to do and what actions need to be performed by “tester” in order to execute the test case.
Following points help ensure a good quality of test case:
- It should be self-explanatory. Anyone taking a look at the test case should be able to understand the objective of the test case.
- Results of a test should be easy to determine.
- Use active case while writing test case.
- Simple language used in the test case ensures it is not testing a tester’s vocabulary.
- It is always good to provide data to be used for the test, instead of letting the tester use a test data based on instructions in a test case
Points mentioned above are simply guidelines and not a mandatory rule – this may vary throughout various organizations based on internal practices.
A Test case contains:
- Test Case ID – a test case must be uniquely identified by an ID, called test case ID.
- Requirement – Test case should be linked to the requirement which it is testing. This is need for requirement traceability which ensures that all the scenarios in the Requirements Specification have been covered by at least one test case.
- Priority of a test case
- Test Case Name
- Designer Name
- Environment details of the test environment
- Objective – briefly states the scenario that the test case is testing
- Pre–Test conditions – This are the conditions that needs to be satisfied before executing the test
- Design Steps – Steps that the tester needs to execute
- Expected Results – explains/mentions the application/system output or behavior when a step is executed
- Actual Results – This is recorded by tester for each step during test execution – mentioning his/her observation
- Post Conditions
- Attachments – Test case may also have attachments containing any screen-shots that will be validated during execution or for any such purpose. This is helpful in GUI testing.
An example of a test case in HP Quality Center:
In Quality Center a test case is written and maintained in Test Plan area.
Details: The details tab contains the test case information as shown.
Design Steps: This will have the Steps that will be executed during test run.
Click OK to save the step.
Attachments: In this tab, designer may attach a file (requirements extract that relate to the test case or a screen print) to the test case.
Requirement Coverage: Test case is linked to a requirement in the “Req Coverage” tab.
Linked Defects: This tab links defects associated with the test case.