Automated testing
How did it go?
We want to normalize phone numbers. What situations do we need to handle?
- Create an empty function
- Try the different test cases
- Make them pass
- Small increments
- Working backwards from the expected behavior
- Test cases
- Edge cases
- The tests become the requirements
print()
assert
- Loop
- inputs → function → expected outputs
- Generally testing:
- Small chunks of code
- Specific functionality
- Generally should work offline, i.e. not talk to an API or anything
- Generally will use small sets of sample data
- Unit testing: individual components
- Integration testing: multiple components together
There are others — it's essentially a spectrum of small to large.
When might we want to use unit vs. integration tests? In other words, what are the pros and cons of each?
Structured way of doing what we were already doing
Reminder of the Project expectations.