This document provides guidance on how to create test data for software testing. It discusses why test data is needed to check if software satisfies requirements, and that the ideal test data would cover all patterns from requirements. However, in practice not all patterns can be covered due to time constraints. The document recommends using add/edit/delete features if available to generate test data, or creating it manually otherwise. It also provides an example set of requirements, table structures, and SQL query to demonstrate how to derive the number of patterns from requirements and systematically generate test data covering those patterns.
1. How to CreateTest Data
Hideshi Ogoshi
YNS Philippines Inc.
Aug-11-2016
2. Why do we test?
• Check if a software satisfies its requirements.
3. How to satisfy requirements
• Prepare sufficient test cases
• Prepare sufficient data
• Test properly
4. What is the ideal test data?
• The data, which satisfies all the patterns
• Called exhaustive testing (ISTQB)
5. What is better test data
• If we can provide the data for all the patterns, it
would assure higher quality.
• In a realistic view, there would be time limitation.
• We should eliminate some data in order to finish
the testing to meet the deadline without
decreasing the quality.
6. How to create data
• If add / edit / delete features are already
provided, it’s much better to use it.
• If not, it has to be created manually.
7. Example
• Requirements
• An article must belongs to an author
• An article can be favored by users
• Should display article.title, author.name, number of favorites,
article.open_day with descending order on article.open_day
• If the article is open and not deleted and not future
• If the author is not deleted
• If the favorite exists or and not deleted
9. SQL
SELECT
article.title
, article.open_day
, author.name
, COUNT(favorite.id) AS number_of_favorites
FROM article
INNER JOIN author
ON author.id = article.author_id
LEFT OUTER JOIN favorite
ON favorite.article_id = article.id
WHERE article.open = 1
AND article.deleted = 0
AND article.open_day <= CURDATE()
AND author.deleted = 0
GROUP BY article.title, article.open_day, author.name
ORDER BY article.open_day DESC
10. Number of patterns
• article is open / not open => 2
• article is deleted / not deleted => 2
• article open_date is past / today / future => 3
• author is deleted / not deleted => 2
• number of favorite is 0 / 1 / 2 => 3
• number of patterns is 2 x 2 x 3 x 2 x 3 = 72