Writing Test Cases

This week I am focusing on writing test cases and I have been doing research on how to write them effectively. According to the ISTQB glossary, the definition of a test case is, “A set of preconditions, inputs, actions (where applicable), expected results and postconditions, developed based on test conditions. “

Different companies have different test case templates which work for them according to their likes and needs. Here are some of the fields that are included when writing a test case:

  • Test Case ID – a unique ID is needed for each test case, eg: “TC_1”
  • Test Name – test case title, eg: “Verify login page with valid username and password”
  • Test Description – this is describing the test objective
  • Pre- Conditions – prerequisites that need to be completed before test execution
  • Test Steps – this is a list of all execution steps. It should be detailed and in order from beginning to end
  • Test Data – data that can be used in your test case such as username and password for login, etc.
  • Expected Results – this is how we expect the function to work after testing it
  • Actual Results – this describes the system behaviour after test execution
  • Status – to say if the test passed or failed
  • Some others could include Test Priority, Test Designed By, Test Design Date, Test Executed By, Test Execution Date, etc.

 

There are many ways to make sure you are writing effective and good test cases:

  • You should make sure that your test cases are simple and clear. Anyone should be able to read them and know what to do. 
  • Try to get as much coverage by making sure you write test cases to check all requirements. Test all function/conditions.
  • Use different techniques to help find bugs. You can use techniques such as Boundary Value Analysis, Equivalence Partitioning, Error Guessing, etc.
  • Ask a colleague or someone to review your test cases.