Week 9 - Testing & Debugging Flashcards
How are test harnesses different to test cases?
Test harnesses are like the placeholder, whereas the test cases are the actual values which we are passing in to see if the program will work properly or not.
Why do we use validation?
Validation reduces the variety of inputs and only allows for certain inputs otherwise you can’t continue.
This is implemented with Reg Exp’s.
How is defensive programming implemented?
Through adding placeholders, using conditional statements and structured code.
(if statements)
How can we debug code?
It can be done either bottom up or top down as well as tracking variables and using binary chops.
What is an efficient way to test that a program will work?
Try to test the program by entering no values, 1 value and then 3 values.
Test Harnesses
Small programs used to specify a program’s function and output as well as to test modules.
They are useful in testing hypotheses for outputs of certain inputs.
Binary Chop
Is similar to a number guessing game in that you continue to divide the program into the possible sections where the issue could be.
(50-100, 75-100, 90-100, 95-100, 98!)
Top Down Debugging
Looking at all of the modules and then fixing the problems from there.
Bottom Up Debugging
Testing each of the modules as you make them to know where the issues are coming from.