Computing
Computer Science LearnITWithMrC ⛯ Year 7 Year 8 Year 9 GCSE
Responsive image

Lesson Video

32

Lesson Tasks

  • Watch the Lesson video
    Make notes on your notes sheet.
  • Read the lesson notes
    Make notes on your notes sheet.
  • Complete the learning activities
    Make any notes on your notes sheet.
  • Check the Learning outcomes
    Update your learning objectives

What do I need to Learn?

I need to learn how to select suitable test data to test typical user inputs.
I need to learn how to select suitable test data to test boundery/extreme user inputs.
I need to learn how to select suitable test data to test erroneuous user inputs.
I need to learn how to justify the choice of test data.

Key Terms

Logic errors Syntax errors Runtime Errors valid normal invalid Erroneous extreme boundary requirements

Errors and Testing - Learning Activities


Types of errors

There are three types of errors that may occur with when writing a computer program:

  • Syntax errors
  • Runtime errors
  • Logic errors

You will find that the errors become more difficult to discover and fix as you move down the above list


Syntax errors

A syntax errors is type of grammar error when using a programming language. Examples include:

  • Misspelled variable and function names
  • Missing colons or quotation marks
  • Missing or mismatched parentheses
  • Incorrect format in loops

Runtime errors

Runtime errors occur when a program tries to do something that it is unable to do. They are called runtime because they occur after the program has been compiled and is running. Examples include:

  • Trying to store a string in an int variable
  • Trying to divide by a variable by zero
  • Trying to open a file that doesn't exist

Logic errors

Logic errors occur when there is a mistake in your programming logic. Examples include:

  • Multiplying when you should be dividing
  • Adding when you should be subtracting
  • Outputting the wrong message

Testing

When we test our code we are looking to find runtime and logical errors in our code. To do this we create a test table and think of all possible types of input that might cause one of these errors.


Example - Grade Calculator

The user has to enter a test score between 0 and 100. It will then say the grade and how many marks they are off the next grade. The grade boundaries are:

1 = 70+
2 = 60+
3 = 50+
4 = 40+
U = < 40

Testing Table:

Coding activity

Task 1: Star Rating

Click on the link below and complete the tasks on the page getting all your tests to pass

Star Rating


Task 2: Voting Age Checker

Click on the link below and follow the tasks on the page starting with Task#2

Voting age Checker


Task 3: A Puzzling Algorithm

Predict the values from the algorithm then implement it using python, then run each test to check your predictions

A Puzzling Algorithm


Extension Task : Write a test table for the Password authentication routine

Create a test table and run appropriate tests on the extension task from the previous topic -> Password authentication routine


Learning Outcomes

  • I can explain the types of errors and how they are caused.
  • I can create a Test Table to catch errors in my code.
  • I can create a Test Table which covers all possible
    test cases including valid, invalid and extereme.
Copyright © 2013 -2019 LearnITwithMrC