一个人不应该依附在其他人身上,一个人应该首先自力更生。你应该自己能够独立,能够安顿你自己,那你就不会害怕了。你爱你自己的话,别人不能不爱你吧。
如何让你的测试用例结构更清晰条理化(转载)(强烈推荐)
上一篇 /
下一篇 2007-06-01 10:05:20
/ 个人分类:测试用例
)[5j2e
{6o6hPF0原文 by 上官若冰51Testing软件测试网u/Uk)Ig!p$n;f9W
?~1`X&d7X\!E0
G]&`zgaB
u051Testing软件测试网1p4d8S9V(YqK(D4G
u?
b一个好得测试用例,需要满足16个字:
1m&zY7Cf0 结构清晰51Testing软件测试网^!`7i+| x ^
|+p)d
内容准确51Testing软件测试网!JEMI9j
易于统计51Testing软件测试网6H5J}R9fh^H
便于维护51Testing软件测试网P4W_ |~@
51Testing软件测试网Ym$a+_
RjW
让我们来分析和了解一下测试用例得结构。测试用例的结构一般依照项目的层次,可以划分出一定目录结构。如何来做到结构清晰呢?
e'`5j9m;p$L.q(X051Testing软件测试网~]TJD"Y0m.B&h
假设,如果有一个复杂而庞大的项目,需要对其每个模块,每个模块中的的功能点,每个功能点中的细节分别设计用例,你将用什么方法来使你得测试点体现得条理又准确呢?下面我们以学生管理系统这样一个项目来做例子分析。如下是这个项目的框架式功能介绍:
*fd/g;`j:s1@np r+H6^)k0screen.width-461) window.open('http://smallfishdaisy.googlepages.com/Figure1.JPG');" src="http://smallfishdaisy.googlepages.com/Figure1.JPG" border=0>51Testing软件测试网1od#Ogj&?
51Testing软件测试网;I
qWtm6I]
4hULj n"~u0从该项目功能点上可将系统划分成如下的关系:51Testing软件测试网
HhYJ r@
screen.width-461) window.open('http://smallfishdaisy.googlepages.com/Figure2.JPG');" src="http://smallfishdaisy.googlepages.com/Figure2.JPG" border=0>
7M
^`:B0D;@051Testing软件测试网 nFE]&i\;J
H~-S?2g?0任何一个的项目,不管其难以程度,都需要将它由大到小,由复杂到简单去划分。从上面这个关系我们可以得出,一个项目从上到小可以出现多个层级关系:51Testing软件测试网y4Z_^ U2x k)X
* 最大的层级就是一个项目,如学生信息管理系统这个项目;
hZ(T!m!Ge2X0* 其次组成这个项目的各个分支(模块)功能,如登陆,数据库管理,学生信息管理,账户管理,成 绩分析统计管理;
-gm,EGZ)u5oA0* 再次,每个分支(模块)功能内部,外部功能点。
u(Dn6Fen$[Cn9S+PD051Testing软件测试网9_H_Q7hH,|
所以,至少有三层关系在其中。那么,如何让我们的测试用例也能很好的体现出这样的层级关系呢,我们引入如下概念:
:CQ!ae&l!_$C(s0
\s3R:[H;Mk0WookBook:51Testing软件测试网QJ;d$S ].A
模块,各产品根据各自特性划分成不同的子模块
-c}S)QsNt051Testing软件测试网Y
nEX
_Q
WookSheet:51Testing软件测试网 BU%j(e2P;j(P)cvu
子模块,在各模块基础上分成不同的细分模块51Testing软件测试网:pZ9|m4v1Ur1Q
51Testing软件测试网1h@h-R4TU4aa
Secnario:51Testing软件测试网g] Z)H)[uw
A set of test cases ensure that the business process flows are tested from end to end. They may be independent tests or a series of tests that follow each other, each dependent on the output of the previous one.
g8PSX3v!Mne^051Testing软件测试网/I)A kfh%EJ.~6|{
Part:
"}h{%a-?0同一个细分模块中的层次划分,比如按照每个页面一个Part进行细分51Testing软件测试网%E']b X v
51Testing软件测试网-M1\$X,S
c2Q.Y8X
Case:51Testing软件测试网kE%A#m6ZOW(d:o^
用例,针对一个或者多个Objective的具体测试用例51Testing软件测试网+HWj;M!o#Vn&]4q
Ay!s!u4l:Go0Pre Requisite51Testing软件测试网e$Mcl%MgEK;e
包括整个子模块以及每个测试用例的测试前提条件
!E)E1ide!U1o7c0
oJPf*cV0Test Procedure
rI9@5s$JE/kA,p0每个分组中的测试用例执行顺序,当测试用例顺序执行时可省略
f9C&k SR3G9O:U0
@ya
YV0WookBook,WookSheet, Secnario, Part, Case的层级关系如下:51Testing软件测试网;t'kTuZV
screen.width-461) window.open('http://smallfishdaisy.googlepages.com/Figure3.JPG');" src="http://smallfishdaisy.googlepages.com/Figure3.JPG" border=0>
M9[u/wDL$J051Testing软件测试网v!ziF&cr"y vB
Figure 1: The diagram of relationship among the Worksheet, Scenario, Part and Case in one project
f;`J|@?0
n#s4r/?p)O(Q0screen.width-461) window.open('http://smallfishdaisy.googlepages.com/Figure4.JPG');" src="http://smallfishdaisy.googlepages.com/Figure4.JPG" border=0>
n;~o3G5Wi+Y@051Testing软件测试网S(S&O4k/W@
Figure 2: The Diagram of relationship among the Worksheet, Scenario, Part and Case in one workbook
R;Hc ir3fC051Testing软件测试网W9O-`#v(uuUD
s~"|:ryI)l|0现在,我们一起根据上图的层级关系,来为学生管理系统构建其测试用例的框架。
&TzXH
@051Testing软件测试网Ar^r4W?d?
1. 首先我们用一个excel类型的WookBook来定义这个项目,如C050505 SIMS TC 01 01. xls51Testing软件测试网7w|K4d5a%{\+f~,Ar"|
(P6v*U*\5\ CYgXi)F0screen.width-461) window.open('http://smallfishdaisy.googlepages.com/Figure5.JPG');" src="http://smallfishdaisy.googlepages.com/Figure5.JPG" border=0>
d.p*PI Ce
D2j0
5?)?xoW0
8_#u0[
\E:xm6L
I"j051Testing软件测试网,m1a2rO?E ^
2. 在一个WookBook中,用多个WookSheet去定义项目中的主要功能点
:n.S+?t-W&Mr0
2h c ?D6d h;Yj2p|0screen.width-461) window.open('http://smallfishdaisy.googlepages.com/Figure6.JPG');" src="http://smallfishdaisy.googlepages.com/Figure6.JPG" border=0>51Testing软件测试网M5\,qJ3q-r%ExU
^E"rt @c4}0
m2QC5\6F'T@D051Testing软件测试网X;Q2vS U i0v%U|0F
3. 对模块中需要根据不同场景处理的功能点,再细分出它的场景模块。如在学生信息管理模块,因为权限的不同,所涉及到的场景和功能也会有各自的特点:
(c\*@k+TaSN1Y0
*Q]7k[+f$[0screen.width-461) window.open('http://smallfishdaisy.googlepages.com/Figure7.JPG');" src="http://smallfishdaisy.googlepages.com/Figure7.JPG" border=0>
C0p8O!mm!re&E051Testing软件测试网#}5y ^wB}Q [
)^Y3P(Q0`*[ZM
f051Testing软件测试网`,{"}v+T)x,[
4. 在一个WookSheet里面,根据流程和子功能划分成不同的part, 例如在学生管理_助教这个sheet里面:51Testing软件测试网.r`~]J#`
4OleN1x |;E%V0screen.width-461) window.open('http://smallfishdaisy.googlepages.com/Figure8.JPG');" src="http://smallfishdaisy.googlepages.com/Figure8.JPG" border=0>
/xWs)?_fX J*^
I0
/]Uc-\Zl0注:在Part中,如果需要继续划分,可以允许Sub-Part51Testing软件测试网{3xZ6H{
~ uP8SneSc051Testing软件测试网6j2EC p1Dx
5. 在每个Part中,设计唯一的Case。Case是测试用例中的最小单位,不可再分。
c4j4@e2Qu%M7W0U051Testing软件测试网| K
^$uU(r c+N A!a h
这样,一个层次鲜明,条理分明的测试用例的结构框架就出来了。拥有清晰结构的测试用例,不仅阅读方便,同时也为测试用例的管理,提供有效的目录组织。
1S+F)fu:_1v2I051Testing软件测试网t&G#G1cw
例如:
%xp#i rvz01. 登陆51Testing软件测试网_!aW%u+{-`P6]b
2. 帐号管理51Testing软件测试网7A;c]*TL)C+[
3. 学生信息管理51Testing软件测试网W yAp6M#tge
\
3.1. 管理员权限51Testing软件测试网 B|PH7[,[
3.1.1. 新增学生信息51Testing软件测试网W8n6cD
O.Z
3.1.2. 修改学生信息51Testing软件测试网)jrL]0?$lx-X~
3.1.3. 复制学生信息51Testing软件测试网G5O9|P;B TJ|
\:Rb
3.1.4. 删除学生信息
R||n/zm0 3.1.5. 查询学生信息
A
c0\Gu
AE#e03.2. 教职权限
0[U:{&Y\2[03.3. 助教权限
pU(E2e%tP^t|M3o04. 成绩分析与统计51Testing软件测试网Q3t^:E+W
P|#JWb.e
5. 数据库管理51Testing软件测试网J$z"d+t(Cs,W
9h6Ok
u$_,J}y0
收藏
举报
TAG:
测试用例