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
TDD, BDD and Beyond
Search
ipfans
April 25, 2021
Programming
93
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
TDD, BDD and Beyond
内部培训分享
ipfans
April 25, 2021
More Decks by ipfans
See All by ipfans
Event Modeling: 新项目沟通方式
ipfans
0
66
Go最差实践
ipfans
0
57
现代方式使用asyncio
ipfans
0
110
Go的版本管理之路
ipfans
0
130
Other Decks in Programming
See All in Programming
Java 27新機能 / Java 27 new features
kishida
2
140
What We Talk About When We Talk About XP
m_seki
2
620
XHTMLが残したもの
yosuke_furukawa
PRO
2
800
How I Stole PSI from Android Studio - DroidKaigi2026
worker8
0
130
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
110
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
4
2.3k
スマート反転とウェブアクセシビリティ
camiha
0
210
AIを上手に使っていこうとしたら越境せざるを得なくなった話 〜実践1年で見えた境界を越えなければならない理由と進め方〜 / Crossing borders with AI
tomoyakitaura
4
1.1k
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
390
Security issues being discussed on Web Platforms
petamoriken
0
940
Intent as Code
shoppingjaws
6
1k
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
2.2k
Featured
See All Featured
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
320
Music & Morning Musume
bryan
48
7.4k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
240
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.8k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
500
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
300
Odyssey Design
rkendrick25
PRO
2
810
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
240
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
450
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
280
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Transcript
TDD, BDD AND BEYOND
什么是TDD?
什么是TDD? • TDD (Test Driven Development, 测试驱动开发) • 由极限编程中倡导,以其倡导先写测试程序,然后编码实现其功能得名; •
TDD的⽬的是取得快速反馈并使⽤“illustrate the main line”⽅法来构建程序; • 本质是⼀种确保功能被正确执⾏的思路实现;
TDD实现周期 • TDD周期 • 编写下⼀个功能测试,通常是失败 的,标记为红⾊; • 实现功能,使功能正常通过测试,标 记为绿⾊; •
重构功能,保持代码新鲜和健康,并 且过程完成后测试必须是绿⾊;
TDD优势、缺陷和不⾜ • 优势 • 研究报告说良好正确的编写错误可以避免程序错误⾼达60%。 • 让重构过程更加安⼼,你可以通过测试直接知晓是否正确执⾏。 • 强迫必须进⾏良好设计,以⽅便更好的编写测试代码。 •
好的测试可以做⽂档。
TDD优势、缺陷和不⾜ • 缺陷 • TDD会降低部分开发效率,尤其是未进⾏良好设计的前提下。 • 很多时候开发任务会明显增加。 • 当进⾏⼤规模重构时,⼀些时候意味着测试代码同样需要进⾏调整。 •
不⾜ • ⽆⽤测试可能会导致花费了时间但未能实现⽬标; • 测试可能存在预设输出错误,⽽很多时候往往意识不到;
什么是BDD?
什么是BDD? • BDD(Behavior-driven development, ⾏为驱动开发) • 可以视为TDD的超集,关注点为程序⾏为⽽不是实现细节; • 以软件交付的⾏为为核⼼确认,确保交付功能符合预期; •
⿎励开发者、QA和市场商务⼈员之间的协作,交付以⽤户为核⼼的代码;
BDD⽣命周期
BDD实现要素 • 通常包含以下要件: • ⽤户故事(User Story),⼀般由产品经理输 出; • 可接受结果(Accept Criteria),⼀般由产品
经理和QA输出; • ⽤户故事转化为格式化故事: • Scenario:功能描述 • Given:给定条件 • When:上下⽂信息,⽐如操作 • Then:可接受结果
BDD优势、缺陷和不⾜ • 优势 • 关注交付功能,更贴近⽤户,⽅便业务理解,定义业务价值; • 明确验收标准,有效帮助QA验证 • 对边界问题和异常问题定义有⼀定帮助 •
⽅便其他⾮开发⼈员理解程序功能
BDD优势、缺陷和不⾜ • 缺陷 • 不是所有的问题都那么好描述,尤其是业务流程复杂的时候; • 不是所有的情况都可能⼀次性被枚举出来,有些繁琐和⼩粒度的业务组合; • 不⾜ •
并不是完全真正的⽤户⾏为,更多的是程序的结果输出⾏为; • 构建描述时为了开发/转换体验,与通⽤沟通语⾔仍旧存在差异;
WHY BDD?
关注功能交付!
BDD IN GOLANG
BDD IN ACTION
BDD IN ACTION
BDD IN ACTION