• +(91) 8750050183
  • info@helpingtesters.com
  • helpingtesters

Guidelines To Write Test Cases

January 26, 2018
test case design, guidelines to write test cases, tips to write test cases

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 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 the better test case design.

Nowadays, when going for an interview for any Software testing opening, the applicant can expect several questions related to Test Cases for different scenarios. Few of the common question 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 the 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 which are to be written and followed during testing. Follow the below guidelines to write test cases for general scenarios in most of the applications:

  1. Proper Email validation– There should be proper validation for the field like email and it should follow the proper regex format, that is xxxx@xx.xx.
  2. Proper Phone number Validation- It should have proper validation for numeric content in phone number field and it should be between 10-12 based on the requirement. It should not accept more than that.
  3. 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 maximum 100 or less than 150.
  4. Mandatory field validation– All the mandatory field marked in Asterisk(*) should be properly validated.
  5. Error message validation– Verify that the error message is displaying properly for the respective field and the position should also be proper.
  6. Numeric Values– All numeric values should be properly formatted. All check numeric fields with maximum, minimum and float values.
  7. Button Functionality– All the available buttons should work properly and should be clickable based on the functionality.
  8. Exception Handling– Exception for any field while value population through API should be properly handled.
  9. Online and Offline Mode- While performing testing, the tester should check the application in both online and offline mode.
  10. Negative Scenario– Along with happy path scenario, there should some test cases for the negative scenarios in order to find undiscovered errors.
  11. Confirmation message validation- There should be valid confirmation message displayed after successful submission of any form and page.
  12. Delete Confirmation- When deleting any value for any field, then there should be confirmation pop confirming user before the Delete functionality is invoked.
  13. Reset Functionality– Is there is Reset functionality, then clicking on Reset should reset the whole page.
  14. Timeout– There should be a test case for the page timeout and it should be configured from the developer side.
  15. Spelling and Grammar check– The spelling and grammatical mistakes should be properly validated.
  16. Alignment Validation– The fields like- textbox, dropdown list, checkbox, etc should be properly aligned.
  17. Spacing – There should be proper spacing between the fields and labels.
  18. Font style– The font style and size should be uniform and should be as per requirement.
  19. 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.
  20. Broken images and links– Proper checking should be done to find out the broken links and images in the application.
  21. Cross-browser and multi-device validation– The UI of the application should look same for different browser and mobile devices.
  22. Security Testing- Trying to access internal functionality of the application functionality in the logged out state by changing the URL.
  23. Error Highlight– Proper checking should be done to verify the field with error is getting highlighted in red.
  24. Upload Functionality- Check image and file upload functionality is working properly. Also check by uploading image and files of different formats like- JPEG, JPG, doc, pdf, exe, etc.
  25. 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.

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 question 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 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, that is xxxx@xx.xx.
  • 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 scenario. The user should not be able to login with the below combinations.
  1. The valid username and an invalid password.
  2. Invalid username and valid password.
  3. Invalid Username and password.
  • Check with 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 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 scenario 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, that is xxxx@xx.xx.
  • 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 6, maximum 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.

Conclusion

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.

About the author

Nandini KS editor

Leave a Reply

Your email address will not be published.

Broaden Your Knowledge. Enroll Today.

Our tutoring services on software testing courses online offer information on a wide variety of courses, ranging from Web Security and Software Testing courses to selenium online training to Mobile Automation Testing. Whatever criterion you need help with concerning advanced technological functions and operations, we’ve got you covered. We also use real world examples and scenarios for solving examples and projects, enhancing your knowledge and broadening your horizon.