Black box testing basics

Publisher:晴天7777Latest update time:2022-07-01 Source: csdn Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Black box testing method:

Black box testing is also called functional testing and data-driven testing. It treats the software under test as a black box that cannot be opened, and designs test cases and tests mainly based on functional requirements. Think of the product software as a black box with only an exit and an entrance. During the testing process, you only need to know what to input into the black box and what results the black box will produce.

insert image description here

The main black box testing methods include equivalence class partitioning, boundary value analysis, causal diagram, error speculation, etc., which are mainly used for software verification testing. The "black box" method focuses on the external structure of the program, does not consider the internal logical structure, and is aimed at testing the software interface and software functions. The "black box" method is an exhaustive input test. Only when all possible inputs are used as test conditions can all errors in the program be detected in this way. In fact, there are countless test cases. People should not only test all legal inputs, but also those illegal but possible inputs.


advantage:


Independent of software implementation

Test cases can be run simultaneously with software implementation

Based on the manual, you know what functions the software implements, which facilitates automated testing.

shortcoming:


Cannot cover all codes, cover conditions

Low reusability of automated tests

insert image description here

Equivalence classification method:

The principle of equivalence classification method:


Divide the input domain of the program into several parts, and then select a few representative data from each part as test cases

The role of representative data of each category in testing is equivalent to other values ​​in this category. If an example in a certain category finds an error, other examples in this equivalent category can also find the same error.

Conversely, if an example in a class does not find an error, then other examples in the class will not find an error either.

Three principles for designing test cases using the equivalence class method:


Assign a unique number to each equivalence class;

Design a new test case to cover as many valid equivalence classes as possible that have not been covered. Repeat this step until all valid equivalence classes are covered.

Design a new test case to cover only one invalid equivalence class that has not been covered yet, and repeat this step until all invalid equivalence classes are covered.

Valid equivalence classes:

It refers to a set of input data that is reasonable and meaningful for the program specification. The valid equivalence class can be used to verify whether the program has achieved the functions and performance specified in the specification. "Software Quality and Testing"


That is: comply with procedural requirements, reasonable and meaningful


Invalid equivalence class:

It refers to a set of input data that is unreasonable and meaningless to the program specification. Invalid equivalence classes can be used to verify whether the program has achieved the functions and performance specified in the specification. "Software Quality and Testing"


That is: not meeting the requirements, not reasonable and not meaningful


Design steps of equivalence partitioning method


Principles for determining equivalence classes When the input condition specifies the range of values ​​or the number of values, one valid equivalence class and two invalid equivalence classes can be established.

When the input condition specifies a set of input values ​​or a "must be" condition, a valid equivalence class and an invalid equivalence class can be established.

When the input condition is a Boolean value, one valid equivalence class and one invalid equivalence class can be determined. When a set of input data values ​​(assuming n) is specified and the program processes each input value separately, n valid equivalence classes and one invalid equivalence class can be established.

When the rules that the input data must comply with are specified, a valid equivalence class (those that comply with the rules) and several invalid equivalence classes (those that violate the rules from different perspectives) can be established.

If it is known that the elements in the equivalence class are processed differently in the program, the equivalence class should be further divided into smaller equivalence classes.

insert image description here
insert image description here

insert image description here

If a test data in an equivalence class cannot capture a defect, then selecting other test data in the equivalence class will not capture the defect; similarly, if a test data in an equivalence class can capture a defect, then selecting other data tests in the equivalence class can also capture the defect.


Note: When looking for equivalent partitions, consider grouping together the software with similar inputs, similar outputs, and similar operations. These groups are equivalent partitions.

If you over-divide equivalence classes in order to reduce the number of test cases, you run the risk of missing tests that may reveal software defects.


====================================================================


Boundary Value Analysis:

Boundary value analysis is to select test cases at the boundaries of equivalence classes. Boundary value analysis not only pays attention to the boundaries of input conditions, but also must consider the boundaries of output domains. It is a supplement to the equivalence class division method. "Software Quality and Testing"


That is: testing the input or output boundaries of the software as a supplementary test of the equivalence class partitioning method

insert image description here

A boundary value is just a specific data.

For example, a text box requires 6 to 18 characters to be entered.

The boundary values ​​are:


6 characters

18 characters

Sub-boundary. The value near the boundary, according to the unit or calculation method specified by the system, is a difference in data.

For example, a character is just one character, there is no such thing as a half character; the minimum unit of RMB amount is 0.01 yuan (1 cent), and the minimum unit of ATM withdrawals and deposits is 100 yuan, which can only be an integer multiple of 100 yuan.

## Principles for selecting boundary values:


If the input condition specifies a range of values, the value that just reaches the boundary of this range and the value that just exceeds the boundary of this range should be taken as the test input data.

If the input condition specifies the number of values, the maximum number, minimum number, number less than the minimum number by 1, and number more than the maximum number by 1 are used as test data.

According to each output condition in the specification, use the previous principle ①

Apply the previous principle ② to each output condition in the specification.

If the input or output domain given in the program specification is an ordered set, the first and last elements of the set should be selected as test cases.

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

The equivalence class partitioning method and the boundary value analysis method focus on the input conditions, without considering the various combinations of input conditions or the mutual constraints between the input conditions.


=======================================================================================


Cause and effect diagram method:

It is a test method suitable for describing multiple input condition combinations.

According to the combination of input conditions, constraint relationships and causal relationships of output conditions, various combinations of input conditions are analyzed to design test cases.

It is suitable for checking various combinations of program input conditions.

insert image description here
insert image description here

insert image description here
insert image description here

3. Constraints between results: if the result is true, it is represented by 1; if it is false, it is represented by 0.

Block. Result A will appear between the results, but result B will not appear. When you receive a successful registration notification, you will not receive a notification that the data is filled in incorrectly.


=======================================================================================


Decision table method: (decision table method)

It is a tool for analyzing and expressing situations where different operations are performed under multiple logical conditions. It consists of the following:


Condition Stub: Lists all the conditions of the problem. It is generally considered that the order in which the conditions are listed does not matter.

Action Stub: Lists the possible actions that can be taken according to the problem. There is no restriction on the order in which these actions can be arranged.

Condition Entry: Lists the possible values ​​for the condition to its left. True or false values ​​in all possible cases.

Action Entry: Lists the actions that should be taken under various conditions.

insert image description here

Application scenarios: Mainly suitable for multi-condition content combination and result analysis.

Composition: It consists of four parts: condition item, action item, condition pile and action pile.

Conditions of use: The positions and order of all condition piles in the table do not affect each other; the order of all action piles will not be different due to the specialization of spare parts order.


insert image description here
insert image description here
insert image description here
insert image description here

insert image description here

=======================================================================================


Orthogonal experimental design method:

insert image description here
insert image description here

Basic idea:


In an experiment, the amount that affects the test results is called the test factor, or simply factor. During the experiment, each factor can be in different states or conditions. The state or condition of the factor is called the level of the factor, or simply level.

The number of different numbers in each column is equal. This feature indicates that the probability of each level of each factor participating in the experiment is exactly the same as that of each level of other factors, which can effectively compare the test results and find the optimal test conditions.

[1] [2]
Reference address:Black box testing basics

Previous article:Some basic testing methods
Next article:Performance testing, load testing, stress testing, stability testing

Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号