The use case and test case are the terms frequently used in the software testing field, which are also closely related. A use case is used to specify how to use the system designed for performing a specific task. As against, a test case is a group of test inputs, execution conditions, and expected results developed for a particular test objective.
Furthermore, the use case does not run or execute as it is a textual or diagrammatic presentation of a document which specifies how to accomplish a certain task. Whereas, test cases are prepared by the software testers to validate the software and check whether it is working as per requirements or not.
Content: Use Case Vs Test Case
Comparison Chart
Basis for comparison | Use Case | Test Case |
---|---|---|
Basic | List of sequence-wise actions describing the interaction among the role and system to attain a specified objective, | Group of conditions and variables according to which the behavior of the software is determined. |
Goal | Complying a set of operation to reach the destination. | Indicates the test programs and the interactions between user and system. |
Follows | Different paths | Single test case is tested a time |
Dependence | On the requirements | Over the use case |
Necessity | Documents and research is required | Test scripts, each test scripts complete one step |
Completion | Once in a time | The testing process is repeated again and again finish it. |
Interaction with | User | Results |
Managed by | Diagram | Function tests |
Works by | Following the step by step function ability of the software. | The use case steps can be followed. |
Definition of Use Case
Use Cases performs an important role in the requirement analysis phase of Software Development Life Cycle, where the interaction of the user and the system is demonstrated. The use cases are the base for deriving the test cases and the method of deriving the test case is known as use case path analysis.
An actor which is a system boundary interface is responsible for defining the Use Case. A use case is comprised of preconditions, results and sequential execution.
Use Case Roles
- Management and monitoring of requirements
- Identification of the classes and objects
- Designing and coding
- Developing application documentation
- Producing training
- Developing test cases
Information required to define a Use Case is given as followed
- Use case name or ID – A small name given to the business that identifies that particular use case.
- Actor – An actor is intended to represent the roles that people play as the system operates.
- Aim – It specifies objective and what a use case could achieve by a defined group of conditions. It includes preconditions and results.
- Detailed description – It contains the information like a sequence of the steps, response of steps, precondition, results and events of the internal system.
- Exception – The generated errors that could deviate the actor from the basic course.
- Alternative course – A set of valid events may increase or decrease the number of steps in case of deviation.
Definition of Test Case
The test case is a set of inputs and expected output which is used for analyzing the program behaviour. The relationship established between the test case and use case definition must be is one-to-one. It is required to create two test cases for every use case. Use case description is fed as the input to the test case worksheet, which is also prepared by the actor.
The process of testing entails setting up the required preconditions, providing the test case inputs, obtaining and analysing the output and comparing these with the expected outputs to find whether the test succeeded or not. Test Case templates could contain inputs in the two forms – Preconditions and actual inputs.
Preconditions: The pattern of execution of the test case that is prior framed.
Actual inputs: These are provided to the test case on the basis of the test case and testing method.
Similarly, it has outputs like – Postconditions and actual outputs.
Process of generating a test case
- Identify the test resources
- Identify conditions to be tested
- Rank test conditions
- Choose conditions for testing
- Determine the correct outcome of processing
- Create test cases
- Document test conditions
- Conduct test
- Verify and correct
Information required to define a Test Case is given as followed
- Test objective – It is somehow related to the use case definition that specifies the description action.
- Test condition – Any scenario probably as an outcome of the action that is being tested from the use case description worksheet.
- Operator action – The operator is supposed to perform the specific steps to execute the test condition.
- Input specifications – The input necessarily needed for the execution of the test cases.
- Output specifications – The expected results produced by performing the operator actions over the provided input.
- Success or failure – The outcome of executing the test case.
- Comments – Supervision and guidance provided by the actor to the individual carrying out the test.
Test Case Designing technique
- Black-box approach does not consider the inner structure of the software under test and contain zero knowledge about it but the tester is aware of what result it could produce or what it does.
- White-box approach emphasizes on the inner structure of the software to be tested. The tester must have complete knowledge of the internal structure along with codes and pseudocode.
Benefits of a properly designed test case
- The detection of the defects is easier and highly possible.
- Organizational resources are more effectively utilized.
- Higher probability of test reuse.
- Testing and project schedules and budgets can be strictly followed.
- Higher quality project is developed and delivered.
Key Differences Between Use Case and Test Case
- The use case contains actions sequentially which illustrate the interactions between the user using a process and the system to achieve a goal. Conversely, a test case is comprised of conditions, inputs and expected output to validate the software.
- Use case main purpose is to provide a document through which an objective can be attained while the test case is intended to check the software behaviour that whether it works as defined or not.
- While testing the software the single test case undergoes through the process. In contrast, in a use case there exist different paths to reach the target, among which any path can be followed.
- The use case relies on the software requirements, whereas the test case depends on the use case.
- You can complete a use case in one go. On the contrary, in testing there are multiple test cases are involved, each dedicated for testing a particular area in the software.
- The use case involves interaction with users, while the test case does not require interaction with users.
Conclusion
Use cases are used in the requirement and design phases of the SDLC, which lead the development in the right direction. On the other hand, test cases are employed in the testing phase of the SDLC where the correct execution is demonstrated, and failures in the software are detected.
Leave a Reply