Test Driven Development

Nirmesh Bagadwal
2 min readJul 29, 2020

--

Agenda

1. TDD Overview

2. Test First vs. Test Last

3. TDD Benefits and Limitations

4. Summary

Quotes

Kent Beck said “Test-first code tends to be more cohesive and less coupled than code in which testing isn’t a part of the intimate coding cycle”

“If you can’t write a test for what you are about to code, then you shouldn’t even be thinking about coding”

TDD Overview

1. Made popular by Extreme Programming

2. Method of developing software not just testing software

3. Software is Developed in short iterations

4. Unit Tests are developed FIRST before the code

How It Works –

1. Add a Test, Use Cases

- User Stories are used to understand the requirement clearly

2. Run all tests and see the new one fail

- Ensures test harness is working correctly

- Ensures that test does not mistakenly pass

3. Write some code

- Only code that is designed to pass the test

- No additional functionality should be included because it will be untested

4. Run the automated tests and see them succeed

- If tests pass, programmer can be confident code meets all tested requirements

5. Refactor code

- Cleanup the code

- Rerun tests to ensure cleanup did not break anything

Test First vs. Test Last

TDD Benefits

TDD Limitations

--

--

No responses yet