coding dojo handbook 第三章
Posted windmissing
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了coding dojo handbook 第三章相关的知识,希望对你有一定的参考价值。
What you can learn?
pair program
read other’s code
write clean code
automated test
articulate your ideas
home in particular skills and techniques
agenda
- Dojo Principles
- Code Kata for TDD
- other styles of TDD
- Functional programming
- what TDD actually is
- how to write good tests
Dojo Principles
- One can’t discuss a form without code.\\n One can’t show code without tests.
- find a master for the form
- do it, explain share what you learned
- learn again
- can’t go faster and learn at the same time, so slow down
- Throw yourself in 没看懂
- 服从master
- master a subject
sub-skills of TDD
Drive Development with tests
gradually build up a piece of code to solve a problem that is too big to solve one goal
books
- Test Driven Development By Example
- break down problems into small pieces
- identify test cases
- choose what order to implement them in
- Growing Object Oriented Software, Guided By tests
- The RSpec book work with a Guiding Test in double-loop TDD
refactor safely
make a sequence of tiny safe changes that add up to a larger design improvement
book
Refactoring: Improving the design of existing code
- starting code is less than clean
- improve the design
- design the test case
Design Test Case
being readable, robust, faster
books
Principles for Agile Automated Test Deisgn
Three Pillars of Good Tests
The Art of Unit Tests
XUnit Patterns
Mocks, Fakes, Stubs, external dependencies
Design Clean code
code is readable
language idiom and styles
books
- Agile Software Development Principles, Patterns, Practise
- Java
- SOLID design Principles
- Working Effectively with Legacy Code
- poor -> good
TDD的种类
TDD的种类 | 适用场合 | 方法 | books |
---|---|---|---|
classical TDD | |||
London School of TDD | OOP | 类似OOP 2. 使用mock 3. 要求需要两个的Kata | Growing Object Oriented Software Guided By Test |
Approval Testing | Legacy Code | 定义Test Assert部分 -> Code迭代 -> 定义Test | |
another style | Functional programming |
TDD in terms of States and Moves
Overview State
- basic analyze
- review existing Code
- identify new functionality
- ask questions as CO/PO(facilitator)
- write Guiding Test
- list test cases
- think about order
说明
Guiding Test = Coaching Test = Acceptance Tests = Story Test = Scenario = a test for whole User Story 以终为始
Red State
/--- towards GT
a small achieve goal -> choose a test from list <
\\--- address a weekness
- deckeare and name a test(函数参数返回值)
- arrange, act, Assert
- satisfy the compiler
Green State
- pass it AS SOON AS possible
- refactor it
Refactor State
- remove fakes/code smells
- imporve readability
- NOT add function – 防止新功能没有UT
- Not add test – note it on lise
- pass it
结束
|----------------------------------------|全部步骤
|-----|第一次
retro
|---------------|第二次
retro
|----------------------------------------|第三次
purpose of 自动化测试
- clarify what to build
- detect regression errors
- document what the system does
Test设计原则
- document the 功能
- provide regression protection
- cost effective
- 可读性
read it through and understand
- what the test is for
- what the expected behavour is
- what aspects of it are covered
test fail will - quickly see what is broken
- robustness
good test fail will show
- a regression error — correct the system
- systeme changed — update the case
fragile tests fail will - not isolate — fail in suit
- duplication — one broken->lot fail
- dependent on random thread/code — 偶现
- speed
- 可更新
which tests are affected by a given change
以上是关于coding dojo handbook 第三章的主要内容,如果未能解决你的问题,请参考以下文章