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
How we make tests
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
李甘
January 09, 2013
Programming
85
0
Share
How we make tests
a slide for sharing about test
李甘
January 09, 2013
More Decks by 李甘
See All by 李甘
Learn git
flypiggy
1
310
Other Decks in Programming
See All in Programming
L’IA au service des devs : Anatomie d'un assistant de Code Review
toham
0
190
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
340
ファインチューニングせずメインコンペを解く方法
pokutuna
0
250
Geminiをパートナーに神社DXシステムを個人開発した話(いなめぐDX 開発振り返り)
fujiba
0
130
安いハードウェアでVulkan
fadis
1
870
PHPで TLSのプロトコルを実装してみるをもう一度しゃべりたい
higaki_program
0
150
Tamach-sre-3_ANDPAD-shimaison93
mane12yurks38
0
240
2026-03-27 #terminalnight 変数展開とコマンド展開でターミナル作業をスマートにする方法
masasuzu
0
280
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
930
Strategy for Finding a Problem for OSS: With Real Examples
kibitan
0
130
The free-lunch guide to idea circularity
hollycummins
0
400
Migration to Signals, Signal Forms, Resource API, and NgRx Signal Store @Angular Days 03/2026 Munich
manfredsteyer
PRO
0
220
Featured
See All Featured
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
260
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
170
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
95
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
43k
Automating Front-end Workflow
addyosmani
1370
200k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
430
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
290
How to Think Like a Performance Engineer
csswizardry
28
2.5k
How to train your dragon (web standard)
notwaldorf
97
6.6k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
160
Transcript
How we make tests • Test 101 • Make better
tests • Write test friendly code • When & Where we need tests • Sth. else
Test 101 • 如何来测试我们的程序?
Test 101 • 使用代码测试比人更可靠 • Unit tests, Functional tests, Intergration
tests • 如何开始我的测试 ?
Test 101 • 测试的基础 : 验证输入和输出是否符合期望值 • Log, 单步调试 ,
'=', Equal, Assert … and so on • Demo1.
Make better tests • 建立独立最小测试环境 – 测试与代码分离 – Setup &
Teardown – 独立的测试数据
Make better tests • 再多一点 – 独立的测试环境 environment[:test] – 专有的测试方法
testhelper – 有效的组织测试 rake, shell – 使用测试夹具 测试数据无需入库
Make better tests • 依赖外部调用无法测试怎么办 ? – 网络不通 , 调用资金等
– 其他模块出错 , 没开发完 – 我就只想测试自己的部分 等等 • Mock & Stub 帮助你
Write test friendly code • 1 单一职责 • 2 接口分离
• 3 避免耦合太深
Write test friendly code 圆桌讨论 : 怎样写出更容易测试的代码
When & Where we need tests • 等我不忙了就加测试 – 永远有下一个项目
– 越后面成本 ( 包括时间 ) 越高 , 测试质量也越差 • 以前代码太难写测试了 , 等重构了再说 – 测试是重构的基础 – 新的代码还等以后才写测试 ?
When & Where we need tests • 涉及到付费的 谁敢拿钱开玩笑 •
核心业务逻辑 一旦变化会影响多处地方 • 第三方集成 回归 , 你没法控制别人的变化 • 系统中容易变化的地方 测试让每次变化更安全 • 多个 object 协作的地方 每一个的变化都可能出错 • 代码晦涩,难以理解 增加测试是重构的第一步 • 很多判断的地方 逻辑复杂的代表
Sth. else • Watchr & Guard(base on ruby) 让测试守护你的程序 •
CI 持续集成 • TDD&BDD 测试 ( 行为 ) 驱动开发