Test Driven Development Flashcards

1
Q

Test Driven Development (TDD)

A

TDD Circle of Life:

  1. Write failing test
  2. Make test pass with minimum code
  3. Refactor
  4. Repeat
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

TDD Strategy

A
  1. Create a list of tests needed.
  2. Start by writing just enough test code
  3. Always run the test to see it fail in the way you expect
  4. Write enough code to make the test build
  5. Write enough code to make that test pass
    a) If you can’t solve it, fake it!
  6. When the implementation is obvious then continue, if it is not then go back to #4
  7. Refactor
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Refactoring

A

Refactoring introduces modifications to the code intended to improve the structure or design without changing functionality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Simple Ways to refactor

A
Eliminate duplicate code
Extract a method by breaking down long difficult methods
Extract complex operations to variables
Introduce constants for magic numbers
Simplify conditional expressions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Katas

A

A code kata is an exercise in programming which helps programmers hone their skills through practice and repetition.
TDD is a common method used to solve code katas to allow first focusing on the problem and then being able to focus on the quality of the code and experimentation with new ideas.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly