【软件测试】白盒测试White box testing

White box testing use knowledge of the code to provide clues as to what should be tested and how to test it.

测试目的:

缺陷disadvantages:

1. 测试者主观性很强

静态白盒

读代码找错

动态白盒

又称为结构测试,利用查看代码功能(做什么)和实现方式(怎么)得到的信息来确定哪些需要测试、哪些不需要测试、如何开展测试。Using information you gain from seeing what the code does and how it works to determine what to test, what not to test, and how to approach the testing

The four areas that dynamic white box testing encompasses are:

1.Directly test the pieces- the low-level functions, procedures,subroutines or libraries.

2. Do top level(整体) testing of the completed program, but choose test cases by knowledge of the code.

3.Directly access variables and state information and force the software to do things.

4. Measure how much of the code has been tested and be able to adjust your tests to remove redundant test cases and add missing ones.

Why dynamic black-box testing is not enough?

It's difficult and sometimes impossibl to figure out exactly what caused the problem

Some bugs hide others, it's impossible to get to the core fault.

单元测试unit testing

测试接口

unit testing cases

要关注接口,本地数据储存,临界条件,

Interface: ensures that information properly flows in and out of the component

local data structures: ensures that data stored temporarily maintains its integrity during execution

boundary conditions: ensures that the component operates properly at boundaries established to limit or restrict processing

independent paths: ensures that all paths in a component have been executed at least once

error-handling paths: ensures that errors are correctly handled

driver(驱动):下层模块开发完毕,但上层模块没有完成时使用。Drivers hook in exactly the same way that the future real modules will. Drivers are calling Functions in Bottom Up Integration

stub(桩程序):上层模块开发完毕,但下层模块没有完成时使用。Stubs simulate the behaviors of the low-level modules. Stubs are called Functions in Top Down Integration

整体测试integration testing

bottom up model

优点

Popular approach

Is useful when many of low-level components are general purpose utility routine that are invoked often by others

IntIntegrated test by component driver

Test data and test cases are created easily

缺点

顶部组件问题发现会延时

不易发现设计上的错误

top down model

优点

最重要的组件会被最早测试

应用于顶层设计

不用驱动程序

逻辑结构清晰

缺点

要大量桩程序

很难单独测试各个组件

代码覆盖code coverage

是一种动态白盒测试,检测软件运行时被执行的代码,与测试案例有关

代码覆盖率分析器code coverage analyzer

Statement coverage or line coverage(语句覆盖)

the basic idea:make sure that every statement in the program executes at least once

Branch coverage(判定覆盖或分支覆盖)

The basic idea: make sure that every branch in the program executes at least once

Condition coverage(条件覆盖)

Branch condition coverage(判定﹣条件覆盖)

Condition combination coverage(条件组合覆盖)

Path coverage(路径覆盖)

cfg(control flow graph,控制流图)

要结果所有状态,要用节点的合并

相关推荐

  1. 软件测试

    2024-04-23 09:40:01       60 阅读
  2. 软件测试之黑测试测试

    2024-04-23 09:40:01       39 阅读
  3. 软件测试错题集(黑测试

    2024-04-23 09:40:01       49 阅读
  4. 软件测试测试White box testing

    2024-04-23 09:40:01       34 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-04-23 09:40:01       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-04-23 09:40:01       106 阅读
  3. 在Django里面运行非项目文件

    2024-04-23 09:40:01       87 阅读
  4. Python语言-面向对象

    2024-04-23 09:40:01       96 阅读

热门阅读

  1. PaddleSeg(1)配置文件详解

    2024-04-23 09:40:01       31 阅读
  2. Mockito

    Mockito

    2024-04-23 09:40:01      27 阅读
  3. 华为od机试真题——找磨损度最高和最低的硬盘

    2024-04-23 09:40:01       32 阅读
  4. oracle11g集群挂起

    2024-04-23 09:40:01       29 阅读
  5. .Net4.0 Web.config 配置实践

    2024-04-23 09:40:01       38 阅读
  6. Apache Spark 的基本概念和在大数据分析中的应用

    2024-04-23 09:40:01       34 阅读
  7. Building VTK in Ubuntu 22.04. OpenGL missing.

    2024-04-23 09:40:01       31 阅读
  8. CentOS 源码安装 pip3

    2024-04-23 09:40:01       32 阅读