你的位置:Python学习 >> 资讯 >> 经验分享 >> 详细内容 在线投稿

Python MBT 测试用例

热度1035票  浏览70次 时间:2011年7月19日 10:28
Python学习G:\$J+|G_S9G4TD

@Scenario(Param={

:Q7y.QybnxD0

xi.o)];gMq'O0'antiSpamLevel':['0', '1', '2', {'t':'invalid', 'v':3}, {'t':'invalid', 'v':-1}]Python学习y%\ Gp ~ LR

Python学习 VL5H,M;|1df*@

, 'actionForSpam':['reserve', 'delete', {'t':'invalid', 'v':'badAction'}]

m`'}^@P `&pH0 Python学习u6m |d,q"f"R;Rt{

}, Where={'combine':['antiSpamLevel', 'actionForSpam'],

F-j5`dK:oy0 Python学习Zuz*p%a N(x

'strategy':'add'})

2b[c"Y,A0I(]*Jf:{I0

t(J?s O0def AntiSpamSetting(self):Python学习'q7O7i#U6W-O

;rv^ l mP}0accessTarget = self.accessTargetPython学习*k8}f N P _

Python学习,@~$yyaHz-V

antiSpamLevel = self.Param['antiSpamLevel']Python学习1C tDz5jj Y!ixPD

Python学习e^2~-XO d

actionForSpam = self.Param['actionForSpam']

3Hls)nrF[X0 Python学习 Wm _'{&g;mD.g

rsp = Filter.UpdateAntiSpamSettings(accessTarget, antiSpamLevel, actionForSpam)

U,Du}\ xT0 Python学习-x:XoI @ G6?"R

isSetFail = self.Param.GetType('antiSpamLevel') == 'invalid' or self.Param.GetType('actionForSpam') == 'invalid'

']Wuw4RU Y8U0 Python学习L:p$x g'W$|hR6d^

RspCheck(rsp, True, StatusCode.SYS_REQ_PARAM_INVALID if isSetFail else StatusCode.SYS_RESP_OK)Python学习 {#VU%{XB

Python学习#jECE r

rsp = Filter.getAntiSpamSettings(accessTarget)Python学习s4m?b.C1xH

H)H/Q?? |s n;Q f0if isSetFail:

![wM0Dws i!O^0

$B)A8Q\-}$E:u0RspCheck(rsp, True, StatusCode.APP_MBOX_FILTER_ANTISPAM_NOTEXIST)Python学习K$f7[\"C!@\UaT

Python学习3l;V#hXy#UA

else:Python学习7KW H3I%i1tS&f

w[ c9m ^%U0RspCheck(rsp, False, StatusCode.SYS_RESP_OK)

(PB s YD0

|'n%m%C };Rw0Assert.AreEqual({"antiSpamLevel":antiSpamLevel, "actionForSpam":actionForSpam}, rsp['data'], 'data check')

:Zm;\5q0~+mh0

kYIy.F!L0Model View 结果:

elW a rLQ-I7e0

p \hh&A+n0`0= 表示 “期望结果是”Python学习JorA-p3W

Python学习.nW^D(H/CY

AntiSpamSetting (antiSpamLevel:0) Running ...

Y7j~n([iT0 Python学习LJ&^8[X/C/z5[ M

Passed: AntiSpamSetting

^ Sv3hB0

9k{} @p,k0AntiSpamSetting1 (actionForSpam:delete) Running ...Python学习c&ma9]d

Python学习V2cGy.k,|z+N

Passed: AntiSpamSettingPython学习(E `i-qQ\'X

D/lFkX0AntiSpamSetting2 (actionForSpam:badAction) Running ...Python学习p9O\@@GU)S$m#n

Python学习z\"ObNI z

Passed: AntiSpamSetting

l;N.SU%CR]9Zj;a0@0 Python学习-O9@@2tYl

AntiSpamSetting3 (antiSpamLevel:1) Running ...

NhM ^TN9N!vxB0 Python学习i8WF(v tLh

Passed: AntiSpamSetting

rp5\,}1eD6~0 Python学习G`)j?[

AntiSpamSetting4 (antiSpamLevel:2) Running ...Python学习{-mF*|z s!w Vy

+HB$R V U$e7B?0Passed: AntiSpamSettingPython学习L!Z-lR2B} o

)ob;h?+_,H(xq_u0AntiSpamSetting5 (antiSpamLevel:3) Running ...

}d-?hxk:K;U0 Python学习5Sj?4cPi0d!J0o

Passed: AntiSpamSettingPython学习b#p:p,A4p7t H

Python学习 i:C/\ BLr~A n

AntiSpamSetting6 (antiSpamLevel:-1) Running ...Python学习4I/P#oU!s E9w$x

Python学习*?\&k'@Fh-Pa

Passed: AntiSpamSettingPython学习8["l#]K"IzH[4Y!p

顶:45 踩:57
对本文中的事件或人物打分:
当前平均分:0.06 (324次打分)
对本篇资讯内容的质量打分:
当前平均分:-0.14 (310次打分)
【已经有299人表态】
40票
感动
38票
路过
34票
高兴
34票
难过
39票
搞笑
32票
愤怒
40票
无聊
42票
同情
上一篇 下一篇