In: Computer Science
Problem Description: What is a test case? What are the characteristics of a good test case? What is a driver? What is a stub? With what type of test is each most closely associated?
Test Case:
A test case is a document, which has a set of test data, preconditions, expected results and postconditions, developed for a particular test scenario in order to verify compliance against a specific requirement.
Test Case 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 postcondition.
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.
Scenario |
Test Step |
Expected Result |
Actual Outcome |
Verify that the input field that can accept maximum of 10 characters |
Login to application and key in 10 characters |
Application should be able to accept all 10 characters. |
Application accepts all 10 characters. |
Verify that the input field that can accept maximum of 11 characters |
Login to application and key in 11 characters |
Application should NOT accept all 11 characters. |
Application accepts all 10 characters. |
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.
Characteristics of good test case:
Accurate
Economical
Repeatable, self-standing
Appropriate
Traceable
Self-cleaning
Stub:
Stubs are used to create user Interface .Underlying functionality may be simulated by stubs. Do not perform any real computations or manipulate any real data. Stubs work downwards, integrating lower and lower levels. Stubs are also used when the software needs to interact with an external system.
Drawback: Cost of writing the stubs.
You may need to simulate ‘returns’ or ‘responses’
This can be problematic.
But it is a good technique too.
Drivers:
We needs drivers to test the lower layers of software. Drivers are simple programs designed specifically for testing that make calls to the lower layers and/or provide parameters. Drivers in bottom-up testing have a similar role to stubs in top-down testing, and are time-consuming to write. Drivers may need to provide various parameters, temporary files, and may have to be coded to recognize the proper value / type of data returned.
With what type of test is each closely associated:
Stubs are used used during Top-down integration testing, in order to simulate the behaviour of the lower-level modules that are not yet integrated.
Drivers are used during Bottom-up integration testing in order to simulate the behaviour of the upper level modules that are not yet integrated.