Back to 课程

Computer Science GCES AQA

0% Complete
0/0 Steps
  1. Representing Algorithms Aqa
    4 主题
  2. Efficiency Of Algorithms Aqa
    1 主题
  3. Searching Algorithms Aqa
    3 主题
  4. Sorting Algorithms Aqa
    3 主题
  5. Data Types Aqa
    1 主题
  6. Programming Concepts Aqa
    5 主题
  7. Arithmetic Relational And Boolean Operations Aqa
    1 主题
  8. Data Structures Aqa
    3 主题
  9. String Manipulation Aqa
    1 主题
  10. Random Number Generation Aqa
    1 主题
  11. Structured Programming Aqa
    2 主题
  12. Robust And Secure Programming Aqa
    4 主题
  13. Number Bases Aqa
    2 主题
  14. Converting Between Number Bases Aqa
    3 主题
  15. Units Of Information Aqa
    9 主题
  16. Hardware And Software Aqa
    4 主题
  17. Boolean Logic Aqa
    3 主题
  18. Programming Languages And Translators Aqa
    2 主题
  19. Cpu Architecture Performance And Embedded Systems Aqa
    4 主题
  20. Memory Aqa
    2 主题
  21. Secondary Storage Aqa
    3 主题
  22. Fundamentals Of Computer Networks Aqa
    8 主题
  23. Fundamentals Of Cyber Security Aqa
    1 主题
  24. Methods Of Preventing Cyber Security Threats Aqa
    1 主题
  25. Relational Databases Aqa
    2 主题
  26. Ethical Legal And Environmental Impacts Aqa
    2 主题
课 Progress
0% Complete

Exam code:8525

Testing Algorithms

What is the purpose of testing algorithms?

  • Testing is carried out for many reasons, however, 4 main areas are:

    • To ensure there are no errors or bugs in the code

    • To ensure that the code performs as it was intended

    • To ensure no one can gain unauthorised access to the system

    • To check the program solves the initial problem and meets all requirements

What are the different types of testing?

  • There are two types of tests that developers and teams will do to ensure their programs are robust and meet the requirements that have been set out, they are: 

    • Iterative testing

    • Final testing

Iterative Testing

  • Each part of a program is tested

  • Every pathway through the program is tested

    • This includes each branch/pathway inside of IF statements

  • This is done during the development of the program

  • Iterative testing means repeatedly testing the program whilst continuing to make changes and make improvements

  • This method of testing ensures that the program is fully functional and working as intended

Final Testing

  • Testing that all parts (modules) of a program work together

  • Checking the program against real data to ensure it meets all of the requirements

    • Testing the program using normal, boundary and erroneous data

  • Final testing is done towards the end of the development cycle, once the entire program is complete

  • Final testing can include

    • Alpha testing

    • Beta testing

Normal, Boundary & Erroneous Tests

Categories of tests

  • The are three main categories of tests a programmer or test-user would carry out whilst performing both iterative or final testing on a program

    • Normal tests

    • Boundary tests

    • Erroneous tests

  • There is an additional test that users would always carry out to test the robustness of their program, this is known as an invalid test

  • To explain the types of tests, some example code will be used

Example code

# Ask for user's name
name = input("What is your name? ")

# Ask for user's age
age = int(input("How old are you? "))

# Check if age is between 12 and 18
if age >= 12 and age <= 18:
print("Welcome, " + name + "! Your age is accepted.")
else:
print("Sorry, " + name + ". Your age is not accepted.")

Normal tests

  • A normal test is when a user enters data that should be accepted in the program

  • An example would be a user entering their age as 16 into the age field of the program

Boundary tests

  • A boundary test is when a user enters data that is on the edge of what is acceptable 

  • An example would be a user entering their age as 12 or 18 into the age field of the program

  • Another example of a boundary test would be the numbers 11 or 19, even though they are outside of the accepted range

Erroneous tests

  • An erroneous test is when a user enters data that is the wrong data type

  • An example would be a user entering their age as “F” into the age field of the program

Invalid tests

  • An invalid test is when a user enters data that is the right data type but it is outside of what is accepted

  • An example would be a user entering their age as 67 into the age field of the program

Selecting Suitable Test Data

How do you select and justify suitable test data?

  • The first step when selecting suitable test data is to determine what type of input is expected from a user

  • In the example table below, a user is expected to enter a number between 12 and 18

  • Suitable checks include

    • The numbers between 12 and 18

    • Numbers outside of this range

    • Incorrect data types

  • Examples of each the the above have been summarised in the table below

A test result table with columns: "Type of Test," "Input," and "Expected Output." Results include Normal, Boundary, Erroneous, and Invalid inputs with Accepted or Rejected outputs.

Worked Example

SME Electronics is an online shop which sells electronic items.
The following flowchart shows an algorithm used to calculate the price of an item when they have a sale.

screenshot-2024-02-28-at-15-08-49
  1. Complete the following test plan for the algorithm [4]

Price Input

Test Type

Expected Price Output

50

Normal

 

100

 

 

150

 

 

200

Boundary

 

FFF

 

 

Answer

  • Marked in pairs

  • 1 mark per two correct cells

A table with three columns: Price Input, Test Type, and Expected Price Output. Rows represent test cases with various price inputs and expected outputs.

Responses

您的邮箱地址不会被公开。 必填项已用 * 标注