Summary:Testing and documenting solutions

From Higher Computing Science
Jump to: navigation, search

Testing

  • Systematic testing involves carrying out a set of tests according to a test plan
  • Comprehensive testing involves testing every aspect of the software

Types of error

  • A syntax error is an error that can be spotted by a translator because a line in a program is incorrectly formed. This would include missing symbols (like a semi-colon or quotation mark), spelling mistakes or missing keywords such as a missing END IF
  • Syntax errors tend to prevent a program from running (depending on the language).


  • An execution error is an error that is caused by the code when it runs. This would include an array being accessed at a position that doesn’t exist, a number being outside the possible range of numbers stored in the programming language, or dividing by zero.
  • A division by zero is an execution error where the computer tried to divide one number by zero, resulting in a crash.
  • Truncation is an execution error where, due to the way the program has been written, a number becomes less precise, leading to errors in a calculation.
  • An out of bounds error is an execution error that happens when an array is accessed in a position that does not exist, e.g. requesting position 20 of an array of ten numbers.
  • When handling files, if you try to access a file with an incorrect path, this will cause an Execution error.


  • A logic error is an error in the program’s decision making. This is caused by the programmer. The program will run, but not carry out instructions in the intended way, because the logic of the program is wrong.
  • Common causes of logic errors are when calculations are wrong and incorrect use of IF statements.


Testing tools

  • A dry run is a desk-based analysis of code. The program is executed line by line by a programmer and the programmer notes down the values of each variable as they change. This will help the programmer find logic and execution errors.
  • A trace table is a table of values showing the contents of a variable within a program as each line is run. The table can list several variables and will show the values of the variables in rows as the program progresses.
  • A watch variable is a tool that shows the contents of a variable in a program as it runs. The programmer can step through a program, line by line, and observe the changes to the variables by looking at the watch variable table.
  • A breakpoint is a marker in a program that pauses execution so that the programmer can use other tools such as a watch variable to observe what is happening at a given moment in a program