Choose appropriate test data for a test plan

12.3 Program Testing and Maintenance

Objective: Choose appropriate test data for a test plan

🧪 What is Test Data? Test data are the inputs you give to a program to see if it behaves correctly. Think of it as the ingredients you use when baking a cake – the right mix will give you a tasty result, the wrong mix might spoil the whole batch.

🔍 Why is Test Data Important? Good test data helps you catch bugs early, ensures your program works for all users, and saves time in the long run. It’s like checking your homework before handing it in – you’ll spot mistakes and fix them before the teacher does.

Types of Test Data

  • 🟢 Positive Data – valid inputs that should produce the expected result.
  • 🔴 Negative Data – invalid inputs that should be handled gracefully.
  • Boundary Data – values at the edges of acceptable ranges.
  • 🟠 Equivalence Class Data – representative values from groups that should behave the same.
  • 🟣 Random Data – unpredictable values to test robustness.

Choosing Test Data

  1. 📌 Understand the Specification – know the required input ranges and constraints.
  2. 📊 Identify Edge Cases – test the smallest, largest, and just‑outside values.
  3. 🔄 Use Equivalence Partitioning – pick one value from each valid and invalid group.
  4. 🧩 Combine Data for Complex Functions – create scenarios that mix different types.
  5. 🛠️ Automate Where Possible – use scripts to generate large sets of random data.

Example Test Plan

Test Case Input Expected Output Result
TC01 – Positive Age = 25 “Eligible” Pass
TC02 – Boundary (Min) Age = 0 “Invalid” Fail
TC03 – Negative Age = -5 “Error” Pass

Exam Tip: When asked to design a test plan, start by listing the specification, then choose at least one positive, one negative, and one boundary test case. Remember to explain why each case is important.

Quick Check: If your program accepts a string of length $n$, what is the boundary value? Think about $n = 0$, $n = 1$, and $n = \text{max length}$. Test each!

Revision

Log in to practice.

3 views 0 suggestions