02 - Test Driven Development Flashcards

1
Q

What is the traditional software development model?

A
Analysis
Specification
Design
Implementation
Testing
Operation and Maintenance
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the problems with the traditional software development model?

A
  • Testing happens late, if at all
  • Requirements decoupled from code during development
  • Quality is SEP (Somebody else’s problem)
  • Hard work to test, so problems are not always detected
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the TDD process for adding a feature to a program?

A
  • Identify a feature to be implemented
  • Write and run a unit test for it. This should fail
  • Write the smallest/simplest bit of code which will pass the test
  • Run the test
  • Run all previous tests to ensure they still pass
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What does Test Driven Development prefer:

Small improvements frequently, or large improvements less often?

A

Small improvements frequently

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

What are some of the characteristics of a TDD approach?

A
  • Make small improvements frequently
  • Always have a working system
  • Incremental design
    • No more than required at the time
    • Don’t be afraid to modify the design
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What properties should unit tests have?

A
  • Focused: They should test one thing at a time
  • Fast to run
  • Independent of:
    • Each other
    • The environment
    • Run order
  • Automatic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How does JUnit assist with Test Driven Development?

A
  • Facilitates writing and running unit tests
  • Has methods to check conditions: assertEquals, assertTrue, assertNull etc.
  • Annotations to declare methods as tests, as well as methods to be run before every test, after every test, before all tests etc.
  • Can run tests at the click of a button (with IDE integration)
  • Reports any tests that fail and gives reasons why
How well did you know this?
1
Not at all
2
3
4
5
Perfectly