【软件测试】白盒测试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(条件覆盖)

basic idea:make sure thar every term in the expression are executed at least once

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

使得判定中每个条件的所有可能取值至少满足一次,同时使每个分支也至少执行一次

Condition combination coverage(条件组合覆盖)

分支覆盖与条件覆盖都要满足

Path coverage(路径覆盖)

圈复杂度cyclomatic complexity:边的个数-节点个数+2

cfg(control flow graph,控制流图)

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

  • 25
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

岩塘

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值