Software Engineering-test

Source: Internet
Author: User

 

Unit Test (white box test)

1 module interface:

Internal Check: whether the number, attribute, unit, and order of Transmission Parameters match, whether the definitions of full variables are consistent, and whether the input variable is modified.

Internal Check: open, end, and close file operations; files and attributes; I \ O error handling; Output spelling, and so on

2. Local Data Structure:

Data description; setting of initialization and default values; spelling of variable names; compatibility of data types; overflow of top/bottom and abnormal address, etc.

3. Important execution path:

Because exhaustive testing is impossible, a testing scheme is usually designed for the most common errors.

Common Errors include calculation order, mixed operation of different types, initial value setting error, Accuracy Problem, and expression error loop termination condition error;

4 error handling path:

Set handling conditions to anticipate errors.

Common problems include:

The output error message is hard to understand,

The error location cannot be determined.

The error in the description is inconsistent with the actual error.

System Intervention prior to processing

Incorrect handling

5. Boundary Condition-the last or most important task in a unit test, because the software often fails its boundary.

Main Unit Test Methods:

1. Code Review

Read-Only performance_through:

For example, Lucent Technologies's testing strategy consists of three people (including author, reader, and recorder) to check the source code line by line. Rehearsals are played by a computer to simulate execution

Advantage: multiple errors are detected in one review section, so you do not have to change one review.

2. Make the test software:

Writing Stub (Stubs) and Driver software is an additional expense. High module cohesion simplifies this process.

 

 

Design Test Plan

Task:

1. Specify the function to be tested.

2. design input test data

3. list expected results

Main technologies:

1. logic coverage: Applicable to white-box test coverage from weak to strong:

(1) Statement overwrite (Statement coverage): Each Statement must be executed at least sequentially.

(2) Branch coverage: Based on (1), each Branch of the decision must be executed at least sequentially.

(3) Condition coverage: Based on (1), each Condition of each judgment expression can obtain various possible results.

(4) Decision/condition coverage: that is, the decision covers the condition coverage.

(5) condition combination overwrite: the combination of conditions in each decision expression must appear at least sequentially.

(6) Point overwrite = Statement Overwrite

(7) edge coverage = decision coverage

(8) Path coverage: each possible Path must be at least executed in sequence. If a ring exists in the figure, each ring must go through at least one order.

(9) path overwrite/condition combination Overwrite

 

2 Equivalence Partitioning -- applicable to black box testing

Is a common test method. The selection of test data is based on the analysis of program functions, according to the program input requirements and output requirements, select a number of data for the test function process.

(1) Division of experience

When specifying the input range: Invalid class [valid class] invalid class when specifying a set of input values and processing different values.

For example, in the teaching/Data splitting plan, four valid classes are scored by professors, associate professors, lecturers, and ta respectively =; one invalid class is counted (outside of four valid classes)

When the input rules are specified: for example, the PASCAL Language specifies that each language ends with ";" = "and there is one valid class; there are several invalid classes (with", "End, end with": ", end with space, etc)

When the input is an integer, valid classes can be divided into Z +, 0, and Z -.

When processing tables: Valid classes can be divided into empty tables, tables containing one item, tables containing multiple items, etc.

(2) design steps

Design a new scheme to overwrite as many valid equivalence classes as possible; repeat this step until all valid classes are overwritten.

Design a new scheme to overwrite one and only one unoverwritten invalid equivalence class; repeat this step until all invalid classes are overwritten. (Generally, after a program executes an error, it will not continue to check for other errors)

 

3 Boundary Value Analysis)

Note: (1) the program is most prone to errors at the boundary; (2) it is usually combined with equivalent division.

 

4. Failure Prediction)

Train of Thought: (1) list possible errors; (2) list special cases that are prone to errors.

Design the test scheme based on this

Experience and intuition

5. Practical Strategies black box design + white box supplement

(1) In all circumstances, the boundary value analysis method should be used first;

(2) If necessary, use the equivalent division method;

(3) supplement it with incorrect speculation when necessary;

(4) Check the test scheme against the program logic. Different logic coverage standards can be adopted according to the requirements for program reliability, and some test schemes can be added if necessary.

Note: using the above comprehensive strategy to design the test scheme still cannot ensure that all errors are found. For example, Lucent has been tested in many aspects, including line-by-line check of source code, and its software has a success rate of 80%. It can be imagined that the success rate of untested software is lower.

 

 

 

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.