Key Points for Final Review of Software Testing Chapter 3 White Box Testing

Everyone thinks the writing is okay, you can like, bookmark, and pay attention to it!
You can also visit my personal blog , it is estimated that it will be updated in recent years! Be friends with me! https://motongxue.cn


Article directory

Chapter 3 White Box Testing

  1. White-box testing: A test of how the program unit under test works internally , characterized by the source code of the program under test rather than the software's requirements specification.

  2. in principle

    1. Ensure that all independent paths in a module are tested at least once.
    2. All logical values ​​are tested for both true and false values.
    3. Check the internal data structure of the program to ensure the validity of its structure.
    4. Run all loops within upper and lower bounds and within operable range.
  3. Test Methods

    1. review

      • Four elements of a formal review

        1. determine the problem

        2. obey the rules

        3. Prepare

        4. write report

      • Purpose

        • find bugs in software
    2. walk through

    3. test

  4. Static white-box testing (structured analysis): does not execute the software

  5. Flow diagrams are also called program diagrams: nodes, control flow lines

  6. basic structure

    1. sequential structure
    2. branch structure
    3. loop structure
  7. Cyclomatic complexity

    • A software metric that provides a quantitative measure of program logic complexity
    • Commonly used in basic path testing method
    • The number of linearly independent directed cycles in a strongly connected flow graph is the cyclomatic complexity of the program.
    • calculation method
      1. V(G)=m-n+p
        • Add a dashed arc from the exit point to the entry point . At this time, the flow graph becomes a strongly connected graph.
        • m represents the number of directed edges in the directed graph G;
        • n represents the number of nodes in the directed graph;
        • p represents the number of independent connected regions that can be separated in the directed graph G, which is a constant of 1.
      2. V(G) = the number of areas enclosed by the strongly connected flow graph on the plane
      3. V(G) = number of decision nodes + 1
  8. Dynamic White Box Testing

    1. Generate test cases according to certain steps and methods, and drive related modules to execute the program and find errors and defects in the software.
    2. The logic coverage method and the basic path method are often used to design white-box test cases.
      1. Logical coverage method (increasing order by ability to find errors)

        1. Override method:
          1. Statement coverage: every statement is executed at least once
          2. Decision coverage: each branch of each decision (the entire final result, the difference from conditional coverage) is executed at least once
          3. Condition coverage: Each small condition in each judgment is executed at least once according to "true" and "false".
          4. Decision/Condition Coverage: Satisfy the requirements of both decision coverage and condition coverage
          5. Condition combination coverage: Find all possible combination values ​​of all conditions in the judgment, and execute each possible condition combination at least once
          6. Improved decision/condition coverage (MC/DC coverage)
          7. Path coverage: all possible paths are executed at least once
          8. Linear Code Sequence and Jump Coverage (LCSAJ): It consists of an ordered sequence of code that ends with a jump to the beginning of another code sequence
        2. Coverage = (number of tested items that are executed at least once) / total number of tested items
      2. Basic path method (independent path testing)

        1. Refers to any path in a program that introduces at least one new statement or a new condition
        2. The basic steps of basic path testing are:
          1. Export the control flow graph of the program flow chart according to the program design results;
          2. Calculate the cyclomatic complexity of the program;
          3. Export the basic path set to determine the independent path of the program;
          4. According to the independent path, design the corresponding test cases.
      3. cycle test

        1. Principle: Execute the loop body at the loop boundary and run limit.
        2. loop structure
          1. simple loop
          2. Concatenated loops (parallel loops): independent loops? Simple Loops: Nested Loops
          3. nested loop
      4. data flow test

        1. basic concept

          1. c-use: A variable is used in an expression of an assignment statement, in an output statement, or passed as a parameter to a calling function, or used in a subscript expression
          2. p-use: a variable is used in the conditional expression of the branch statement
          3. We only care about the definition and use of global variables, and the local definition and use are meaningless when studying data flow-based testing .
        2. Data flow graph (DFG/def-use graph)

          • The basic process of constructing a data flow graph:
            1. Compute def, c-use, and p-use for each basic block in the program.
            2. Associate each node in the node set with its corresponding def, c-use, and p-use.
            3. For each node that has a non-empty p-use set and ends at condition C, if condition C is true, edge 1 is executed, and when C is false, edge 2 is executed, and edge 1, edge 2 and C ,! C is connected.
        3. def-clear path

          • Suppose variable x is defined in node i and used in node j. For the path p={i,n1,n2,…,nk,j}, k≥0, and nodes i and j have not appeared in subpaths n1, n2, ..., nk, variable x has not been used in subpaths Redefine , say p is the def-clear path of variable x.
        4. def-use pairs

          • Any variable x, from its definition to its use constitutes a specific def-use pair of this variable.

          • Classification

            1. dcu

            2. dpu

            3. variable (v) The node where the definition is located (n) dcu(v,n) dpu(v,n)
              x 1 {2} {(1,2),(1,3), (3,5),(3,4)}
              y 1 {4} {(1,2),(1,3)}
              z 1 {2,4,5} {(3,5),(3,4)}
              z 2 {2,4,5} {(3,5),(3,4)}
              z 4 {2,4,5} {(3,5),(3,4)}
        5. def-use chain

          • The concept of a def-use pair can be extended to an alternate definition and use sequence of variables , which is also called a def-use chain or k-dr interaction. The nodes in the def-use chain vary . k indicates the length of the chain, the letter d means "definition", and the letter r means "reference".
        6. Optimization: The data flow graph can reduce the number of def-use pairs to be covered.

  9. White box testing application example - triangle problem

  10. practise

    1. What is white box testing? What are the methods of static white box testing? And briefly describe it?

    2. What are the basic principles of loop testing? What kinds of situations are often considered in the test cycle?

    3. How many types of white box testing processes are there? What are the types of common white box testing problems?


Updated on December 20, 2020

Everyone thinks the writing is okay, you can like, bookmark, and pay attention to it!
You can also visit my personal blog , it is estimated that it will be updated in recent years! Be friends with me! https://motongxue.cn


Guess you like

Origin blog.csdn.net/CrazyMooo/article/details/111414949