Validation, Verification and Testing: Question 7

Syllabus 7.5

Structured 6 marks

An online plant nursery's order form validates two fields before an order can be placed.

(a) OrderCode must consist of exactly 2 uppercase letters followed by exactly 4 digits (for example, "RS1024"). Identify the validation check used to test this rule, give an example of an OrderCode that this check would reject, and explain why it is rejected. [3]

(b) Quantity must be a whole number from 1 to 50 inclusive, customers cannot order zero or a negative number of plants, and the nursery's delivery van cannot carry more than 50 plants in a single order. Identify the validation check used to test this rule, give an example of a Quantity value that this check would reject, and explain why it is rejected. [3]

Show worked solution Hide worked solution

Worked solution

Part (a): Format check

The rule for OrderCode describes an exact arrangement of characters, 2 letters, then 4 digits, in that specific order, rather than a simple count of characters or a numeric limit. Testing data against a required pattern or layout like this is a format check.

"RS102" starts correctly with 2 uppercase letters, RS, but only 102 follows, just 3 digits instead of the 4 required. Since it does not match the 2-letters-then-4-digits pattern, the format check rejects it. [3 marks]: [1] for naming the format check, [1] for a rejected example that genuinely breaks the pattern, [1] for correctly explaining which part of the pattern is broken.

Part (b): Range check

The rule for Quantity gives an upper limit (50, the van’s carrying capacity) and a lower limit (1, since an order cannot be for zero or a negative number of plants). Testing a numeric value against an upper and lower limit like this is a range check.

A Quantity of 0 falls below the minimum accepted value of 1, so the range check rejects it, a customer cannot place an order for zero plants. (A value such as 75 would equally be rejected, for exceeding the maximum of 50.) [3 marks]: [1] for naming the range check, [1] for a rejected example genuinely outside 1 to 50, [1] for correctly explaining why it falls outside the accepted range.

Final answers

  • (a) Format check. “RS102” is rejected because only 3 digits follow the 2 letters, not 4.
  • (b) Range check. 0 is rejected because it is below the minimum accepted Quantity of 1.