How to write good test cases?

In this tutorial, we will learn about writing effective test cases for software. For details on the test case and test case template in downloadable Xls format, check our tutorials – What is a test case? and Test Case Template (Xls).

As we know that a test case is a set of conditions for evaluating a software product to determine its compliance with the business requirements. Having an ill-formed test case can lead to severe defect leakage, which can cost both time and money. So, writing effective test cases is the utmost requirement for the success of any software product.

Now, let’s see how we can write effective test cases.

  1. Test design technique – Follow a test design technique best suited for your organization or project-specific needs like – boundary value analysis, equivalence class partitioning, etc. This ensures that well-researched standards and practices are implemented during test case creation.

  2. Clear and concise tests – The test case summary, description, test steps, expected results, etc should be written in a clear and concise way, easily understandable by the different stakeholders in testing.

  3. Uniform nomenclature – In order to maintain consistency across the different test cases a uniform nomenclature and set of standards should be followed while writing the test cases.

  4. Fundamental/Atomic Test cases – Create test cases as fundamental as possible, testing a single unit of functionality without merging or overlapping multiple testable parts.

  5. Leave no scope of ambiguity – Write test case with a clear set of instruction e.g. instead of writing “Open homepage”, write – “Open homepage – http://www.{homepageURL}.com in the browser and press enter”.

  6. No Assumptions – While writing test cases do not assume any functionality, pre-requisite or state of the application. Instead, bound the whole test case creation activity to the required documents – SRS, Use-case documents, etc.

  7. Avoid redundancy – Don’t repeat the test cases, this leads to wastage of both time and resources. This can be achieved by well planned and categorized test cases.

  8. Traceable tests – Use a traceability matrix to ensure that 100% of the application’s feature in the scope of testing is covered in the test cases.

  9. Ensure that different aspects of the software are covered – Ensure that apart from the functionality, the different aspects of the software are tested like performance, usability, robustness, etc are covered in the test case by creating performance test cases and benchmarks, usability test cases, negative test cases, etc.

  10. Test data – The test data used in testing should be as diverse and as close to real-time usage as possible. Having diverse test data can more reliable test cases.

Leave a Comment