42
迎迎 TDD Ivan Wei

Getting started with TDD

Embed Size (px)

Citation preview

Page 1: Getting started with TDD

 迎接 TDDIvan Wei

Page 2: Getting started with TDD

Why

Page 3: Getting started with TDD

維持現況不好嗎

Page 4: Getting started with TDD

先說結論

Page 5: Getting started with TDD
Page 6: Getting started with TDD

什麼是 TDD

Page 7: Getting started with TDD
Page 8: Getting started with TDD

RedWrite a test

that fail

Refactor GreenWork the

code work

Page 9: Getting started with TDD

好處

Page 10: Getting started with TDD

一致性

Page 11: Getting started with TDD
Page 12: Getting started with TDD

壞處

Page 13: Getting started with TDD

時間增加

Page 14: Getting started with TDD

破壞現況

Page 15: Getting started with TDD

直到…

Page 16: Getting started with TDD

RiskCostHigh

Low

Nothing Too much

Sweet Point

Page 17: Getting started with TDD

DEMO

Page 18: Getting started with TDD
Page 19: Getting started with TDD

使用的套件

Page 20: Getting started with TDD

名稱 用途 設定檔Gulp.js 流程總指揮 gulpfile.js

Mocha.js 測試發動機 mocha.opts

Should.js 稽核人員

JSDoc API 文件產生器 jsdoc.json

Page 21: Getting started with TDD

執行方式

Page 22: Getting started with TDD

單檔測試

Page 23: Getting started with TDD

所有測試

Page 24: Getting started with TDD

撰寫方式

Page 25: Getting started with TDD
Page 26: Getting started with TDD
Page 27: Getting started with TDD

JSDOC 撰寫

Page 28: Getting started with TDD
Page 29: Getting started with TDD
Page 30: Getting started with TDD

SPEED UP

• Sublime 、 Atom - DocBlockr

• Webstorm - 需要補充

Page 31: Getting started with TDD

加入 ESLINT

Page 32: Getting started with TDD

• 開啟 gulpfile.js

• gulp.task('mochaTest', ['lint'], () => {取代gulp.task('mochaTest', () => {

• gulp.task('test', ['lint', 'mochaTest', 'build:docs']);取代gulp.task('test', ['mochaTest', 'build:docs']);

Page 33: Getting started with TDD

IDE 服用 Linter

Page 34: Getting started with TDD
Page 35: Getting started with TDD

• WebStorm 教學• Sublime 教學 (看 JSHint 的部分)• Atom 教學

Page 36: Getting started with TDD

新增小工具

Page 37: Getting started with TDD

TRACER提升 Debug 的效率

Page 38: Getting started with TDD

Q & A

Page 39: Getting started with TDD

接下來 CI / CD

Page 40: Getting started with TDD
Page 41: Getting started with TDD

需要…

Page 42: Getting started with TDD