---
## Take-away
- Use pure functions when possible 👌
- Testing does not have to be hard 👏
- You test anyways, but then throw the test away 🧐
- You don't have to strive for 💯% test coverage
- Aim for a balance between unit- and integration tests ⚖️
- Testing removes the dread of refactoring 🔁
- Your future you will thank you 🙏
---
## Test-Driven Development: FizzBuzz Function
fizz_buzz() takes an integer argument and returns it, BUT
fails on zero or negative numbers
instead returns "Fizz" on multiples of 3
instead returns "Buzz" on multiples of 5
instead returns "FizzBuzz" on multiples of 3 and 5
---
## FizzBuzz Function
fizz_buzz() takes an integer argument and returns it, BUT
fails on zero or negative numbers
instead returns "Fizz" on multiples of 3
instead returns "Buzz" on multiples of 5
instead returns "FizzBuzz" on multiples of 3 and 5
Create an empty function fizz_buzz()
Write the tests
Paste your tests in the collab document, and discuss
Now write a function code to make your tests pass
---
## Take-away
- What did you think of this style of development?
- Was it easier or harder than just writing code?
- Would your code look different without the tests?
- For what kind of projects would it be useful?
Test-Driven Development (TDD) is an optional tool in your toolbox 🛠️