Test Case Design Whitepaper--Boundary value analysis method

Source: Internet
Author: User

I. Introduction to the methodology
1. Definition: Boundary value analysis method is a black box test method to test the boundary value of input or output. The boundary value analysis method is usually used as a supplement to the equivalence class partitioning method, in which case the test case comes from the boundary of the equivalence class.

2. Difference from equivalence division
1) Boundary value analysis does not pick one of the equivalence classes as a representation, but makes each boundary of the equivalence Class A test condition.
2) The boundary value analysis not only considers the input conditions, but also considers the test conditions produced by the output space.

3. Considerations for Boundary value analysis methods:
Long-term testing experience tells us that a large number of errors occur on the boundary of the input or output range, not on the inside of the input and output range. Therefore, to design test cases for various boundary conditions, more errors can be detected.
Using the Boundary value analysis method to design test cases, the boundary condition should be determined first. Usually the boundary of the input and output equivalence classes is the boundary condition where the test should be emphasized. Instead of picking a typical or arbitrary value in an equivalence class as test data, you should select a value that is exactly equal to, just above or below the boundary as the test data.

4. Common boundary values
1) for integers of 16-bit, 32767 and-32768 are boundaries.
2) on-screen cursor on the top left and right bottom position
3) First and last line of the report
4) The first and last of the array elements
5) Cycle of the No. 0, 1th and penultimate 2nd, last time

5. Boundary value Analysis
  1) Boundary value analysis uses the same division as the equivalence class partitioning method, except that the boundary value analysis assumes that errors exist more on the boundary of the Division, Therefore, the test cases are designed on the boundary of the equivalence class and on both sides of the case.
    Example: a function to test the square root
       --Input: Real number
        -Output: Real number
       -specification: Returns the positive square root when entering a 0 or greater than 0 When entering a number less than 0, the error message "Square root illegal-input value is less than 0" and return 0; The library function print-line can be used to output error messages.
        
  2) equivalence class partitioning:
    I. The following can be considered:
      A, input (i) <0 and (ii) >=0
      B, Output (a) >=0 and (b) error< br>    Ii. There are two test cases:
      A, input 4, Output 2. Corresponds to (ii) and (a).
      B, input-10, output 0, and error prompt. Corresponds to (i) and (b).

3) Boundary value analysis:
The boundary of the Division (ii) is 0 and the maximum positive real number; the boundary dividing (i) is the least negative real number and 0. This leads to the following test cases:
A, enter {minimum negative real number}
B. Enter {a negative number with a small absolute value}
C, input 0
D, enter a positive number with a small absolute value}
E, enter {maximum positive real number}

4) Typically, software tests contain several types of boundary tests: numbers, characters, positions, weights, sizes, speeds, orientations, dimensions, spaces, and so on.
5) Accordingly, the above types of boundary values should be: Max/min, first/last, up/down, fastest/slowest, highest/lowest, shortest/longest, empty/full, etc.
6) using boundary values as test data

item boundary value design ideas for test cases
character start-1 characters/end + 1 characters Suppose a text input area allows input of 1 to 255 characters, input 1 and 255 characters as valid equivalence classes, and enter 0 and 256 characters as invalid equivalence classes, these values are all boundary condition values.
min -1/maximum +1 Assuming that the data entry field for a software requires a 5-bit data value , you can use 10000 as the minimum value, 99999 as the maximum value, and then use a numeric value that is exactly less than 5 bits and greater than 5 bits as the boundary condition.
space less than free space/greater than full space a point For example, when storing data with a USB stick, use the remaining The remaining disk space is a bit larger (a few kilobytes) of the file as a boundary condition.


7) Internal boundary value analysis:
In most cases, boundary value conditions are factors that need to be considered based on the design of the application's functionality, which can be obtained from the specification or common sense of the software, and that the end user can easily identify the problem. However, in the test case design process, some boundary value conditions do not need to be presented to the user, or the user is very difficult to notice, but at the same time it does belong to the boundary conditions in the test category, called internal boundary value conditions or sub-boundary value conditions.
The internal boundary value condition has the following main types:
A) The value of the boundary value test: The computer is based on binary work, therefore, any numerical operation of the software has a certain range of limitations.

< strong> range or value
0 or 1
Byte (byte) 0 ~ 255
0~65535 (word) or 0~4294967295 (double word)
1024
Mega (M) 1048576
Kat (G) 1073741824

b) Character boundary value test: In computer software, characters are also important representation elements, where ASCII and Unicode are common encoding methods. The ASCII code values for some characters commonly used characters are listed in the following table.

Character ASCII Code Value Character ASCII Code Value
Null (NULL) 0 A 65
Spaces (space) 32 A 97
Slash (/) 47 Z 90
0 48 Z 122
Colon (:) 58 Single quotation mark (') 96
@ 64


c) Other boundary value test

6. The principle of selecting test cases based on the boundary value analysis method
1) If the input condition specifies the range of values, then the value of the boundary that has just reached this range should be taken, as well as the value just beyond the bounds of this range as the test input data.
For example, if the specification of the program stipulates that: "Mail in the range of 10 kg to 50 kg, the postage calculation formula is ...". As a test case, we should take 10 and 50, we should also take 10.01,49.99,9.99 and 50.01 and so on.
2) If the input conditions specify the number of values, then the maximum number, the minimum number, less than the minimum number of one, than the maximum number of Taichi as the test data.
For example, if an input file should include 1~255 records, the test case would be 1 and 255, and 0 and 256 should be taken.
3) Apply rules 1 and 2) to the output condition, that is, to design the test case so that the output value reaches the boundary value and its left and right values.
For example, the specification of a program requires the calculation of a "monthly premium deduction of 0 to 1165.25 yuan", the test case is 0.00 and 1165.24, it is also desirable to 0.01 and 1165. 26 and so on.
Another case is that the program belongs to the information retrieval system, requiring that each "display at least 1, a maximum of 4 intelligence summaries", then we should consider the test cases include 1 and 4, also should include 0 and 5 and so on.
4) If the program's specification indicates that the input field or output field is an ordered set, then the first and last element of the collection should be selected as the test case.
5) If an internal data structure is used in the program, the value on the boundary of the internal data structure should be selected as the test case.
6) Analyze specifications and identify other possible boundary conditions.

Two. Combat Drills
1. A student standardized examination of a Test paper, the process of producing a report of achievement. The specifications are as follows: The input file for the program consists of some 80-character records, as shown in the figure on the right, and all the records are divided into 3 groups:


① title: This group has only one record, and its content is the name of the output score report.
② test questions: Each record is marked with the number "2" in the 80th character. The 1th to 3rd characters of the first record of the group are the topic number (value 11,999). The 10th to 59th characters give the answer to the 1th to 50th question (each legal character represents an answer). The 2nd and 3rd of the group ... The records correspond to 51st to 100th, 101th to 150th, ... The answer to the question.
③ Each student's answer description: The 80th character of each record in the group is the number "3". Each student's answer sheet is given in a number of records. If the first record of a 1th to 9th character gives the student's name and school number, the 10th to 59th character lists the answer to the 1th to 50th question. If the number of questions exceeds 50, the 2nd, 3rd ... The records give his 51st to 100th, 101th to 150th, respectively. The answer to the question. Then is the student B's answer record.
The number of ④ students is not more than 200 and the number of questions is not more than 999.
The output of the ⑤ program has 4 reports:
A) List of transcripts according to the number of students, lists each student's achievements, rankings.
b) transcripts sorted by student's grade.
c) Reports of average scores and standard deviations.
d) Test paper Analysis report. Sort by question number to list the percentage of students who answered the questions correctly.
Solution: Consider the input and output conditions respectively, as well as the boundary conditions. Give the input criteria shown in the table below and the corresponding test cases.


The output condition and the corresponding test case table.

Reprint: http://blog.csdn.net/vincetest/article/details/1475502

Test Case Design Whitepaper--Boundary value analysis method

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.