Test-driven development with Node.js
-
Upload
mirko-kiefer -
Category
Software
-
view
233 -
download
1
Transcript of Test-driven development with Node.js
Why use TDD?• Less fear of change
• Increase productivity and focus
• Better communication in teams
• Improved software design
• Less bugs
Test in layers
• Start with the public interface (API / user interface)
• Mock the next (non-implemented) layer underneath
• Repeat with implementing the next layer
• Example:user interface -> server API -> request handlers -> database
Refactor
• Remove duplication
• If obvious, write “correct” implementation
• Write next failing test
Code coverage
• Don’t be fanatic
• Code covered does not mean its tested
• You know which code is critical
Keep it simple
• Do you really need tools for mocking and dependency injection?
• Tools introduce complexity and can slow you down
• Embrace concepts, not tools