Extending from black-box testing to equivalence class partitioning method

Source: Internet
Author: User

One, black box test

Not much to say, first on the definition of black box test: Black box test is also called functional testing, it is tested to detect whether each function can be used properly. In the test, the program as a black box can not be opened, regardless of the internal structure of the program and internal characteristics of the case, in the program interface testing, it only checks whether the program function in accordance with the requirements of the specification of the normal use, the program can properly receive input data and produce the correct output information. Black box testing focuses on the external structure of the program, regardless of the internal logical structure, mainly for the software interface and software function testing.

In fact, the lengthy paragraph above summed up on a meaning: is the test software, do not control the software inside exactly how to write, there is no error, layout and typesetting has no problem, the test staff began to try to request the input as far as possible to try to see if the results are not a problem, a fool can do the work.

Since this is the case, short, less function of the program may let the tester test one afternoon, but the program is very large, the output is 1 to 100 million, but also can try it, of course, not, and therefore introduced a simplified black box test method, the following is to be introduced.

Second, equivalence class division

Equivalence class partitioning solves the problem of how to select the appropriate subset of data to represent the entire data set, by reducing the number of tests to achieve "reasonable" coverage, and covering more potential data to discover more software defects.

The introduction of this brief and concise, optimization, has been the main theme of human progress, in the optimization of black box testing, is to choose the appropriate subset of data to replace the whole, on the probability theory this is a sample survey.

Since it is a sample survey, not, is to choose the appropriate subset of data, then the question came, how to choose?

Come, first understand what is the equivalence class, since the equivalence, is basically not too big difference, when testing, from a no big difference in the equivalence class to choose a test can represent the entire equivalence class.

What are the equivalence classes, which can be broadly divided into valid equivalence classes and invalid equivalence classes.

Defined on:

1 Valid equivalence classes

Refers to a set of input data that is reasonable and meaningful for the specification of a program. The effective equivalence class can be used to verify whether the program implements the functions and performance specified in the specification.

2 Invalid equivalence class

The definition of a valid equivalence class happens to be the opposite. An invalid equivalence class refers to a set of input data that is unreasonable or meaningless for a program's specification.   For a specific problem, the invalid equivalence class should have at least one or more. When designing test cases, consider both of these equivalence classes. Because the software is not only able to receive reasonable data, but also to withstand the unexpected test, such testing to ensure that the software has a higher reliability.

In simple terms, the effective equivalence class is functionally required, and the invalid equivalence class is an unexpected condition.

There are many ways to divide equivalence classes, not to mention them, because this is not my focus, for example, we understand.

Students can choose between four and seven classes, which is an interval, and four to seven integers become valid equivalence classes, and any other number is an invalid equivalence class, and this example is divided by interval.

Well, since already began to divide, then how exactly test, before I also confused, know I saw a last year's blog, an example deeply touched me, I think that in addition to humor, and can not explain more clearly than the original author, hereby reproduced one of the examples, thank the predecessor.

above example:

A procedure stipulates: "Input three integers a, B, c as the three sides of the side length of the triangle." The type of triangle formed by the program is determined, and when the triangle is a general triangle, isosceles triangle and equilateral triangle, the calculation is made separately ... "。 The equivalent class partitioning method is used to design the test case for the program. (The complexity of the triangle problem is that the relationship between the input and the output is complex.) )

The requirements for the input conditions are given and implied in the analysis topic:

(1) integers (2) three numbers (3) Non-zero (4) positive (5) The sum of the two sides is greater than the third side (6) isosceles (7) equilateral

If a, B, and C meet the conditions (1) ~ (4), output one of the following four cases:

1) If the condition (5) is not met, the program output is "non-triangular".

2) if the condition (7) is satisfied if the three edges are equal, the program output is "equilateral triangle".

3) If only two edges are equal, that is, the condition (6) is satisfied, the program output is "isosceles triangle".

4) If the three edges are not equal, the program output is "General triangle".

List and number of equivalence class tables

Test cases that cover valid equivalence classes:

A b C overrides the equivalence class number

3 4 5 (1)--(7)

4 4 5 (1)--(7), (8)

4 5 5 (1)--(7), (9)

5 4 5 (1)--(7), (10)

4 4 4 (1)--(7), (11)

Test cases that override the invalid equivalence class:

Success, everything, there should be applause, applause.

To this predecessor ~

Extending from black-box testing to equivalence class partitioning 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.