Test-related Comprehension (iii)-Boundary value analysis method

Source: Internet
Author: User

1. Boundary Value Analysis:
Long-term testing experience tells us that a large number of errors occur on the boundary of the input or output range, rather than on the inside of the input and output range. Therefore, to design test cases for various boundary conditions, more errors can be detected.

The 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.

From the overall point of view can be divided into unit testing, integration testing, system testing, validation testing.

Unit Test: It is the minimum Unit-program module for software design, and the test work of correctness inspection. General includes logic check, structure check, interface check, error handling, code comment, input checksum, boundary value check.

Therefore, the boundary value test belongs to the unit test, also belongs to the black box test.

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) 32767 and -32768 are boundaries for 16-bit integers
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 0 , 1 and penultimate 2 , last

5.Boundary value Analysis
1)Boundary value analysis uses the same partitioning as equivalence class partitioning, except that boundary value analysis assumes that errors exist more on the boundary of the division, so 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: When entering a0or more than0When a large number is returned, it returns its positive square root; When the input is less than0the error message is displayed when the number of"illegal square root-input value is less than0 "and returns0; library functionsPrint-linecan be used to output error messages.

2)equivalence class Partitioning:
I.It may be considered that the following divisions are made:
A, input(i) <0and the(ii) >=0
B, Output(a) >=0and the(b) Error
Ii.There are two of test cases:
A, input4, the output2. Corresponds to(ii)and the(a).
B, input-10, the output0and error hints. Corresponds to(i)and the(b).

3)Boundary value Analysis:
Divide(ii)the boundary is0and maximum positive real numbers;(i)the boundary is the least negative real number and0. This leads to the following test cases:
A, input{minimum negative real number}
B, input{a negative number with a small absolute value}
C, input0
D, input{a positive number with a small absolute value}
E, input{maximum positive real number}

4)Typically, software tests contain several types of boundary tests: numbers, characters, positions, weights, sizes, velocities, orientations, dimensions, spaces, and so on.
5)Accordingly, the boundary values for the above types should be: Maximum/smallest, first/last, Upper/The Next, fastest/the slowest, the highest/Minimum,  Shortest/the longest, the empty/the full and other conditions.
6)using boundary values as test data

Item

Boundary value

Design ideas of test cases

character

start -1 characters / end Span style= "Font-family:verdana" >+1 characters

Suppose a text input area allows input 1 to 255   characters, input 1 255 characters as valid equivalence class; Enter 0 256

Value

min -1/ max +1

Assume that the data entry field for a software requires input 5 10000 As the minimum, 99999 as the maximum, and then use exactly less than 5 bit and greater than 5

Space

Less than the free space a little / more than a full space

For example , when storing data with a U-disk, use a file that is a bit larger than the remaining disk space (a few kilobytes) 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.

Item

Range or value

Bit (bit)

0 or 1

Byte (byte)

0--225

Word (word)

0~65535(Word) or 0~4294967295(double word)

Thousand (K)

1024

Trillion (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

Cother boundary value tests

6.the principle of selecting test cases based on boundary value analysis method
1)If the input condition specifies the range of values,you should take the value of the boundary that just reached this range,and the value just beyond the bounds of this range as the test input data.
For example, if the program's specification specifies:"Weight inTenkg to -kilograms within the range of mail, the postage calculation formula for... ". As a test case, we should takeTenand -, you should also take10.01,49.99,9.99and50.01and so on.
2)If the input condition specifies the number of values,Use the maximum number of,Minimum number,one less than the smallest number,the number of Taichi than the maximum number as the test data.
For example, an input file should include1~255record, the test case is preferable1and the255, you should also take0and theand so on.
3)the rule1) and2applies 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"the monthly insurance deduction amount is0to1165.25Yuan", its test cases are preferable0.00and1165.24, it is also desirable that a0.01and1165. -and so on.
as if the program belongs to the information retrieval system, requiring each"Minimum Display1bar, maximum display4Summary of Information on the article", the test cases that we should consider include1and the4, it should also include0and the5and so on.
4)if the program's specification indicates that the input field or output field is an ordered set,You should select the first and last element of the collection as the test case.
5)if an internal data structure is used in the program,You should select the value on the boundary of this internal data structure as the test case.
6)Analysis Specification Description,find out the other possible boundary conditions.

Organized from: Http://wenku.baidu.com/link?url=Imbbw7qub1BgIzKa6zTyNmRkxDJrsTR3kXsyumQTajIRTtf_B7Zv2N-w3U-bEYQWNHSIy_ 0d5ihzl3ma_rhravkwvahpjwsrob_1d2bopxo

Test-related Comprehension (iii)-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.