Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
テストデータについて
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
8yabusa
March 19, 2018
Programming
100
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
テストデータについて
AndroidTestNight#3の発表資料です
8yabusa
March 19, 2018
More Decks by 8yabusa
See All by 8yabusa
BLEアプリ設計パターン / ble_app_pattern
tomohikosato
10
3.3k
Bluetoothわかんねぇよなぁ!ハム太郎! / Bluetooth_hamutaro
tomohikosato
4
1.3k
効率よく勉強する(Androidアプリ開発編)
tomohikosato
1
320
いかにして問題を解くか
tomohikosato
0
250
Other Decks in Programming
See All in Programming
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
1
150
The Good Stuff, Not the Slop: Engineering High-Quality Android Apps with Modern AI Tooling
danybony
1
250
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
1
450
モバイル交通系ICへのチャージ実例から考える、クロスプラットフォーム開発におけるiOS実機テスト設計とCI運用
yusuga
1
450
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
300
AI に Inclusive UI を書かせよう — Design Rules Skill で Compose UI を作り直す
theoriatec2024
1
490
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
100
VueプロジェクトをTypeScript7に対応させる- Side-by-Side戦略による一部高速化 -
koukimiura
0
100
AIエージェント時代のコードレビューを設計する
nogu66
6
2.7k
型解析で実現する Go の言語内 DSL / Conference に Go! タイムテーブルの歩き方 for Gophers
mazrean
0
150
FreeBSDでZabbixを動かす.pdf
kenkino
0
140
From 6 People Classroom Meetup to 100 People Regional Conference / FOSS4G Hiroshima 2026
furukawayasuto
0
180
Featured
See All Featured
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
540
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
590
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
How to Ace a Technical Interview
jacobian
281
24k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Done Done
chrislema
186
16k
エンジニアに許された特別な時間の終わり
watany
108
250k
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
63
46k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
430
Art, The Web, and Tiny UX
lynnandtonic
304
22k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
280
Transcript
テストデータについて Tomohiko Sato
⾃⼰紹介 • Tomohiko Sato @8yabusa • Qrio.inc (2017年10⽉~) • テストは主に本で読んだ知識で実践
テストデータについて 具体例で考えよう
視聴回数、どんな⾵に表⽰されるか? • 万、億単位がある (例: 32回、 256 万回、3億回) • 3桁⽬にカンマがある (例:
1,353 回、3,245万回) 例: Youtube
ViewCount(58).show() // 58回 ViewCount(43453).show() // 4万回 実装したとする
ViewCount(58).show() // 58回 ViewCount(43453).show() // 4万回 テストどうしよう?
• テストは特定のケースで成功/失敗することしか⽰せない • Intが取りうる値の範囲 = 2^32通りのテストするのか? • じゃあどのケースでテストする? 完璧なテストなど存在しない
Q. そもそも何のためにテスト しているのか A1. テスト対象が仕様通りに動いて欲しいから A2. テスト対象がバグって欲しくないから
A1.テスト対象が仕様通りに 動いて欲しい • 仕様をグループ分け(同値分割)、グループに属する適当 な値を選びテスト • 億回、万回、回とグループ分けし、適当な値でテ スト • カンマあり、カンマとグループ分けし、適当な値
でテスト
A2. テスト対象がバグって欲しくな い • バグを引き起こしそうなテストデータを⽤意する • グループの変わり⽬ ( = 境界値)
• 9999, 10000 -> 9,999回、1万回 (桁の変わり⽬) • 300, 3,000 -> 300回、 3,000回 (カンマが付く、付 かないの変わり⽬) • 特殊な値 • 0, INT_MAXとか
こんな感じ(?) * いろんな桁でテスト * 単位の変わり⽬目、カンマがつく、付かないに特に着⽬目 * 0とか9999, 10000でテスト * -1とか異異常な値は、インスタンス⽣生成時に弾かれる。テストしたければ別途テスト
どこが失敗したかわかり⾟い
パラメタライズドテスト JUnitParams
まとめ • 完全なテストは存在しない、それっぽい値でテストする必要がある • 仕様を満たしていると⾔えそうな値を⽤意 • 仕様をグループ分けして適当な値でテスト • プログラマがミスりそうな値を⽤意 •
例えばメソッドの出⼒が変わる境界の値 • いろんな値をテストする場合はパラメタライズドテストが便利 • JUnit4標準のは微妙なので、JUnitParamsか、JUnit5を使おう
• 完全なテストは存在しない、それっぽい値でテストする必要がある • 仕様を満たしていると⾔えそうな値を⽤意 • 仕様をグループ分けして適当な値でテスト • プログラマがミスりそうな値を⽤意 • 例えばメソッドの出⼒が変わる境界の値
• いろんな値をテストする場合はパラメタライズドテストが便利 • JUnit4標準のは微妙なので、JUnitParamsか、JUnit5を使おう ありがとうございました !
参考リンク • テスト7原則について http://www.itmedia.co.jp/im/ articles/1111/07/news192.html • テストは⽋陥があることしか⽰せない • 全数テストは不可能 •
JUnitParams https://github.com/Pragmatists/JUnitParams • JUnit5 ParameterizedTest https://junit.org/junit5/docs/ current/user-guide/#writing-tests-parameterized-tests