Test Cases: How to Write Correctly

In software development, writing test cases and testing of newly added/modified piece of code is a major task. Without testing causes a bug may pass into production code, and that in turn leads to financial losses, and it impacts client’s business (lose its end customers).

Testing is done in many phases in Software Application Development

  • Unit level testing
  • System level testing
  • QA level testing
  • Certification/User acceptance testing

From Software Testing help – What is a test case?

“A test case has components that describes an input, action or event and an expected response, to determine if a feature of an application is working correctly.”

More : How to write Test cases in mind blowing way (if you need for more information)

The standard template for writing Test case is as follows:

Test Case: [ This is an idea of what you are going to test] -> Mandatory

Example – it is a brief statement of something that should be tested. For example, if you’re testing a square root function, one idea for a test would be ‘test a number less than zero’. The idea is to check if the code handles an error case.

Test Description: [How you are going to test it ] -> Mandatory

Example: A registered user should be able to successfully login at ymail.com.

Pre-Condition/Pre-requisite: [  What are the set up or condition to be exists before start your testing ] -> Optional and depends

Example: the user must already be registered with an email address and password.

Test Steps/ Procedure for testing: [ Here you need to mention procedure for testing. Also you can mention tools needed for testing ]-> Optional

Example:

  • Navigate to Ymail.com
  • In the ’email’ field, enter the email of the registered user.
  • Click the ‘Next’ button.
  • Enter the password of the registered user
  • Click ‘Sign In’

Expected Results : [ Here you need to mention the expected results or outcome or response from your testing ] -> Mandatory

Example: A page displaying the ymail user’s inbox should load, showing any new message at the top of the page.

Final point is the above are the standard steps across all software development projects.

Related posts

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.