Best Practices For Test Case Creation and Maintenance
Test cases are sets of conditions or variables used by software testers to determine if a system works correctly as expected. Test cases help in validating the testing coverage of a software application.
A test case contains essential fields that provides the information about the test case, the activity involved in execution and the results expected. These fields include a unique name, any preconditions, detailed steps, input conditions and expected results for a particular app function. You can read the complete white paper on best practises in Test case creation and maintenance here:
Essentials Of A Good Test Case:
- It is easy to understand and execute.
- It is accurate with specific objective.
- It is easy to trace as per requirements.
- It is repeatable, and can be used to test again and again.
- It saves time and money by avoiding unnecessary steps.
- It is reusable.
Best Practices For Effective Test Case Writing
Good test cases are easy to execute and maintain. They make the testing process more effective by saving time and effort. Here are the top 10 best practices to follow while creating test cases:
1) Keep It Simple And Easy To Understand
A good test case that is well written and simple, is easy for the testers to understand and execute. Organize test cases according to specific categories or related areas of the application. Test cases can be grouped based on their user story or modules like browser specific behaviours etc. This makes it easier to review & maintain the test document. Information given in the test cases should be clear to other testers, developers, and other stakeholders involved in the project.
2) Include End User Perspective
Take into account the end user perspective before drafting a test case. Think like an end user who is the key stakeholder for whom the app is intended. Understand the requirement, the functionality aspects to be covered, and the end user perspective. This will help in identifying test scenarios that arise in real life conditions, and also in coming up with test cases that are most critical to the business. For example, in case of an ecommerce app, adding to cart, payment features etc. are frequently used, and plays a critical role in conversions.
3) Use Correct Naming Conventions
Name test cases in a way that makes it easy for stakeholders to identify it and understand its objective. You can name the test cases according to the module or the functional area that is included for testing.
4) Provide Test Case Description
A proper test case description will allow users to understand what is being tested and how. Provide relevant details like the test environment and any other specific information. Mention the testing data to be used and the testing tools, if any to be employed for executing the tests.
5) Include Assumptions And Preconditions
Include all the assumptions and conditions that are applicable for the test case. Provide details of the test environment, any special set up for execution of test case etc.
6) Give The Steps Involved
Include the actual steps involved in the execution of the test cases. Do not miss out on any step. Ensure that all the test case verification steps are covered. Include relevant documents or screenshots that can help in execution of the steps included in the test design.
7) Give Details Of The Test Data
Provide the details of the test data for execution of the test case especially in cases where the same data can be reused. This helps in saving time for creation of the test data for each cycle to be run. Specify the value range, if applicable for respective fields. Don’t try to test each and every value. Aim for maximum coverage by choosing a few select values from each equivalence class.
8) Make It Reusable And Modular
As far as possible ensure that there is no dependency or conflict among test cases. In case there are test cases that are inter-dependent or batched, mention them clearly in the test document.
9) Assign Testing Priority
Assign testing priority to each test case based on the feature or component involved. This will ensure that during execution, high priority test case are executed first.
10) Provide The Expected Result And Post Conditions
Include the expected result for every step of the test case. You can also include screenshots and relevant documents for reference. Mention the post conditions or things to be verified after the execution of the test case.
Tips For Maintenance Of Tests Cases
Change is constant for any software development project. As apps evolve, new upgrades and changes are introduced into the system. Test cases must be maintained and updated to reflect these new changes that are made. Here are a few tips for effective maintenance of test cases:
1) Review Test Cases After Documentations
Get the test cases reviewed by relevant stake holders to ensure that it is easy to understand and does not include any unnecessary steps. A periodic review and revision of test cases will help in updating changes if any that are applicable.
2) Update Existing Test Cases Before Creating New Ones
Update the existing test cases as and when new changes are introduced in the app. Include updates to accommodate changes to any existing user story or functionality.
3) Remove Test Cases That Are Obsolete And Unnecessary
Remove test cases that are no longer valid for existing app features. Exclude duplicate test cases as well from the test suite.
4) Add Relevant Test Cases As Per Requirement
Create and add test cases that are required as per new upgrades or features that are introduced in the software. Add any additional test case that is relevant, including test cases for defects that were found by end users, post production.
Creation of test cases is easier with good knowledge of the technology used, the end user perspective and the objective of the software application. Investing time and effort in creation and maintenance of good test cases makes the entire testing process more effective and ensures the success of the testing plan for the software project.
Originally published at blog.99tests.com on March 16, 2017.