Testing is one of the components that your program will be evaluated on. Specifically, these are subcomponents under Testing on most grading sheets for your program assignments.
You should run your program with different inputs, and capture the output to prove that the program did as you wanted it to. See the tutorial page for how to do captures with Visual Studio C++.
You should think about what you need to test. Try large numbers and small, positives and negatives, zero, short strings and long ones, empty files and non-existent files. Try inputs that will cause all parts of your program to be executed at least once. Make each loop body be executed zero times if possible, just one time, and more than one time. Each branch of an if/then/else should be executed.
Try to think about what is "normal" input and what is outside that range.
The quality of the test cases is more important than their quantity. Testing the same parts of the code ten different times will probably give successful results if the first test does. It is better to make sure that all parts of the code are executed at different times.
Each output that you capture should be labeled on the capture as to what you were testing there. Labels are like "Normal case: negative number", "Error case: zero not allowed" or "Error case: Z is an illegal character".
A test plan is something a programmer develops as they design and write their program. It specifies what cases you are testing, gives inputs for the case, the expected output and the actual output. It must be a text file; don't worry if the file doesn't look as nice as it would on paper.
Here is an example problem:
Some code is supposed to input an integer number and test it to see if it
is in the range 5 to 10 inclusive. If it is, the output should be
"yes". If it is not, then the output should be "low" if it is lower than
5, and "high" if it is larger than 10.
| Test Case | Input | Expected Output | Actual Output |
|---|---|---|---|
| Normal case, number in range | 7 | "yes" | "yes" |
| Normal case, number too low | 4 | "low" | "low" |
| Normal case, number too high | 11 | "high" | "high" |
| Boundary case | 5 | "yes" | "yes" |
| Boundary case | 10 | "yes" | "yes" |
| Error case (alpha instead of integer) | ABC | unpredictable | 29384131 |