In the Software Tester or QA profession writing Test Cases plays a vital part in the software testing process. Writing test cases does not only mean jotting down the requirement into the scenario, rather it deals with writing down all the possible scenarios after the proper understanding of the project and business requirement. And it’s the effective test cases based on which the testing of the product is to be performed.
So, test cases should be given more priority and created before the testing starts. For a fresher in the Software Testing industry, it is very important to follow the guidelines to write test cases effectively for any of the given features. In this article, we will focus on the Guidelines to write test cases effectively for general functionalities which helps to achieve a better test case design.
|Post On:||Test Case For Guidelines To Write|
|Post Type:||Test Case Template|
|Applicable For:||Freshers & Experience|
|Get Updates:||Software Testingo Telegram Group|
Guidelines To Write Test Cases
Nowadays, when going for an interview for any Software testing opening, the applicant can expect several questions related to Test Cases for different scenarios. A few of the common questions generally asked by the interviewer are- What are the test cases for checking the Registration process?
What are the possible test cases for validating the Email field on the website? What are the possible test cases for Login Page? What are the common Guidelines to write test cases effectively? and many more. We will discuss all these types of questions later in this document.
Guidelines to Write Test Cases Effectively
When writing test cases for any project, there is always some general test cases that are to be written and followed during testing. Follow the below guidelines to write test cases for general scenarios in most of the applications:
- Proper Email validation – There should be proper validation for the field like email and it should follow the proper regex format, which is email@example.com.
- Proper Phone number Validation – It should have proper validation for numeric content in the phone number field and it should be between 10-12 based on the requirement. It should not accept more than that.
- Proper Validation of text field – There should some proper validation on the input character for text fields like- Firstname, Lastname, Address, and so on. The general validation should be the word count, something like a maximum of 100 or less than 150.
- Mandatory field validation – All the mandatory fields marked in Asterisk(*) should be properly validated.
- Error message validation – Verify that the error message is displaying properly for the respective field and the position should also be proper.
- Numeric Values – All numeric values should be properly formatted. All check numeric fields with maximum, minimum, and float values.
- Button Functionality – All the available buttons should work properly and should be clickable based on the functionality.
- Exception Handling – Exception for any field while value population through API should be properly handled.
- Online and Offline Mode – While performing testing, the tester should check the application in both online and offline mode.
- Negative Scenario – Along with the happy path scenario, there should some test cases for the negative scenarios in order to find undiscovered errors.
- Confirmation message validation – There should be a valid confirmation message displayed after the successful submission of any form and page.
- Delete Confirmation – When deleting any value for any field, then there should be a confirmation pop confirming the user before the Delete functionality is invoked.
- Reset Functionality – Is there is Reset functionality, then clicking on Reset should reset the whole page.
- Timeout – There should be a test case for the page timeout and it should be configured from the developer side.
- Spelling and Grammar check – The spelling and grammatical mistakes should be properly validated.
- Alignment Validation – The fields like- textbox, dropdown list, checkbox, etc should be properly aligned.
- Spacing – There should be proper spacing between the fields and labels.
- Font style – The font style and size should be uniform and should be as per requirement.
- Tab functionality – Proper validation should be done for the Tab key. Whenever the tab key is pressed from the key, then the pointer should get changed from one field to the other.
- Broken images and links – Proper checking should be done to find out the broken links and images in the application.
- Cross-browser and multi-device validation – The UI of the application should look the same for different browsers and mobile devices.
- Security Testing- Trying to access the internal functionality of the application functionality in the logged-out state by changing the URL.
- Error Highlight – Proper checking should be done to verify the field with error is getting highlighted in red.
- Upload Functionality – Check image and file upload functionality is working properly. Also check by uploading images and files of different formats like- JPEG, JPG, doc, pdf, exe, etc.
- Export Functionality – File should get exported properly in the proper file extension. Check export functionality by exporting the large file and containing a special character.
Write Test Cases Example
Other than all the above points, there can be many more test cases which can be generated based on the business and project requirement. It is the best practice to set guidelines to write test cases in any of the projects and should be made mandatory to be followed by all the team members while designing test cases.
Let’s discuss some of the general Interview questions and answers with the possible test cases that can be derived from such questions asked by the interviewer.
Question 1- What are the test cases for checking the Registration process? Imagining there are 3 fields – Name, Email, and Phone Number.
Answer: There can be several test cases generated for this case.
- The Registration page should have a proper URL and proper page title.
- The Submit button should work properly and click on the Submit button should save the data in the database.
- The name field should have some character limitations, it should not be too long.
- The name field should have some validation for the character type- alphanumeric or alphabetic.
- The Email field should follow the basic regex format, which is firstname.lastname@example.org.
- The error message should be displayed for the invalid and already registered email address.
- The phone number should display integer value only. There should validation for phone number digit limit and it should accept 10-12 digits only.
- The proper error message should be displayed for an invalid phone number.
- The previously displayed error message should get removed on entering valid values.
- The proper and valid confirmation message should display on form submission.
Question 2- Write the test cases for testing the Login functionality of the application containing the Username and Password field?
Answer: The general derived test cases for Login functionality are:
- The login page should have a valid URL.
- Check with all possible negative scenarios. The user should not be able to login with the below combinations.
- The valid username and an invalid password.
- Invalid username and valid password.
- Invalid Username and password.
- Check with a valid username and password.
- The proper error message should display for invalid username and password combination. The error message should be clear enough for an end-user to understand.
- After the Login button is clicked, the user should get logged in with valid credentials.
- Try to find the spelling and grammatical mistakes if any.
Question 3- What are the possible test cases for validating the Email field?
Answer: The possible test cases for email validation are:
- Check with all possible scenarios For email in the address field, as it should support alphabet, number, underscore, dash. Dot, plus sign, quote, etc for valid email format.
- The Email field should follow the basic regex format, which is email@example.com.
- The error message should display be displayed for an invalid and already registered email address.
Question 4- What are the possibilities for test cases for Reset Password? Suppose there are 3 fields- Current Password, New Password, Confirm Password.
Answer: The possible scenarios for reset password are:
- The password reset should have a proper URL with the page title.
- The entered Current Password should be a valid one.
- The entered New Password and Confirm Password should match.
- There should be some validation for the new password like- minimum of 6, a maximum of 10 characters, should be alphanumeric, etc.
- The error message should display for invalid Current Password and unmatched new passwords.
- The Submit button should work properly and the changed password should get updated in the database.
- The proper Password change confirmation message should display to the user.
Following the proper guidelines to write test cases enhances the quality of test case design and will be more effective during execution. Keeping test cases simple yet effective is the skill that any software tester should possess so that maintenance at the later stage would be easy.
Guidelines to write test cases has to be followed by all the team members in the project and the written test cases have to be reviewed to ensure that the set guidelines to write test cases have been followed.