Software development, law and ethics · A level · OCR H446 1.2.3, AQA 7517 4.13.1.4, Eduqas A500QS 1.7 · about 45 min
Black box and white box testing, alpha, beta and acceptance testing, destructive testing, and a black box test plan that finds two bugs.
[1 mark]What is black box testing?
[1 mark]A game is released to a limited group of players outside the company to find problems before the full launch. What is this?
[1 mark]A speed is allowed from 10 up to but not including 40. Which set is boundary data?
[1 mark]What is the purpose of acceptance testing?
[1 mark]What does this white box coverage check print?
ran = set()
def speed_for(gap):
if gap < 10:
ran.add("stop")
return 0
elif gap < 40:
ran.add("slow")
return 30
ran.add("fast")
return 60
for gap in [5, 20, 30]:
speed_for(gap)
print(len(ran), sorted(ran))[1 mark]Why is testing described as showing the presence of errors but not their absence?
A teammate has written speed_for(gap). Its specification is:
- gap is a distance in cm, and should be an int or a float.
- If gap is not a number, or is less than 0, it must raise ValueError.
- Otherwise it returns 0 if gap is less than 10, 30 if gap is from 10 up to but not including 40, and 60 if gap is 40 or more.
Do not change speed_for: your job is to test it from the specification. Make a list tests of tuples (value, expected, kind), where expected is the number the specification says, or the string "error" if it should raise ValueError, and kind is "normal", "boundary" or "erroneous". Include at least two normal tests, the four boundary values 9, 10, 39 and 40, and the erroneous values "far" and -5.
Run each test, treating a ValueError as the result "error". For each, print <value!r> <kind>: pass if the result matches, or <value!r> <kind>: FAIL (got <result>) if it does not, where <value!r> is the value as repr shows it (so the string appears as 'far'). At the end print failed: <n>. The robot stays still.
# the two lines every program starts with: the commands, then the robot
from bugbot import *
connect()
def speed_for(gap):
if not isinstance(gap, (int, float)):
raise ValueError("gap must be a number")
if gap < 10:
return 0
elif gap <= 40:
return 30
else:
return 60
tests = []Plan your program here, then type it in and press Run.
speed_for, run the tests again, and check they all pass. What is this kind of re-testing called?