Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming for GCSE Topic 6.2: Testing T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science Queen Mary University.

Similar presentations


Presentation on theme: "Programming for GCSE Topic 6.2: Testing T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science Queen Mary University."— Presentation transcript:

1 Programming for GCSE Topic 6.2: Testing T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science Queen Mary University of London

2 Aims Understand the idea of testing Understand ideas behind the GCSE requirements E.g. OCR Unit 3 Programming Task

3 P RINCIPLES OF T ESTING

4 Test Case A use of a program Particular input  Test Data Expected results Actual result Important programs are tested using lots of test cases

5 Test Data The values used to test a program FROM PROBLEM (not program) Valid Expected to be accepted by the program Extreme Check ‘boundaries’ Invalid Expected to be rejected

6 Boundary Values Boundaries are: x == 10 – out of range: just too small x == 11 – in range: just large enough x == 17 – in range: just small enough x == 18 – out of range: just too big if x > 10 and x <= 17 : print("Ans is", x + y) else : print("Out of range")

7 Test Plan / Evidence Shows tests and results TestDataReasonExpectedOutcome 1x = 11, y = 10x in range, y positiveAns is: 21Correct 2x = 11, y = - 5x in range, y negativeAns is: 6Correct 3x = 17, y = 20x in range, y positiveAns is: 37Correct 4x = 17, y = -20x in range, y negativeAns is: -3Correct 5x = 10, y = -1x out of rangeOut of rangeCorrect 6x = 18, y = 100x out of rangeOut of rangeCorrect

8 GCSE Syllabus – OCR Specification Use a suitable test plan and data to test functions of the system AS/A2 Similar, but more complex application

9 Teaching Issue Are industry processes relevant? Systems very complex Lots of tests … can be tedious for small scale projects When to write test plan? Link to Bugs in s/w we use; bugs in open source projects Social / ethical

10 Bug List - Example

11 E XAMPLE

12 OCR Unit 3 Task A Example Design, code and test a program to calculate the body mass index (BMI) for an adult. The program should work in metric units (kg and cm) or imperial units (stones and pounds, and feet and inches). The user should be able to choose which units. The system should output the BMI and the appropriate category from: Less than 18.5 – Underweight Between 18.5 and 25 – Normal Between 25 and 30 – Overweight Greater than 30 – Obese The formulae are: Metric: BMI = weight in Kg / (height in cm) 2 Imperial: BMI = (weight in pounds x 703) / (height in inches) 2 Incorrect! m not cm

13 Analysis Height ranges 4 ft – 7 ft 122 cm to 213 cm Weight 4st, 0lb to 30st, 0lb 25kg to 190 Kg

14 Test Data (Spreadsheet) StonePoundsFeetInchesPoundsInchesBMIUnderW?ObeseNormalOverWCMKg 5760777210.4YesNo 182.934.9 6761917312.0YesNo 185.441.3 77621057413.5YesNo 188.047.6 8757.511967.518.4YesNo 171.554.0 97571336720.8No YesNo170.260.3 107561476623.7No YesNo167.666.7 117551616526.8No Yes165.173.0 127541756430.0NoYesNo 162.679.4 137531896333.5NoYesNo 160.085.7 147522036237.1NoYesNo 157.592.1 157512176141.0NoYesNo 154.998.4 167622317429.7No Yes188.0104.8 82.656.1114.666.118.4YesNo 168.052.0 84.856.5116.866.518.6No YesNo169.053.0 811.553.0123.563.021.9No YesNo160.056.0 91.952.2127.962.223.2No YesNo158.058.0 96.351.4132.361.424.7No YesNo156.060.0 910.750.6136.760.626.1No Yes154.062.0 101.1411.8141.159.827.7No Yes152.064.0 107.7411.1147.759.129.8No Yes150.067.0 105.5410.3145.558.330.1NoYesNo 148.066.0

15 Test Plan (Incomplete) TestDataReasonExpectedResult 15ft,7in 8st,6lb Imperial In range BMI 18.5 Underweight 25ft, 4in 11st, 7lb Imperial In range BMI 30.0 Obese 3160cm, 56 Kg Metric In range BMI 21.9 Normal 4300 cm, 56 Kg Height too large N/A

16 Summary Technique and process Expected to be used


Download ppt "Programming for GCSE Topic 6.2: Testing T eaching L ondon C omputing William Marsh School of Electronic Engineering and Computer Science Queen Mary University."

Similar presentations


Ads by Google