Presentation is loading. Please wait.

Presentation is loading. Please wait.

7 - Programming 7P, Q, R - Testing.

Similar presentations


Presentation on theme: "7 - Programming 7P, Q, R - Testing."— Presentation transcript:

1 7 - Programming 7P, Q, R - Testing

2 Learning Intentions To develop an understanding of how programs can be tested for erorrs

3 Assessment Outcomes 7P - describe syntax errors and logic errors which may occur while developing a program 7Q - understand and identify syntax and logic errors 7R - Select and justify test data for a program, stating the expected outcome of each test

4 7P/Q - describe syntax errors and logic errors which may occur while developing a program
There are two main types of error that occur when developing a program: Logical Syntax Syntax is the format that a programming language has to use, for example if statements need a : at the end in python, but some languages use ;. Syntax errors are where there is a problem with the format the code has been written for example a missed : or a spelling mistake. Examples of Syntax Errors: Mistyping a key word: WRIET instead of WRITE Missing key words out of constructs such as starting a REPEAT loop but not writing UNTIL anywhere Opening brackets but not closing them Not having the right number of parameters inside brackets for functions, for example: Answer=round(TheNumber) will give a syntax error if the language expects another parameter to state the number of decimal places: Answer=round(TheNumber,2) Logic Logic errors occur when the code has been written using the correct format and will execute, but it doesn’t give the desired outcome. For example while loops that do not end, loops that run the wrong number of times etc. Examples of Logic Errors: Loops that do not execute the correct number of times because a condition states X>10 instead of X>=10. Variables have not been initialised, or have been initialised in the wrong place (often incorrectly initialised inside the loop instead of just before it). Flawed algorithms that just don’t do what they were intended to do. Capturing all of the complexities of real‐life scenarios in code is difficult and users always manage to do something to the input that you didn’t cater for!

5 7R – Test Data Testing should be formalised in using industry standard methods. One of these is by using a testing table with the following headings: The first three columns are part of our design and planning stage and the final column is completed when we test the finished program If numbers or dates are being entered by the user then use test data that checks both ends of the allowed range as well as data that should not be allowed, just outside this range. This is known as testing boundary data. Test purpose Test data Expected outcome Actual outcome

6 Crib – Fundamental topics
Define Sequencing and give an example Define Selection and explain how it is achieved using: If, Elif, Else Case Define Iteration and give an example of how it is achieved using: For Loops While Loops Repeat Loops

7 Exam Questions I have ripped off every exam question for Unit 1 – Fundamentals of Computing.. Answer all of the questions in the A, B, C folder. Self Assess them all. Get me to check them!


Download ppt "7 - Programming 7P, Q, R - Testing."

Similar presentations


Ads by Google