Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

How to create test data

794 views

Published on

Presentation for study meeting in YNS Philippines Inc.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

How to create test data

  1. 1. How to CreateTest Data Hideshi Ogoshi YNS Philippines Inc. Aug-11-2016
  2. 2. Why do we test? • Check if a software satisfies its requirements.
  3. 3. How to satisfy requirements • Prepare sufficient test cases • Prepare sufficient data • Test properly
  4. 4. What is the ideal test data? • The data, which satisfies all the patterns • Called exhaustive testing (ISTQB)
  5. 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. 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. 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
  8. 8. Table definitions article author favorite id id id name name article_id author_id deleted user_id open open_day deleted
  9. 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. 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
  11. 11. Demo
  12. 12. Benefits • Pursue higher quality • Help you to do test driven development
  13. 13. Table design tips • For the higher testability • Do not use foreign key • Do not use NOT NULL constraint
  14. 14. Thank you

×