Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
1 test 1 assert ?
Search
PoohSunny
September 30, 2017
Technology
0
310
1 test 1 assert ?
TDDBC Tokyo 2017-09 でのLTスライドです。
https://tddbc.connpass.com/event/65484/
PoohSunny
September 30, 2017
Tweet
Share
More Decks by PoohSunny
See All by PoohSunny
ドレイファスモデルの紹介 / introduce Dreyfus model
poohsunny
1
770
Make Work Visible in Agile2018 #LINE_DM
poohsunny
1
350
タウンワークをドライブさせるためになんちゃってアジャイルをやめた話 #devsumi #devsumiB / devsumi2018
poohsunny
30
44k
XUTPから学ぶ記述性の高いユニットテスト 〜俺たちを助けるユニットテストへ〜 / xUTP in #xpjug
poohsunny
4
4.9k
XCUITestする時のTIPs 〜あなたを助けるXCUITestへ〜
poohsunny
0
2.9k
コードに思いが伝わる
poohsunny
0
210
横浜タネマキでGebと握手! #yokohamagroovy
poohsunny
0
370
The "yummy" licenses.
poohsunny
0
140
ブラウザテストをサクサク自動化するためのGeb実践入門 #jjug_ccc
poohsunny
21
6.8k
Other Decks in Technology
See All in Technology
Azure犬駆動開発の記録/GlobalAzureFukuoka2024_20240420
nina01
1
230
2024春 注目のWeb系 OSS & SaaS 3選
makies
0
170
[新卒向け研修資料] テスト文字列に「うんこ」と入れるな(2024年版)
infiniteloop_inc
4
17k
Grafana x PagerDuty Better Together
jacopen
1
240
LLM開発・活用の舞台裏@2024.04.25
yushin_n
3
1.1k
生産性向上チームの紹介
cybozuinsideout
PRO
1
900
AOAI をきっかけに 社内の Azure 管理を見直した話
recruitengineers
PRO
1
430
今年のRubyKaigiはProfiler Year🤘
osyoyu
0
310
Microsoft Intune 勉強会 第 2 回目
tamaiyutaro
2
370
【SORACOM UG 東海】あらゆるモノがつながる社会へ、IoT と SORACOM
soracom
PRO
1
130
Handling focus in 2024
tahia910
0
200
MapLibreとAmazon Location Service
dayjournal
1
170
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
43
12k
Practical Orchestrator
shlominoach
183
9.7k
Making Projects Easy
brettharned
109
5.5k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
Become a Pro
speakerdeck
PRO
12
4.6k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
123
39k
Testing 201, or: Great Expectations
jmmastey
29
6.4k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
13
8.3k
We Have a Design System, Now What?
morganepeng
44
6.8k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
21
1.4k
VelocityConf: Rendering Performance Case Studies
addyosmani
321
23k
Unsuck your backbone
ammeep
663
57k
Transcript
1 test 1 assert ? 1
ߴڮ ཅଠ(@PoohSunny) { role: "Engineer team leader", lang: ["Java", "Groovy",
"Swift"] } 2
3
ϖΞϓϩσϞ 4
1 test 1 assertion 5
xUTPͱͷग़ձ͍ 6
ޙ3 3 photo: https://www.flickr.com/photos/daverusso88/20860542330/in/photolist- xMnJsW-8H8jnW-8BDdLz-fS9XhN-e3qtWG-oaibHC-eRMCCx-q9Ftni-n7Lmvm-supyFV-gXyxGZ- fEKqSK-sqqxce-sfR8k1-q7N9Ta-dDw4Zq-9ML2MP-oa6sWm-J5F4zN-4vX6LP-nW3r1Q- rF4QJJ-8BWJj9-A1MjG7-sqqpKR-HgcdWN-7Dy6QC-s7M3Dn-w2RjN3-TZXibu-mMD2tR-o9TZi6- shS8mE-hWRzr-WJPkXw-xe6Rnv-DWz4Ra-yGju6j-fkfg3o-ghz6JD-wR4HYP-7xhvzK-rN2UEW- krfJu3-Duju1z-FSwQ8h-8yNSK2-4vXc2a-DaLuo5-zZyYuS 7
xUTPͱͷग़ձ͍(ཧ)4 4 ಈը: https://engineers.sg/video/unit-test-craftsmanship-agile-singapore- conference-2016--1168 εϥΠυ: http://singapore2016.xunitpatterns.com/ 8
γϯάϧΞαʔγϣϯ9 • ࿑ಇ࣌ؒܭࢉͷςετ // then assertEquals(720, result.getWorkTime()); • ٳܜ࣌ؒܭࢉͷςετ //
then List<Integer> breakTimeList = result.getBreakTimeList(); assertEquals(2, breakTimeList.size()); assertEquals(60, breakTimeList[0]); assertEquals(45, breakTimeList[1]); 9 http://xunitpatterns.com/Principles%20of%20Test%20Automation.html#Single Condition Test 9
1 test 1 assertϗ ϯτʁ 10
·ͱΊ͓͍ͯͨํ͕ Θ͔Γͦ͢͏ // then List<Integer> breakTimeList = result.getBreakTimeList(); assertEquals(2, breakTimeList.size());
assertEquals(60, breakTimeList[0]); assertEquals(45, breakTimeList[1]); 11
ಡΈ͍͢ܗʹ ϦϑΝΫλϦϯά • ྫ͑JUnit5 + AssertJΛར༻ // then List<Integer> breakTimeList
= result.getBreakTimeList(); assertThat(breakTimeList).hasSize(2).containsExactly(60, 45); 12
ΧελϜΞαʔγϣϯ10 • ϔϧύʔΛ࡞͠ɺΞαʔγϣϯͷ࣮ॲཧͦ ͪΒʹҠಈ 10 http://xunitpatterns.com/Custom%20Assertion.html 13
ϝιουຊޠԽख // then List<Integer> breakTimeList = result.getBreakTimeList(); ٳܜ2ճܭࢉ͞Εͯ(breakTimeList, _1ͭͷܭࢉ࣌ؒ(60), _2ͭͷܭࢉ࣌ؒ(45));
14
ϝϯςφϯεੑ͕٘ਜ਼ʹͳ Δʁ • ςετͷڞ௨ԽͬͯͲΕ΄Ͳॏཁʁ • ͜ΕʹΑͬͯͲͷ͘Β͍ಡΈ͕͢͞૿͢ʁ 15
ಡΈ͘͢ͳΒͳ͍Α͏ͳΒ ͠ಡΈ͘͢ͳΒͳ͍ͳΒɺγϯάϧΞαʔγ ϣϯਥʹͳΔͭΓͳ͍Α — Principle: Verify One Condition per Test
11 11 http://xunitpatterns.com/Principles%20of%20Test%20Automation.html#Single Condition Test ΑΓҙ༁ 16
Single Assertion ૉΒ͍͠ 17
Ͱόϥϯε͋Δ Αʂ 18
͓͠·͍ 19