input sanitisation
cleaning the data on entry - removing spaces and SQL characters
input validation
make sure that the data is allowed
Type check (is it an Integer or a string, real or Boolean)
Presence check (has data been entered)
Range Check
Format check (eg dd/mm/yy)
length check (eg 11 digits for phone number)
planning for contingencies
what might go wrong
anticipating misuse
what might hackers do?
authentication
using user names and passwords
sensible names for variables constants and subroutine
to explain complex parts of the code
comments
to explain to other programmers or your future self what each section of code does
indentation
to show different sections of code like if statements or loops
so that related functionality is grouped together
use subroutines
code is structured and easier to test and to follow
• the purpose of testing
Check that the program meets the users' requirements
• types of testing:
iterative (constantly testing during development test and fix)
final/terminal (when program is finished)
• how to identify syntax and logic errors
Syntax errors
breaks the rules of the programming language
program will not run
Logic errors
the program will run
but it will have unexpected outputs
• selecting and using suitable test data.
test with valid data - it should work
test with invalid data -(correct type but outside the accepted validation limit) - it should return an error
test with boundary data (ie at the edge of what is valid or invalid)
test with Erroneous data (data of an incorrect type - should be rejected)
Must be able to create/complete a test plan