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
李甘
January 09, 2013
Programming
0
85
How we make tests
a slide for sharing about test
李甘
January 09, 2013
Tweet
Share
More Decks by 李甘
See All by 李甘
Learn git
flypiggy
1
310
Other Decks in Programming
See All in Programming
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.7k
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
430
ELYZA_Findy AI Engineering Summit登壇資料_AIコーディング時代に「ちゃんと」やること_toB LLMプロダクト開発舞台裏_20251216
elyza
2
1.3k
AI 駆動開発ライフサイクル(AI-DLC):ソフトウェアエンジニアリングの再構築 / AI-DLC Introduction
kanamasa
11
6.1k
CSC307 Lecture 05
javiergs
PRO
0
490
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.7k
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
180
AtCoder Conference 2025
shindannin
0
1k
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
930
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
610
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
620
2026年 エンジニアリング自己学習法
yumechi
0
120
Featured
See All Featured
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.1k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
750
A Tale of Four Properties
chriscoyier
162
24k
Discover your Explorer Soul
emna__ayadi
2
1.1k
The SEO Collaboration Effect
kristinabergwall1
0
340
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
69
[SF Ruby Conf 2025] Rails X
palkan
0
730
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
Testing 201, or: Great Expectations
jmmastey
46
8k
Paper Plane (Part 1)
katiecoart
PRO
0
3.7k
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 测试 ( 行为 ) 驱动开发