Python Testing
What is Software Testing?
Three Common Definitions:
Definition 1: "Testing is a process of demonstrating that errors are not present"
- ❌ Problem: Testing can only show presence of bugs, not absence
- Famous Dijkstra quote: "Testing shows the presence of bugs, not the absence"
Definition 2: "Testing is to show that a program performs its intended function correctly"
- ❌ Problem: May subconsciously write tests that avoid finding errors
- ❌ Problem: Doesn't test what program is NOT supposed to do
Definition 3: "Testing is the process of establishing confidence that a program does what it is supposed to do"
- ❌ Problem: What if program also does what it's NOT supposed to do?
The CORRECT Definition:
"Testing is the process of executing a program with the intent of finding errors"
Key mindset shift:
- The more errors you find, the better the testing
- Write tests with the intention to find bugs
- Think like an adversary: battle between tester and developer
The Triangle Function Exercise
Specification: