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
JavaScript UnitTest PIXNET
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
CypressKuo
July 21, 2016
Technology
230
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JavaScript UnitTest PIXNET
JavaScript UnitTest
CypressKuo
July 21, 2016
More Decks by CypressKuo
See All by CypressKuo
Deep-copying.pdf
cypresskuo
0
41
CSS_for_Web_Vitals.pdf
cypresskuo
0
46
談談_Code_review.pdf
cypresskuo
0
52
REST_vs_GraphQL_今夜はご注文はどっち.pdf
cypresskuo
0
27
CSS_重構.pdf
cypresskuo
0
30
跟上_JS_的腳步-ES2020.pdf
cypresskuo
0
35
Core_Web_Vitals.pdf
cypresskuo
0
61
這個時代人人都知道的敏捷開發.pdf
cypresskuo
0
65
Webassembly.pdf
cypresskuo
0
17
Other Decks in Technology
See All in Technology
DatabricksにおけるMCPソリューション
taka_aki
1
280
Data + AI Summit 2026 イベントレポート: 「AIがビジネスで意思決定するデータ基盤」へ
nek0128
0
280
プロダクト開発組織の現在地(Ver.2026/07) / product-organization
kaonavi
0
110
AIレビューはどこまで任せられるのか?自動化と人が背負うレビューの境界
sansantech
PRO
3
1.1k
“それは自分の仕事じゃない"を越えて行け
yuukiyo
1
480
壊して学ぶAWS CDK: そのcdk deployで消えるもの、残るもの
k_adachi_01
1
410
大量データに対しても、生成AIを用いてリーズナブルにデータ加工をしたい!Databricksのai_queryについて調べてみた
kamoshika
1
220
Claude Code公式skillで 自分の仕事を少しずつ手放そう!(Claude Code開発ノウハウ大公開スペシャル by クラスメソッド)
kaym
1
500
ruby.wasmとPicoRuby.wasmに対応した仮想DOMライブラリを作ってる話 #kaigieffect_kaigi
sue445
PRO
0
150
タスクの複雑さでモデルを選ぶ ── Thompson Samplingで動かす“トークン/コスト最適化
satohy0323
0
570
Playwright × AI Agent でE2Eテストはどう変わるか AI駆動テストの可能性と実用検証の結果
taiga7543
1
350
CSに"SLO"は要らない、経営層に"99.9%"は伝わらない - SREを全社に"翻訳"する3原則
cscengineer
PRO
1
5.1k
Featured
See All Featured
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
11k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
67k
HDC tutorial
michielstock
2
750
Rebuilding a faster, lazier Slack
samanthasiow
85
9.6k
sira's awesome portfolio website redesign presentation
elsirapls
0
300
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.5k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.9k
The Pragmatic Product Professional
lauravandoore
37
7.4k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
180
A Modern Web Designer's Workflow
chriscoyier
698
190k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
1k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Transcript
JavaScript Test -Unit Test 2+:0'6┮䷐倥揎櫧㪰%[RTGUU-WQ
Agenda Test 3W Unit Test (1 W 1 H) TDD
& BDD Test Runner & Testing Framework 2
Why 傶ԧ嘦狒䛑አ纷ୗݢ犥Ӟፗই๗螀֢ᘒ砰䌃介手 㯏梊盠蝧 仂斕犋嘦ਧ ीےᛔמ ׀᯿䯤䁎ࢴጱᵑ 3
When 樄ত樄咳獮 ਞ蕕㪔㬙ᗟ介手ૡٍ 樄咳蝱ᤈ吚Ӿ ୌ缏䛑አ纷ୗጱྯ㮆蟂犩牧᮷ᥝ砰䌃㪔䁆ᤈ介手 樄咳奾盅 ತک%XJ牧疰䌃Ӟ㮆碝ጱ介手犥嘦狒梊藮磪ᤩ狕盋 介手㪔犋ฎ㻌稞ጱ犨率牧ਙ疰猟纷ୗ蛪牧襑ᥝ瞱媲ጱ狕ྋ㪔硬臑 4
Who 㻌ز介手ҁ8QLW7HVW҂>樄咳ᘏ@ ֵአᘏᒒ介手ҁ(QGWR(QG7HVW҂>樄咳ᘏ@ 碉ݳ介手ҁ,QWHJUDWLRQ7HVW҂>樄咳ᘏ4$Ո㹓@ 涢硩介手ҁ$FFHSWDQFH7HVW҂>4$Ո㹓@ 5
Unit Test 纷ୗӾ磧ੜጱ螵蜉㻌ز 獢ୗ IXQFWLRQ 牧ฎොဩ PHWKRG 加缏ҁቘమ҂ 6
Test Driven Development ض䌃介手牧ٚ䌃纷ୗ 夺籗牏翑籗牏᯿䯤 螨عRYHUGHVLJQҁ夺籗䌃纷ୗ҂ 7RS'RZQ姘 7
Behavior Driven Development चෝ7''禊盢ጱ蝱玕粚 虏ֵአᘏ牏介手Ո㹓膏樄咳Ո㹓牧ݢ 犥አӞ䰬ጱොୗ㬵矟蝄膏ԧ薹襑穩 褔犵疥Ո扖旉矦౮纷ୗ嘨ጱ౮ 8
襑穩矟蝄物 8VHUVWRU\物>秂氂矟蝄硲Ԫጱ㻌ᤈਁ@ 蛪傶Ӟ㮆>薫ᜋ@牧౯మᥝ>粬ਧۑ胼@牧 犥>کঅ蒂@ 羬翄ᤈ傶物 *LYHQ>Ӥӥ@ :KHQ>Ԫկ@ 7KHQ>奾ຎ@DQG>ٌਙ奾ຎ@ 9
User story:[帳⼾持有⼈要領錢] ⾝為⼀個 [帳⼾持有⼈],我想要 [從 atm 領 錢],以便 [可以在銀⾏關⾨後領到錢] Given
[帳⼾餘額 100] and [有效的領款卡] and [提款機夠錢] When [帳⼾持有⼈要求提 20 元] Then [提款機應該給 20] and [帳⼾餘額 80] and [退提款卡] 10
Test Runner & Testing Framework 7HVW5XQQHU物 .DUPD 7HVWLQJ)UDPHZRUN物 8QLW7HVWMDVPLQH (QGWR(QG7HVWSURWUDFWRU
11
Demo 12 https:/ /github.com/CypressKuo/js-unit-test
租⽚系統 普通⽚ 租⾦ 100 元 / 7天、逾期 10 元 /
天 新⽚ 租⾦ 150 元 / 3天、逾期 30 元 / 天 兒童⽚ 租⾦ 40 元 / 5天、逾期 5 元 / 天 13
First Test 我租了⼀⽚普通⽚ 15 天,還⽚時需付 多少錢? 14
First Test 紅燈 綠燈 下⼀個測試 15
Second Test 我租了⼀⽚新⽚ 9 天,還⽚時需付多 少錢? 16
紅燈 回到上⼀個綠燈 (first test) 重構 綠燈 (first test) 綠燈 (second
test) 下⼀個測試 17 Second Test
More Test 我租了⼀⽚兒童⽚ 8 天和⼀⽚普通⽚ 1 天,還⽚時需付多少錢? 18
紅燈 回到上⼀個綠燈 (second test) 重構 綠燈 (second test) 綠燈 (third
test) 19 More Test
重構 紅燈 綠燈 重構 (..Loop) 20 More Test
New Requirement 新的租⽚⽅式 國⽚ 租⾦ 60 元 / 6天、逾期
10 元 / 天 租 15 天 21
Reference https:/ /karma-runner.github.io/0.13/config/configuration- file.html http:/ /www.slideshare.net/wantingj/tdd-bdd-47559903 http:/ /fbukevin.github.io/Veck/2015/01/07 /javascript-test- suit-4-test-runner-karma/
http:/ /www.codedata.com.tw/java/unit-test-the-way- changes-my-programming http:/ /www.slideshare.net/yvonne_yu/ss-51379324 http:/ /oomusou.io/phpstorm/phpstorm-tdd-refactor/ 22
Thank You!