6 years Blog

5 Important things to remember when writing test cases

When writing test cases for your project, it’s often easy to forget what is important. This article is aimed at reminding experienced testers or informing new ones of what the key items are, to ensure we are being efficient in writing our tests.

The End User is key

Who will be executing the test scripts? Will the scripts form part of a Regression Pack? Will the scripts be used for anything else (e.g. training manuals)?

These questions are meant to kick start your thought process. Essentially, the person who writes the test is not always the person who executes it. As such, Test Cases need to be written so that anyone of any level can read, understand and be able to execute the test case. The aim of this is that no matter the level of the tester, the outcome will always be the same. When writing your test, if you approach this with ‘baby-steps’ in mind and make no assumptions that the person who executes it is has any prior knowledge of the project, and you shouldn’t go far wrong. 

Unique, Measurable, Specific (UMS)

Every single test case should be Unique, Measurable and Specific. If you aren’t quite clear what this means, I’ve defined this below for you.

  • Unique – There should only be one test with a particular objective in the scenario you are writing it for.
  • Measurable – You should be able to say at the end of the test whether it has passed or not. The objective should be very clear and each Input and Expected Output should marry up concisely.
  • Specific – Each test case must be written to test a particular function or action. A good test case is usually brief and to the point.

Where possible, keep test cases reasonably short. A long number of test steps can add complexity to the scenario, it can make the tester feel like they’ve been executing the same test forever and it can affect the accuracy of progress and defect reporting. Break your test scripts down into smaller scenarios if possible and although this will mean more test cases, they will be quicker to execute and will produce more accurate statistics of test results.

Data

The inclusion of data in your test steps can be very useful. It saves time and energy sourcing the test data. It makes test execution more efficient.

Before you do this though, you need to understand a few things. Can the data go out of date? Is a database refresh likely to occur? If the data is likely to change however it may be easier to create a database or reference sheet to store your test data in one place. This means that if you need to change the data, you can do it in one place rather than have to trawl through your test cases to make the change individually. 

Test Case Layout

Test Management tools often cater for the information which should go into a test case by providing fields for testers to enter the details which need.

Those who have completed their ISTQB Foundation course will know that IEEE829 states that the following should be included in a Test Case:

  • Test Case Specification Identifier
  • Test Items
    • Describe features and conditions tested
  • Input Specifications
    • Data Names
    • Ordering
    • Values (with tolerances or generations procedures)
    • States
    • Timing
  • Output Specifications
    • Data Names
    • Ordering
    • Values
    • States (with tolerances or generations procedures)
    • Timing
  • Environmental Needs
    • Hardware
    • Software
    • Other
  • Special Procedural Requirements
  • Inter-case Dependencies

Consider the approach

You may also need to consider using different approaches, dependant on the delivery methodology being used and to ensure your test scripts are maintainable. Using a Behaviour Driven Development (BDD) approach for your test scripting makes it easier to automate your test scripts at a later date, enabling the automation team to pick up your manual BDD scripts and convert them in to code. BDD scripts are also usually written from an end users perspective, which helps if the scripts are to be reused for UAT – saving valuable time and effort. 
Share

Leave a Reply

Your email address will not be published.