Tdd - Test Driven Development
-
Upload
david-paluy -
Category
Software
-
view
64 -
download
0
Transcript of Tdd - Test Driven Development
Confidence
● Modular code
● Many changes
● Refactoring
If there are NO TESTS, you should be worried making changes!
When do we need to write tests?
So, if the codeworks perfectly, and I’m never going to change it, then why should I write tests?
If I write the test first,
● It forces me think before I code
● Code is more focused and clear
● I know when I’m finished, because all thetests pass
When do we need to write tests?
So, if the codeworks perfectly, and I’m never going to change it and the design is already flawless,then why should I write tests?
Yoga Instructions
1. Kneel down2. Put your hands flat in the ground3. Lift your feet off the ground and balance on
your hands4. Put your knees ahead of your hands5. Stretch out your back so your body is
perpendicular to the ground
When do we need to write tests?
So, if the codeworks perfectly, and I’m never going to change it and the design is already flawless and it is totallyreadable and understandable,then why should I write tests?
Unit Test - Method to verify isolated units of code● Checks a single assumption about the
behavior of the unit
● Fast running tests
● Quick to debug
● Is hitting DB - is OK?
Integration Tests
● Tests software modules as a group
● Tests integration points
● Slower than Unit tests
Acceptance tests
● End-to-end test cases of: happy user journeys and critical failure scenarios
● Production like environment
● Manual or Automated
Mocks vs Stubs
Mock Objects are special case objects that mimic real objects for testing.
Stubs provide canned answers to calls made during the test
Test Driven Development
Apply
Inspect
AdaptIf you haven’t done it first, you don’t know what you are talking about!