Testing: Let's Practice!
Suppose we have a program that takes a name and phone number as input. It isn't practical to test every single possible input. What are some inputs you would definitely want to test?
Well, to start, I would test it on my own name and phone number!
That's as good a starting test as any! Checking the behavior on an input you understand very well, and that you think will match all of your assumptions, can be a great starting point.
But while it's fine to have a test like that, it's definitely not enough!
For sure. What else should we test?
Some people might enter their phone number with dashes between the numbers, and other people might enter it with just the numbers.
Yep. We should probably make sure the program does the right thing with both.
What if someone misses a number in their phone number?
Good point! We probably want to check the program's behavior if there's an input error like that!
Similarly, we should check names that are entered with capital letters and names that are entered in all lowercase!
Ooh! And names that aren't written in Latin characters at all!
You're getting the idea!
Other tests might depend on what, exactly, the program is doing with the name and phone number.
But thinking about what the edge cases are where the program might behave differently than we want, will serve us well on all sorts of testing.
We'll revisit this idea when we start writing our own classes in C++.
(When logged in, completion status appears here.)