[Tool] Black box testing Test Case Design Method

Source: Internet
Author: User

Currently, there are five testing cases for black box testing:

Division of equivalence classes

Boundary Value Analysis

Error Prediction Method

Cause

Function Diagram

I. Division of equivalence classes

The equivalent column partitioning design method is to divide all possible input data, that is, the input fields of the program into several parts (subsets ), then, select a small amount of representative data from each subset as the test case.

An equivalence class is a subset of an input field. In this subset, each input data is equivalent to exposing errors in the program. It is reasonably assumed that the representative value of an equivalence class is equal to the test of other values of this type.

There are two different equivalence classes: Valid equivalence classes and invalid equivalence classes. These two equivalence classes should be considered at the same time during design.

The following six principles for determining equivalence classes are given:

When the input condition specifies the value range or number of values, a valid equivalence class and two invalid equivalence classes can be established.

An effective equivalence class and an invalid equivalence class can be established when the input condition specifies the set of input values or the condition that specifies "what must be done.

When the input condition is a Boolean value, a valid equivalence class and an invalid equivalence class can be established.

If you specify a set of values (N values) for the input data and the program processes each input value separately, you can establish n valid equivalence classes and an invalid equivalence class.

A valid equivalence class (compliant with the rules) and several invalid equivalence classes (violation of rules from different perspectives) can be established when rules are required for the input data ).

When we know that each element in a divided equivalence class has different processing methods, we should further divide the element into smaller equivalence classes.

After an equivalence class is established, an equivalence class table can be created to list all the specified equivalence classes. Then

Test Cases are designed based on the following three principles in the equivalence class:

Specify a unique number for each equivalence class

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.

Design a new test case to cover only one unoverwritten invalid equivalence class. Repeat this step until all invalid equivalence classes are overwritten.

For example, the program stipulates that three integers are input to form a triangle as the side length of the three sides. When this triangle is a normal triangle, an isosceles triangle, or an equedan triangle, the calculation is performed respectively. Use the equivalence classification method to design test cases for the program.

Solution: Set A, B, and C to represent the three sides of the triangle.

1) analyze the and implicit requirements for input conditions in the question:

A) Integer

B) 3 Numbers

C) non-zero number

D) positive number

E) the sum of the two sides is greater than the third side.

F) equal waist

G) equal edge

2) List and number the equivalence table

3) list the test cases that cover the equivalence classes described above, as shown in the following table:

Ii. Boundary Value Analysis

Use the Boundary Value Analysis Method to Design test cases. First, determine the boundary. Generally, the boundary of the input and output equivalence classes is the boundary that should be tested. Secondly, we should select a value equal to, just greater than, or just less than the boundary value as the test data, rather than a typical value or any value in the equivalence class as the test data.

The principle of selecting test cases based on the boundary value analysis method is as follows:

If the input condition specifies the range of values, take the boundary value that has just reached the range and the value that has just exceeded the range boundary as the test input data.

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

Use the previous Principle 1 according to each output condition in the Specification Description.

Use principle 2 above for each output condition in the Specification Description.

If the input or output fields in the program specification are ordered sets, the first and last elements of the set should be selected as the test case data.

If an internal data structure is used in the program, select the value on the boundary of the internal data structure as the test case.

Analyze the specifications to find other possible boundary conditions.

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

Basic Idea: list all possible errors and special circumstances that are prone to errors in the program, and select test cases based on them. For example, if the input and output data are 0.

For example, there is a procedure in which students can pass the standardized examination and generate a score report. The specification is described as follows: the input file of the program consists of 80 characters, and all the records are divided into three groups,

1. Title: there is only one record for the reorganization, whose content is the name of the score report.

2. Standard answer to each question: each record is marked with a number 2 at a length of 80th characters. Records of this group:

First Record: 1st ~ The three characters are the number of questions (1 ~ 999 ). 10th ~ 59 characters are 1 ~ Standard answer for 50 questions (each valid character represents an answer ).

Second Record: 51st ~ The standard answer to question 100.

.......

3. Student's answer: each record is marked with a number 3 at 80th characters. The answers of each student are given in several records.

Student ID: 1 ~ 9 Characters

1 ~ Answer to 50 questions: 10 ~ 59. When there are more than 50 questions, in the second, third ,...... Records.

The number of students cannot exceed 200, and the number of questions cannot exceed 999.

The program outputs four reports:

A) list the scores and rankings of each student by student ID.

B) transcript sorted by student score.

C) Report on average score and standard deviation

D) Question Analysis Report. Sort by question number to list the percentage of students correct each question.

Solution 1: Use the boundary value analysis method to analyze and design test cases. The input and output conditions and boundary conditions are considered respectively. The following table lists the input conditions and corresponding test cases.

The following table lists the output conditions and corresponding test cases.

Solution 2: Some test cases can be designed using the error inference method:

Does the program use spaces as the answer?

Mixing standard answer records in answer records

In addition to the title record, there are some records whose last character is neither 2 nor 3.

Two students have the same student ID.

The number of questions is negative.

Iv. Causal Method

The factorization method is a test case design method that describes the combination of multiple conditions and generates multiple actions accordingly.

Follow these steps to generate a test case by using the reason:

Analyze the reason and result in the Software Specification Description, and assign an identifier to each reason and result.

Analyze the semantics of the Software Specification Description. Find out the relationship between the cause and the result, the cause and the cause, and draw the cause based on these relationships.

Use some marks to indicate constraints or restrictions on the cause and effect.

Converts a sequence into a discriminant table.

Use each column of the decision table as a basis to design test cases.

For example, the character in the first column must be A or B, and the character in the second column must be a number. In this case, the file is modified. If the character in the first column is incorrect, the information l is given; if the second column is not a number, M is given.

1. Draw a causal relationship table and a causal relationship.

2. Create a decision table based on the cause and effect.

Action is generated based on the combination of conditions. Cause 1 and cause 2 cannot be both valid, so this situation can be ruled out.

Test cases can be designed from the decision table: 6 test cases are the required data.

[Tool] Black box testing Test Case Design 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.