Software Testing in a crucial component of the Software Cycle, without this all processes can be termed futile. It fool-proofs all efforts to make sure the actual software product matches expected requirements and is free of all errors.
What is a Test Case?
In Software Testing, a test case is a set of actions, inputs, execution conditions and procedures to verify or check a particular feature or function of a product or application. It is important to write a good test case as they determine the competence of the feature/functionality.
A good test case has certain characteristics,
Characteristics of a Good Test Case
- Can be understood and executed by any tester
Your test case should seem to have a precise universal language which can easily be grasped by any tester. This makes sure that you have thoroughly studied and created an appropriate test for the required application
- A good test case is created keeping in mind the end user
A good test case can only be created if the tester puts themselves in the shoes of the end user and includes all necessary details. You must be willing to put extra effort; this will help you in the long-run of your cases.
Remember: Your test determines the difference between a well-tested application and a poorly-tested application and will ultimately ensure how the end user receives it.
- Small, isolated and atomic
This depends on what exactly requires the test but any good test case must be small, isolated and atomic. This makes them easier to understand and execute while making sure the errors are none or easily identifiable.
- Independent of each other
Your test case should be independent of other cases and must fail/pass independently of each other. A good test must also define its expected result.
Now you know the basic characteristics of a good test case, remember these are not limited to the above points.
How to write a Good Test Case?
- A strong, precise Title
Your title should provide clarity about the test case. For example if you are creating a test case to check the login page it should include “Login Page” in the title.
- Include clear Description
A description should tell what the test is about. This can also include other information such as testing conditions, environment, data etc. It should be easy to read and should specify the goal of the test case.
- Mention Assumptions and Preconditions
This information is important. You must put in the assumptions for the test and any preconditions required. This can also include which page the user should start the test on, dependencies, extra setup, requirements etc.
- Clear and Concise Test Steps
Your test must not look unnecessarily complicated. Keep it simple and precise. The test steps should include all the necessary data and information needed to execute the test properly. This is the most important part of the test case.
- Mention the Expected Result
This determines whether a test is “pass” or “fail”. The expected result of the test case should be mentioned. This is the goal of the overall Test Case.
The steps to create a good test case aren’t limited to the list above. These are the points every tester should keep in mind along with other details dependent upon the type and complexity of the feature and its required test.
Sample Test Case
Here is an example of a test case:
Title: Login Page – Successful authentication on gmail
Description: A registered user should be able to successfully login at gmail.com
Precondition: the user must already be registered with an email address and password.
Assumption: a supported browser is being used.
- Navigate to gmail.com
- In the ’email’ field, enter the email address of the registered user.
- Click the ‘Next’ button.
- Enter the password of the registered user
- Click ‘Sign In’
Expected Result: A page displaying the gmail user’s inbox should load, showing any new message at the top of the page.
Keep in mind all the above points and study the feature thoroughly to create an apt test. Practice to polish your skills, each one will make you better and will help you to recognize the defects and gaps of a feature or function. Software testing is the litmus test of any application or product. Trust your skills and keep learning!