3.2.11 - Test data and program refinement (VB.NET)

3.2.11 - Test data and program refinement (VB.NET)

Choose justified tests, compare expected and actual behaviour, then refine a VB.NET program. Native answers are written without Run; the optional Python demonstration supplies an observable boundary fault.

Testing against expected behavior

Testing applies chosen data to an algorithm or program and compares its actual behaviour with an expected result derived from the requirements.

Test data

Input values deliberately chosen to check whether a program behaves as specified.

A booking program accepts integer quantities from 1 to 10 inclusive. Before execution, derive the expected decision for each chosen input. A test record should contain input, purpose, expected result, actual result and pass/fail. A screenshot of a program producing some output is insufficient if no expected result has been defined.

Tests can reveal faults but a few successful tests cannot prove the whole program correct. A normal mid-range value might pass even if the lower boundary is wrong. A calculation must be checked against independently calculated answers, rather than taking the program's result as the expected answer.

Practical work involves designing, writing, testing and refining programs. These learning activities provide practice; they do not certify a school's practical-programming statement and are not an assessed NEA project.

Normal, boundary and erroneous data

Different categories of test data target different ways a program can fail.

Normal data is typical valid input, such as quantity 5. Boundary data checks the edges of acceptance, including immediately inside and outside each edge. Erroneous data should be rejected because it does not meet the requirements, such as quantity 25. In this task input is assumed to be integer text; implementing data-type checks is not required.

InputCategory/purposeExpected decision
5Normal, representative valid bookingAccept
0Boundary, just below the minimumReject
1Boundary, lowest allowed valueAccept
10Boundary, highest allowed valueAccept
11Boundary, just above the maximumReject
25Erroneous, well outside the rangeReject

AQA's boundary set for 1–10 is 0, 1, 10, 11. A just-outside boundary value is also erroneous; the categories can overlap. The important explanation is what that value tests. “Checks the lower accepted boundary” justifies 1 specifically; “checks the program” does not.

For a minimum string length 8, test lengths 7 and 8; length 12 can provide a normal valid case, and empty text an erroneous case. Do not invent an upper-length boundary where the requirements have none. For authentication, include both correct credentials, correct username/wrong password, and wrong username/correct password, so a mistaken Or condition is exposed.

Continue this lesson.

You’re previewing NovaLearn without an account. Create a free account to read the rest.

Create free account