errors and testing

Cards (5)

  • syntax errors
    • the translator expects commands to have a certain format called a syntax (grammar rules) - syntax is a set of rule which defines the format of each command
    • without the correct key words the translator won't interpret it into machine code
    • eg. mistyping a key word, missing key words out of constructs, opening brackets but not closing them, wrong number of parameters
  • logic errors
    • code written with no syntax errors but does not work the way it's intended
    • eg. missing brackets from mathematical calculations
    • loops that don;t execute the correct number of times bc a condition is written incorrectly
    • variables that haven't been initialised / initialised in the wrong place eg inside of a loop
    • not adding a code to cater for unexpected inputs
  • types of testing
    • iterative: using the test plan or trace tables, correcting errors and retesting until all tests give expected result. each subroutine may be tested separately in a large program, as soon as it is written
    • final: when program is completely finished and all parts separately tested. checks all required functions have been included and everything works correctly
  • test data
    • normal: typical data that the program is designed to handle
    • boundary: including both ends of the allowed range and data outside the range
    • invalid: data outside limits of valid data
    • erroneous: eg. non-numeric characters in a numeric field
  • test plan should include test purpose, test data (and whether it's allowed or not) and expected outcome (eg an error message or input is accepted)