问题 问答题 简答题

采用白盒测试法设计测试用例时,常用的逻辑覆盖测试方法有哪几种?请简单描述各种方法的目的。

答案

参考答案:

目前比较常用的逻辑覆盖测试方法有:语句覆盖、判定覆盖(分支覆盖)、条件覆盖、判定/条件覆盖、组合覆盖和路径覆盖。

(1)语句覆盖的目的是选择足够多的测试用例,使程序中的每个可执行语句至少执行一次。

(2)判定覆盖的目的是通过执行足够的测试用例,使得程序中的每个判定至少都获得一次“真”值和“假”值,也就是使程序中的每个取“真”分支和取“假”分支至少均经历一次。

(3)条件覆盖的目的是设计若干测试用例,在执行被测程序以后,要使每个判定中每个条件的可能值至少满足一次。

(4)判定/条件覆盖的目的是设计足够的测试用例,使得判定中每个条件的所有取值(真/假)至少出现一次,并且每个判定本身的所有判定结果(真/假)也至少出现一次。

(5)组合覆盖的目的是通过执行足够的测试用例,使得每个判定中条件的各种可能都至少出现一次。

(6)路径覆盖的目的是设计足够多的测试用例,要求覆盖程序中所有可能的路径。

单项选择题 A1型题
阅读理解

Memory, they say, is a matter of practice and exercise. If you have the wish and really make a self-effort, then you can quite easily improve your ability to remember things. But even if you are successful, there are times when your memory seems to play tricks on you.

  Sometimes you remember things that did not happen. One morning last week, for example, I got up and found that I had left the front door unlocked all night, yet I clearly remembered locking it carefully the night before.

Memory “trick” works the other way as well. Once in a while you remember not doing something, and then find out that you did. One day last month, for example, I was sitting in a barber(理发师) shop waiting for my turn to get a haircut, and suddenly I realized that I had got a haircut two days before at the barber shop across the street from my office.

  We always seem to find something funny in incidents(小事) caused by people’s forgetfulness or absent-mindedness(心不在焉). Stories about absent-minded professors have been told for years, and we never got tired of hearing new ones. Unfortunately, however, absent-mindedness is not always funny. There are times when “trick” of our memory can cause us great trouble. (words: 169)

小题1:If you want to have a good memory, ________.

A.you should force yourself to remember things

B.you should make a self-effort of practice and exercise

C.you should never stop learning

D.you should try hard to remember things小题2:Which of the following statements is TRUE according to the passage?

A.One night the writer forgot to lock the front door.

B.One night the writer forgot having locked the front door.

C.The writer remembered to lock the door.

D.The writer remembered unlocking the front door.小题3:From the sentence "We never get tired of hearing new ones", we can infer that______.

A.we enjoy hearing new stories about absent-mindedness of professors

B.we don’t want to know anything more about absent-mindedness of professors

C.we will never get rid of(摆脱) listening to new stories about absent-mindedness

D.absent-mindedness happens not only to professors but to many other people