Black box testing-Test Case Design Method

Source: Internet
Author: User

Black box testing test case design methods include: equivalence classification, Boundary Value Division, cause and error analysis,

The white-box test case design methods include statement coverage, decision coverage, condition coverage, decision/condition coverage, and multiple condition coverage.

Here, we mainly discuss the design of testing cases for black box testing.

I. Division of equivalence classes
The Design Method of Equivalent column partitioning is to divide all possible input data into several parts (subsets), and then select a small amount of representative data from each subset as a test case, testing the representative value of an equivalence class is equal to testing other values of this type.
There are two steps to design a test case using the equivalence classification method: (1) determining the equivalence class; (2) generating a test case.
1. Divide equivalence classes
Equivalence classes are divided into two different situations: Valid equivalence classes represent valid input to programs and invalid equivalence classes represent incorrect input values. These two equivalence classes should be considered at the same time during design. The principles for determining equivalence classes are as follows:
(1) When the input conditions specify the value range, an effective equivalence class (within the value range) and two invalid equivalence classes (less than the value range and greater than the value range) can be established ). For example, if the length of the text message must be within 70 characters when you use a mobile phone to send a text message, the valid equivalence category is as follows: the text message content length is 0, and the text message content length is greater than 70.
(2) When the input condition specifies the number of values, a valid equivalence class can be established (within the range of values) and two invalid equivalence classes (less than the number of values and greater than the number of values ). For example, if one or five courses can be selected for a student in one semester, the valid equivalence class is: 1 <= student elective course <= 5, and the invalid equivalence class is: no electives or electives are larger than 5.
(3) When the input condition specifies the set of input values, a valid equivalence class and an invalid equivalence class can be established. For example, the valid equivalence class is: the SMS code is 0, 3, 4, 8, 15, or 16. The invalid equivalence class is that the SMS code is not 0, 3, 4, 8, 15, or 16, either of them.
(4) An effective equivalence class and an invalid equivalence class can be established when the input condition specifies the "what must be done" condition. For example, if a variable name starts with an uppercase letter, the valid equivalence class is: the variable name starts with an uppercase letter, and the invalid equivalence class is: the variable starts with a non-answer letter.
(5) When the input condition is a Boolean value, a valid equivalence class and an invalid equivalence class can be established. For example, if the user is allowed to send text messages when the mobile phone number is successfully precharged, the valid equivalence category is: shenzhouxing's pre-deduction is successful, and the invalid equivalence category is shenzhouxing's pre-deduction failure.
(6) When a set of values (n) of the input data are specified, and the program processes each input value separately, you can establish n valid equivalence classes and an invalid equivalence class.
(7) A valid equivalence class (compliant with rules) and several invalid equivalence classes (violation of rules from different angles) can be established when rules are required for the input data ).
(8) When we know that the elements in the divided equivalence classes are in different ways in program processing, we should further divide the elements into smaller equivalence classes.

2. Generate Test Cases
After an equivalence class is established, an equivalence class table can be created to list all the divided equivalence classes. The process is as follows:
(1) specify a unique number for each equivalence class.
(2) design a new test case to cover as many valid equivalence classes as possible and repeat this step until all valid equivalence classes are overwritten.
(3) design a new test case so that it only overwrites an unoverwritten invalid equivalence class. Repeat this step until all invalid equivalence classes are overwritten.

Ii. Boundary Value Analysis
A boundary condition indicates that the input and input equivalence classes are in a boundary, exceeded, or smaller than the boundary. To design a test case using the boundary value analysis method, determine the boundary condition first, then, select the value equal to, just greater than, or just less than the boundary value as the test data.
The principle of selecting test cases based on the boundary value analysis method is as follows:
(1) If the input conditions specify the range of values, a valid test case should be designed based on the boundary value that has just reached the range, and the boundary value that has just exceeded this range as an invalid test case. For example, if the valid length of the text message content is less than 70 Chinese characters, the valid test case is: Text message content length is 1, text message content length is 70 Chinese characters, invalid test case: the text message content length is 0, and the text message content length is 71 Chinese characters.
(2) If the input conditions specify the number of values, take the maximum number, minimum number, one less than the minimum number, and one more than the maximum number as the test input data. For example, the valid SMS code is 1 ~ 255, take 0, 1, 255, 256 to design the Boundary Value test case.
(3) use the previous Principle 1 according to each output condition in the Specification Description.
(4) use the previous Principle 2 according to each output condition in the Specification Description.
(5) If the input or output of a program is an ordered set, select the first element and the last element of the set to design the test case.
(6) If an internal data structure is used in the program, select the value on the internal data structure boundary to design the test case.
(7) analyze the specification to identify other possible boundary conditions.

Iii. Causal Method
The factorization method is a test case design method that describes the combination of multiple conditions and generates multiple actions accordingly.
To generate a test case using the reason:
(1) break down the specification into executable fragments.
(2) determine the causal relationship in the specification. Analyze the reason and result in the Software Specification Description, and assign an identifier to each reason and result.
(3) analyze the meaning of the description of the Software specification, identify the relationship between the cause and the result, the cause and the reason, and convert it into a factor.
(4) Add the annotation symbol on the cause and use some marks to indicate constraints or restrictions.
(5) track the status changes in the graph and convert the causal indicator into a discriminant table.
(6) use each column in the decision table as a basis to design test cases.
Iv. incorrect estimation
The error inference method is to infer all possible errors in the program based on experience and intuition, so as to design the test case accordingly.
The basic idea of the error inference method is to list all possible errors and error-prone lists in the program, and design test cases according to the list; another idea is to design test cases by reading the specifications that are easily ignored by programmers.
The error inference method is a very effective test case design method, which requires testers to have a wealth of test experience and be very familiar with business processing. For example, when a text message is sent, if the recipient's gateway does not respond after the message is sent, the response times out, or no response status report is returned, what should the program do?

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.