Boundary value analysis method:

Internal boundary value analysis:

In most cases, boundary value conditions are factors that need to be considered based on the functional design of the application, can be derived from software specifications or common sense, and can be easily identified by the end user. However, in the process of test case design, some boundary value conditions do not need to be presented to users, or it is difficult for users to notice, but they do belong to the scope of testing boundary conditions, called internal boundary value conditions or sub-boundary value conditions.

The internal boundary value conditions are mainly as follows:

A) Boundary value testing of numerical values: Computers work on the basis of binary, so any numerical operation of software has a certain range.

B) Character boundary value test: in computer software, characters are also very important representation elements, among which ASCII and Unicode are common encoding methods. The following table lists the ASCII code values for some common characters.

The principle of selecting test cases based on boundary value analysis method

1) If the input conditions specify a range of values, the values that have just reached the boundary of this range and those that have just exceeded the boundary of this range should be taken as the test input data.

For example, if the program specification states: “For mail items weighing between 10 kilograms and 50 kilograms, postage will be calculated by…” . For test cases, we should take 10 and 50, as well as 10.01,49.99,9.99, 50.01, etc.

2) If the input condition specifies the number of values, use the maximum number, the minimum number, the number less than the minimum number, and the number more than the maximum number as the test data.

For example, if an input file should contain 1 to 255 records, the test case should take 1 and 255, 0 and 256, and so on.

3) Apply rules 1) and 2) to the output conditions, that is, design test cases so that the output values reach the boundary values and their adjacent values.

For example, if the specification of a program calls for calculating “monthly insurance deductible amounts of \$0 to \$1165.25,” the test cases may be 0.00 and \$1165.24, or 1 0.01 and \$1165.26, etc.

If the program belongs to the information retrieval system and requires “at least 1 and at most 4 information summaries” to be displayed each time, the test cases we should consider include 1 and 4, and 0 and 5, etc.

4) If the program specification gives an ordered set of input fields or output fields, the first and last elements of the set should be selected as test cases.

5) If an internal data structure is used in the program, the values on the boundary of the internal data structure should be selected as test cases.

6) Analyze specifications to find other possible boundary conditions.

Second, actual combat exercises

1. There is a procedure for students to mark standardized tests and produce scores reports. The specification is as follows: The program’s input file consists of a number of 80-character records, as shown on the right, all of which are divided into three groups:

This group has only one record, which contains the name of the output grade report.

② The standard answer record of each question in the test paper: each record is marked with the number “2” at the 80th character. The first to third characters of the first record in this group are the subject numbers (values 1 to 999). Characters 10 to 59 give the answers to questions 1 to 50 (each legal character represents an answer). Second, third in the group… The corresponding records are 51st to 100, 101st to 150,… The answer to the question.

③ The 80th character of each record in this group is the number “3”. Each student’s answer paper is given in several records. For example, characters 1 to 9 in the first record of A give the student’s name and student number, and characters 10 to 59 list the answers to questions 1 to 50. If the number of questions is more than 50, then 2, 3… The records give him 51st to 100th, 101st to 150th… The solution to the problem. And then student B’s answer sheet.

④ The number of students should not exceed 200, and the number of questions should not exceed 999.

⑤ The output of the program has four reports:

A) A transcript arranged according to student numbers, listing the grades and ranking of each student.

B) Transcripts sorted by students’ grades.

C) Report of average score and standard deviation.

D) Test analysis report. List the percentage of students who answered each question correctly in order of question number.

Solution: Consider input and output conditions, and boundary conditions respectively. Give the input conditions and corresponding test cases as shown in the following table.

Output conditions and corresponding table of test cases.

2. Boundary value analysis test case of triangle problem

In the description of triangle problem, there are no other restrictions except that the side length is required to be an integer. Here, we set the range of the length of each side of the triangle as [1, 100].

3. Boundary value analysis test case of NextDate Function In NextDate function, the value range of variable mouth and variable day is implicitly defined as 1≤ MOUTH ≤12 and 1≤ Day ≤31, and the value range of variable year is set as 1912≤ Year ≤2050.