Download presentation
1
Testing
2
Activity 1 5 mins What is the difference between: A “Syntax Error” …and… A “Logic Error”
3
Testing Introduction Computers only do what they are told.
Learning Objectives: (p) describe syntax errors and logic errors which may occur while developing a program (q) understand and identify syntax and logic errors (r) select and justify test data for a program, stating the expected outcome of each test. Introduction Computers only do what they are told. If the program doesn’t work as it should (either doesn’t run or runs with unexpected results) it will be down to an error that the programmer has made. We will now look at the two types of errors found in programming and understand how we can test for these errors so that our programs work as we have intended.
4
Syntax Error Logic Error
Testing Learning Objectives: (p) describe syntax errors and logic errors which may occur while developing a program (q) understand and identify syntax and logic errors (r) select and justify test data for a program, stating the expected outcome of each test. There are 2 types of error: Syntax Error & Logic Error What do you think is the difference?
5
Testing HOW? Syntax Errors:
Learning Objectives: (p) describe syntax errors and logic errors which may occur while developing a program (q) understand and identify syntax and logic errors (r) select and justify test data for a program, stating the expected outcome of each test. Syntax Errors: These are errors that occur when the instructions/code that is written do not follow the rules of the programming language. The code cannot be understood by the computer when it is run and an error message is generated. Most of the time the IDEs interpreter will highlight these errors as you type your code. HOW? Often with red lines!
6
Testing Learning Objectives: (p) describe syntax errors and logic errors which may occur while developing a program (q) understand and identify syntax and logic errors (r) select and justify test data for a program, stating the expected outcome of each test. Syntax Errors: Now that you are proficient programmers, what syntax errors have you experienced? Examples may include: Syntax Error Example Misspelt Keywords “colour” instead of “color” Missing or extra brackets print(“Hello World”)) Missing parts from multi-line instructions Missing the ENDWHILE from WHILE/ENDWHILE Type mismatch errors Trying to multiply a string variable Referring to variables that have not been declared If x == 3: (when x is unknown)
7
Testing Logic Errors: Learning Objectives:
(p) describe syntax errors and logic errors which may occur while developing a program (q) understand and identify syntax and logic errors (r) select and justify test data for a program, stating the expected outcome of each test. Logic Errors: These types of error are usually not known until runtime (when the program is actually being used). They occur when there is a mistake in the algorithm which results in the program not doing what it was intended to do. The program might: Crash Get stuck in a loop Or simply produce unexpected results. What sort of things might happen if a program contains some logic errors?
8
Testing Learning Objectives: (p) describe syntax errors and logic errors which may occur while developing a program (q) understand and identify syntax and logic errors (r) select and justify test data for a program, stating the expected outcome of each test. Logic Errors: Now that you are proficient programmers, what logic errors have you experienced? Examples may include: Logic Error Mistakes in maths (eg: x*(3+2), instead of (x*3)+2) Misplaced brackets Misplaced indentations Instructions in the wrong order Wrong conditions being set in a loop
9
Testing using Test Plans!
Learning Objectives: (p) describe syntax errors and logic errors which may occur while developing a program (q) understand and identify syntax and logic errors (r) select and justify test data for a program, stating the expected outcome of each test. After writing your code, correcting syntax errors as we go along and checking that our program works as it should by systematically testing it as we go along, our program should be working well! But this is often not the case as we are humans and humans make mistakes! So how can we check for these remaining errors? The answer is… Testing using Test Plans!
10
Testing Learning Objectives: (p) describe syntax errors and logic errors which may occur while developing a program (q) understand and identify syntax and logic errors (r) select and justify test data for a program, stating the expected outcome of each test. Test Plans: Test plans are used to interrogate the finished program. Testing is done using test data and a good test plan will use test data that covers every possible type of input: Normal Data Borderline / Extreme Data Erroneous Data
11
Testing Normal Data Learning Objectives:
(p) describe syntax errors and logic errors which may occur while developing a program (q) understand and identify syntax and logic errors (r) select and justify test data for a program, stating the expected outcome of each test. Normal Data This is data that should be accepted by the program. Normal input you would expect form typical use. E.G. Date of Birth = 12/04/1972
12
Testing Borderline / Extreme Data Learning Objectives:
(p) describe syntax errors and logic errors which may occur while developing a program (q) understand and identify syntax and logic errors (r) select and justify test data for a program, stating the expected outcome of each test. Borderline / Extreme Data Data that tests the limits of what should be accepted Data just above, just below and actually on the acceptable limit E.G. Date of Birth = 12/04/1900
13
Testing Erroneous Data Learning Objectives:
(p) describe syntax errors and logic errors which may occur while developing a program (q) understand and identify syntax and logic errors (r) select and justify test data for a program, stating the expected outcome of each test. Erroneous Data Data that should be rejected Also check that error messages are generated to inform the user E.G. Date of Birth = Twelfth of the fourth nineteen seventy two Error: please enter a valid date!
14
Testing Test Plans Learning Objectives: These are used to:
(p) describe syntax errors and logic errors which may occur while developing a program (q) understand and identify syntax and logic errors (r) select and justify test data for a program, stating the expected outcome of each test. Test Plans These are used to: ensure that a system is fully tested to document the outcomes. Test plans are made up of: The test data The reason for the test The expected outcome The actual result (which is added later – after development)
15
Testing Actual Outcomes (after development) Learning Objectives:
(p) describe syntax errors and logic errors which may occur while developing a program (q) understand and identify syntax and logic errors (r) select and justify test data for a program, stating the expected outcome of each test. Test Plans Ultimately they will test the program works as it should – has met the success criteria. So if the success criteria was: A suitable test plan might look something like this: Example Success Criteria: User should be able to enter ONLY dice number 4, 6 or 12 Program should generate a random number within the limits of the dice chosen. The program should ask if the user would like to roll again. Test Number Reason for Test Type of Test Test Data Expected Outcome 1 To see if the user can input their dice number Typical Enter a 6 when program requests The program will accept the input and pick a random number from 1-6. 2 Extreme Enter a 12 when program requests The program will accept the input and pick a random number from 1-12. 3 Erroneous Enter a 1 when program requests The program will NOT accept the input and ask for the number again. 4 To see if the user can roll again. Type in “Y” The program will ask the user for a dice number again. 5 Type in “N” The program close. 6 Type in “Yes” The program will ask the user if they would like to roll again. Actual Outcomes (after development)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.