Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
TDD
Node.js
SPOOKY

Programmer
DevOps
Team Leader
Java 6 years
Javascript 1.5 years



smlsun@facebook
trunk-studio.com
blog.trunk-stu...
• Why we needTDD
• How to startTDD
• Conclusion
OUTLINE
TDD
• Programmer
•
•
• DevOps
•
•
•
• Team Leader
• Member
• Member
•
• Member
TEST
DeveloperQA
TEST SPEC
/
FAIL
Edge of Tomorrow
LEAN & AGILE
•
•
•
•
...
TDD
TEST CODE
TDD
XTEST vs OTEST
-4
-2
-60
TDD
NODEJS
Package

Library
Application
Server
LOGIN
• 3 step Login
INITIAL
var liftApp = async () => {
await models.sequelize.sync({
force: config.connection.force
});
await bootstrap();
app.listen...
SPECdescribe('auth login spec', () => {
before(async (done) => {
let testUser = {'username': 'test', 'password': 'test'}
a...
• Mocha test framework
• Supertest API
• Should or Chai spec
MOCK


EX
API

OR
• sinon 

Mock
Source code
Mock code
Spec
SPEC
SA/SD


/
SPEC
CI / CD
–
“ ”
•
•
•
•
• from Clean Code
TDD
THANKS!
• http://qualitycoding.org/tdd-testimonial/
• http://gamesfromwithin.com/backwards-is-forward-
making-better-games-with-te...
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
JSDC 2015 - TDD 的開發哲學,以 Node.js 為例
Upcoming SlideShare
Loading in …5
×
Upcoming SlideShare
QML 與 C++ 的美麗邂逅
Next
Download to read offline and view in fullscreen.

54

Share

Download to read offline

JSDC 2015 - TDD 的開發哲學,以 Node.js 為例

Download to read offline

說明 TDD 的重要性,為什麼需要,並且以 Node.js 為例進行說明

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

JSDC 2015 - TDD 的開發哲學,以 Node.js 為例

  1. 1. TDD Node.js
  2. 2. SPOOKY
 Programmer DevOps Team Leader Java 6 years Javascript 1.5 years
 
 smlsun@facebook trunk-studio.com blog.trunk-studio.com
  3. 3. • Why we needTDD • How to startTDD • Conclusion OUTLINE
  4. 4. TDD
  5. 5. • Programmer • •
  6. 6. • DevOps • • •
  7. 7. • Team Leader • Member • Member • • Member
  8. 8. TEST
  9. 9. DeveloperQA
  10. 10. TEST SPEC
  11. 11. /
  12. 12. FAIL Edge of Tomorrow
  13. 13. LEAN & AGILE • • • •
  14. 14. ...
  15. 15. TDD TEST CODE
  16. 16. TDD
  17. 17. XTEST vs OTEST -4 -2 -60
  18. 18. TDD NODEJS
  19. 19. Package
 Library Application Server
  20. 20. LOGIN • 3 step Login
  21. 21. INITIAL
  22. 22. var liftApp = async () => { await models.sequelize.sync({ force: config.connection.force }); await bootstrap(); app.listen(config.port); return app; } if (env !== 'test') liftApp(); module.exports = liftApp import chai from 'chai'; import request from 'supertest'; import sinon from 'sinon'; import liftApp from '../../server'; chai.should(); global.sinon = sinon; before(async (done) => { let app = await liftApp(); global.app = app; global.request = request.agent(app.listen()); done(); }); AP
 start test framework
 start
  23. 23. SPECdescribe('auth login spec', () => { before(async (done) => { let testUser = {'username': 'test', 'password': 'test'} await models.User.create(testUser); done(); }); it('login should be success.', async (done) => { let loginUserFormData = { 'username': ‘test', 'password': ‘test' }; request.post(‘/auth/login') .send(loginUserFormData).expect(200) .end((error, res) => { if (error) done(error); let loginResult = res.body; loginResult.success.should.be.true; done(); }) }
  24. 24. • Mocha test framework • Supertest API • Should or Chai spec
  25. 25. MOCK 
 EX
  26. 26. API OR
  27. 27. • sinon 
 Mock Source code Mock code
  28. 28. Spec SPEC SA/SD 

  29. 29. / SPEC
  30. 30. CI / CD
  31. 31. – “ ”
  32. 32. • • • • • from Clean Code
  33. 33. TDD
  34. 34. THANKS!
  35. 35. • http://qualitycoding.org/tdd-testimonial/ • http://gamesfromwithin.com/backwards-is-forward- making-better-games-with-test-driven-development • http://punnode.com/archives/18016 • http://teddy-chen-tw.blogspot.tw/2014/09/blog- post_22.html
  • chunnengjntseng

    May. 7, 2017
  • sucitw

    May. 27, 2016
  • pipachun

    Dec. 31, 2015
  • zamove

    Dec. 15, 2015
  • adisonwu

    Dec. 10, 2015
  • ChenHungMing1

    Nov. 19, 2015
  • thisismysoul

    Nov. 18, 2015
  • JustinWu13

    Nov. 18, 2015
  • lidonghua

    Nov. 16, 2015
  • allenyu

    Oct. 27, 2015
  • ChonnyChu

    Oct. 22, 2015
  • ssuser43035c

    Oct. 17, 2015
  • weijing329

    Oct. 14, 2015
  • testOscar

    Oct. 13, 2015
  • wesleylin54

    Oct. 9, 2015
  • TsaiMengParis

    Oct. 7, 2015
  • chienhsuntseng9

    Oct. 6, 2015
  • freshmulberry

    Oct. 6, 2015
  • mowd8574

    Oct. 6, 2015
  • liweitw

    Oct. 6, 2015

說明 TDD 的重要性,為什麼需要,並且以 Node.js 為例進行說明

Views

Total views

3,649

On Slideshare

0

From embeds

0

Number of embeds

361

Actions

Downloads

60

Shares

0

Comments

0

Likes

54

×