根据需求文档设计测试用例
上一篇 / 下一篇 2008-08-22 14:22:54 / 个人分类:测试方法探讨
测试用例(Test Case)是为某个特殊目标而编制的一组测试输入、执行条件以及预期结果,以便测试某个程序路径或核实是否满足某个特定需求。对软件的每个特定功能或运行操作路径的测试构成了一个个测试用例。
'UPbQo0 目前的功能测试用例都需要首先进行需求理解,再进行用例设计,这些过程都是基于人工实现的。尤其是测试用例的测试输入部分需要人来理解需求并组合测试步骤,测试用例的预期结果业需要人工来提取。人工撰写功能测试用例,不仅耗费大量时间在需求理解阶段,而且也需要花费大量人力和时间撰写。尽管这样,撰写出来的测试用例仍然存在覆盖度不均衡,依赖用例撰写者的经验和能力,以及不能够完全的的复现需求的问题。51Testing软件测试网{{w gngnP
I7dj
@A|E.v&?0一、需求文档分析51Testing软件测试网'G|%Sx7t
通过分析需求文档的章节排版和内容格式,将需求分解成一个个Feature、Sub Feature、case的描述。51Testing软件测试网k;Cuv9^8J
比如例1:51Testing软件测试网{f8c4| SBo
***********************************************
3fx E-e-eP4Lf01 Place a call .................................Feature151Testing软件测试网~%X5g1{R
1.1 Dialling........................................Sub Feature1
:]?6kS
lr0Phone number: “0~9”51Testing软件测试网q
l)g+{ ^Q
Case 1
v,Z1SL4ep}nc s0Tap the keyboard then input the correct phone number or select the phone number from contacts or select it from the call history, then tap the “Dial” button, can make a call. The dialing main interface is as below:51Testing软件测试网YRXQ{(T!\F`
*Interface image*51Testing软件测试网
n#J9yz {/M7Nc
Case 2
&W\1F@D0Tap the “End call” button……
y \2H+b{a1LA01.2 Incoming Call...................................Sub Feature2
*rqgU5X^,I01.3 XX..........................................Sub Feature351Testing软件测试网s4{^8Y9G3^ W
2 Calendar reminder.....................Feature251Testing软件测试网rJ)F6~t;j Gl u
3 XX.............................................Feature3
|x9X!\Xsp#IF0***********************************************51Testing软件测试网3J$U7G:Q}7unZ
产生出以下的编号和子功能 case描述:
(Aj G {ZB1M0Data format:Phone number[0~9]
:?8`zl8T/o1{'h0F1_SF1_C1 :
2]*Lg~;n:Y-nxx/h0Tap the keyboard then input the correct phone number or select the phone number from contacts or select it from the call history, then tap the “Dial” button, can make a call. The dialing main interface is as below:
5a1W3nm\0*Interface image*51Testing软件测试网.e"qrE _{l
F1_SF1_C2 :
y$iLKsdG0Tap the “End call” button……51Testing软件测试网(T(l+~UWZ
F1_SF2........:51Testing软件测试网.{+ERS1Ej
O\A,UH-[0二、测试需求分析
'F'v.N UcV"aD`0C8I3p-Q]u|S0测试需求分析就是将前面提取出来的case描述逻辑词汇识别出来,画出逻辑关系图,再使用决策表或者因果图的用例设计方法,一个功能点尽可能全面的覆盖尽可能多的测试用例:
n:^Z-\M!iK0XL3C%]s}q(y0举例如下:(个人观点,仅供参考,讲得不对也请指出来)51Testing软件测试网9ko2A6U(d } ]
1、 将子功能Case描述中的逻辑关键字提取出来,如:或\或者(or)、和(and)、与(and)、并且(and)、然后(and)、否(not)、不(not)、非(not)、反之(not)、当(if)、如果(if)等,建立起步骤间的逻辑关系。
{|
l-egw:xf$K02、 将子功能Case描述中的句法和语义进行分析,将条件、动作和结果分别识别出来。
d&W3P${/@2D0比如,F1_SF1_C1就可以被分解成:
.wdybP"Z0<Tap> the keyboard (then) <input> the correct phone number (or) <select> the phone number from contacts (or) <select> it from the call history, (then) <tap> the “Dial” button, [can] make a call.
r)L;[4W2m%Hkj-Q h`{0根据例1,可以画出测试步骤逻辑关系。
y+AfJdPZJ0 因为例一较简单,所涉及的逻辑层次只有两层,对于有三层以上的情况,将会有更加复杂的逻辑关系图。51Testing软件测试网n'\xO?9d
用例设计
.XymJ$rC`.I4H^H
r0根据
功能 | 子功能 | 用例编号 |