how to create test data

14
How to CreateTest Data Hideshi Ogoshi YNS Philippines Inc. Aug-11-2016

Upload: hideshi-ogoshi

Post on 12-Apr-2017

535 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: How to create test data

How to CreateTest Data

Hideshi Ogoshi YNS Philippines Inc.

Aug-11-2016

Page 2: How to create test data

Why do we test?

• Check if a software satisfies its requirements.

Page 3: How to create test data

How to satisfy requirements

• Prepare sufficient test cases

• Prepare sufficient data

• Test properly

Page 4: How to create test data

What is the ideal test data?

• The data, which satisfies all the patterns

• Called exhaustive testing (ISTQB)

Page 5: How to create test data

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.

Page 6: How to create test data

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.

Page 7: How to create test data

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

Page 8: How to create test data

Table definitionsarticle author favorite

id id id

name name article_id

author_id deleted user_id

open

open_day

deleted

Page 9: How to create test data

SQLSELECT 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

Page 10: How to create test data

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

Page 11: How to create test data

Demo

Page 12: How to create test data

Benefits• Pursue higher quality

• Help you to do test driven development

Page 13: How to create test data

Table design tips• For the higher testability

• Do not use foreign key

• Do not use NOT NULL constraint

Page 14: How to create test data

Thank you