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
TDD, BDD and Beyond
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
ipfans
April 25, 2021
Programming
76
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
58
Go最差实践
ipfans
0
55
现代方式使用asyncio
ipfans
0
96
Go的版本管理之路
ipfans
0
110
Other Decks in Programming
See All in Programming
Inside Stream API
skrb
1
770
ふつうのFeature Flag実践入門
irof
8
4.2k
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
14
5.8k
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
170
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
180
Spring Security 実践 ─ GraphQL APIで実務に役立つ 認証・認可 を学ぶ
wagyu
0
260
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
120
Javaの型とAI時代に型が大事な理由 / java types and type in AI era
kishida
2
150
AI 輔助遺留系統現代化的經驗分享
jame2408
1
970
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
230
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.5k
A2UI という光を覗いてみる
satohjohn
1
150
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
HDC tutorial
michielstock
2
720
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
150
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Designing for humans not robots
tammielis
254
26k
Building Adaptive Systems
keathley
44
3.1k
Paper Plane (Part 1)
katiecoart
PRO
0
9.2k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.9k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.8k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
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