Implementation (coding and testing)

One, software testing

Testing is the process of executing a program in order to find errors in the program.

Good test: find as many errors as possible.

Test method:
black-box, or closed-box testing: does not consider the internal structure of the program, only observes the entrance and exit of the program, whether it can complete the input and output required by the specification.
——Functional testing

White-box testing (white-box, or open-box, clear-box testing): The structure and processing of the program are as transparent as a white box.
—— Structural testing

Test steps:
①Module test
②Integration test
③Acceptance test
④Parallel operation

Two, unit test

White box testing

It is developed and carried out by the module writers.

1. Test focus

  • Module interface test
  • Important execution path test (white box test)
  • Boundary condition test
  • Error handling test
  • Partial data structure test

2. Drivers and stubs

Driver : The
driver module
calls the "main program" of the test unit, which receives test data, transmits these data to the tested module and prints the relevant results.

Stub : A
stub module
is a replacement module for the module called by the tested module unit, which "simulates" the replaced module in terms of module call interface, related data processing, and control return.

Three, integration test

1. Non-incremental testing

2. Incremental testing

  • Top-down testing (Stub)
  • Top-up test (Driver)

Four, confirmation test (acceptance test)

Black box testing

Divided into confirmation and verification

User participation test

The functional and performance requirements in the requirements specification are the basis for confirmation testing.

Five, white box testing

White box testing is divided into two categories: logical coverage and control structure testing .
The logical coverage method, the choice of test cases is determined according to different coverage standards.

From weak to strong:
statement coverage,
judgment coverage,
condition coverage,
judgment condition coverage,
condition combination coverage

Six, logical coverage

1. Statement coverage
At least each statement should be executed once.
Insert picture description here

2. Decision coverage
On the basis of satisfying statement coverage, each branch of each decision is executed at least once.
Insert picture description here

3. Condition coverage
On the basis of satisfying statement coverage, each condition of each judgment expression can get various possible results.
Insert picture description here

4. Judgment condition coverage
Insert picture description here

5. Condition combination coverage
The various possible combinations of conditions in each decision expression appear at least once.
Insert picture description here

6. Point coverage = statement coverage

7. Edge coverage = decision coverage

8. Path coverage
Each possible path is executed at least once. If there are loops in the figure, each loop will pass at least once.

Seven, control structure test

1. Basic path test

  • Step 1 Draw the corresponding flow diagram based on the results of the process design.

  • The second step is to calculate the loop complexity of the flow graph.

  • Step 3 determines the basic set of linear independent paths.

The independent path contains at least one edge that has not been used before the path is defined.

The loop complexity is 6, so there are 6 independent paths.

  • Step 4 Design test cases that can enforce each path in the basic set.

Insert picture description here
Insert picture description here
Insert picture description here

2. Cycle test

Eight, black box testing

Black box testing does not consider the internal structure and characteristics of the program, and only designs test cases based on the program function or the external characteristics of the program.

  • Equivalent classification
  • Boundary value analysis
  • Wrong speculation

1. Equivalent classification:
valid and invalid

method:

Design a new scheme to cover as many valid equivalence classes as possible that have not been covered; repeat this step until all valid classes are covered.

Design a new scheme to cover one and only one invalid equivalence class that has not been covered; repeat this step until all invalid classes are covered. (Usually, the program does not continue to detect other errors after executing an error, so only one invalid class is tested each time)

2. Boundary value analysis A
large number of errors occur on the boundary of the input or output range.
Design test cases for various boundary conditions.
There will be 4n+1 groups of use cases

Method: Keep one variable at a time, other variables take the normal value (intermediate value), and the retained variables take the minimum value, minimum value +1, maximum value -1, and maximum value.

Insert picture description here

Robustness test
6n+1

In addition to the boundary value, add data:
minimum value -1, maximum value +1
Insert picture description here

3. Wrong guessing method
based on intuition and experience

Method:
List the possible errors,
list the special situations that are prone to errors

Nine, debugging

Test-find errors
Debug-correct errors

1. Identify the location of the error (95% workload)
2. Correct the error

10. Software reliability

Software reliability-the probability that a program can run successfully within a given time interval.
Software availability-the probability that a program can run successfully at a given point in time.

Guess you like

Origin blog.csdn.net/weixin_44366125/article/details/105934588
Recommended