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

Python MBT 测试用例

热度856票  浏览62次 时间:2011年7月19日 10:28
Python学习j'XFwhsw z9Y

@Scenario(Param={

u%a ~fR2|MR }_0 Python学习 L2eji;_AsP)h1q

'antiSpamLevel':['0', '1', '2', {'t':'invalid', 'v':3}, {'t':'invalid', 'v':-1}]Python学习;JVA e_.cxsax

CN)Xn,X0, 'actionForSpam':['reserve', 'delete', {'t':'invalid', 'v':'badAction'}]

|Z8fq H \0 Python学习G~/p^g*b

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

~7U?;C$n*z0

(K;h aeu:h U0'strategy':'add'})Python学习PR0[*J2UC

Me m/~u"v{*yR.}0def AntiSpamSetting(self):Python学习?:b.ViX

5G!O;vki DGmO0accessTarget = self.accessTargetPython学习i#W_aTz#q4S.AVs

Python学习t{8qb B^"a.M_

antiSpamLevel = self.Param['antiSpamLevel']Python学习7n`)M/p&l~1{

Python学习/ZgM3rw9A7S9\#f

actionForSpam = self.Param['actionForSpam']Python学习1bscJ su8V_

*q5q?1}s5b0rsp = Filter.UpdateAntiSpamSettings(accessTarget, antiSpamLevel, actionForSpam)

Z UD#APJ3_0

$K G`X(z[i0r)Wd0isSetFail = self.Param.GetType('antiSpamLevel') == 'invalid' or self.Param.GetType('actionForSpam') == 'invalid'

0?9WS}(zr-E0 Python学习KE K jm$M#Z

RspCheck(rsp, True, StatusCode.SYS_REQ_PARAM_INVALID if isSetFail else StatusCode.SYS_RESP_OK)Python学习F%mz_M^

K,LhZg3FH]7r0rsp = Filter.getAntiSpamSettings(accessTarget)Python学习;{&]9[Xb od

Python学习3G9y1K:xm*x!c0~j

if isSetFail:

V'?%K?"vc0 Python学习+R\I.?(I2YK'O

RspCheck(rsp, True, StatusCode.APP_MBOX_FILTER_ANTISPAM_NOTEXIST)

-coe!J$O7B W.?N;IJ0

|3QLQ;~c0else:

a5W3] b8T V;N3U0 Python学习C uS?/~j

RspCheck(rsp, False, StatusCode.SYS_RESP_OK)Python学习G6x,G1[9gkd o@

Python学习(m4r+[j U'[9|

Assert.AreEqual({"antiSpamLevel":antiSpamLevel, "actionForSpam":actionForSpam}, rsp['data'], 'data check')

~*E)P,{D0

N.NPC rI;m0Model View 结果:Python学习Hl"s] Q7O7Pf9x e

Python学习+F$c6| Rt:hd

= 表示 “期望结果是”Python学习6l7w!b&G^

Python学习 W;O1P'U6eSD%a`

AntiSpamSetting (antiSpamLevel:0) Running ...

spV uXE`:H:d0

P aiN@9["j})r0Passed: AntiSpamSettingPython学习9al5Yg X

Python学习1aM)Ur8G-i:a,[

AntiSpamSetting1 (actionForSpam:delete) Running ...Python学习6Y'uw7V8hq"a7hI$R

5rt3Y$D9y#fH0Passed: AntiSpamSettingPython学习*@TzbQ Z(id'^ A.S

Python学习X%aMh~i S\@

AntiSpamSetting2 (actionForSpam:badAction) Running ...

)reFm-{,V0

%X KP'I:~SN$Q.WT0Passed: AntiSpamSetting

x#k:} WKezLa0

L0{Ix$|0b[9?k0AntiSpamSetting3 (antiSpamLevel:1) Running ...Python学习XZMh$Ow

+B)r ]Z;u6M0Passed: AntiSpamSetting

1Uo7v8R#~0y0

,HA&[b&S4Q'VW?'{0AntiSpamSetting4 (antiSpamLevel:2) Running ...Python学习^H v1Sc4d

Python学习%f%lIhCefdQ'|y

Passed: AntiSpamSetting

|Ks uG'Z ])|$y0

e `~$Q,S\0AntiSpamSetting5 (antiSpamLevel:3) Running ...Python学习oL+?:U Dq iZkN}

G2Do5RyIqm#M }0Passed: AntiSpamSettingPython学习5`qc$SX L

~ P D$i vR0AntiSpamSetting6 (antiSpamLevel:-1) Running ...Python学习;x'FMSL,x H

Python学习*p}A-Wfr0F1w"p

Passed: AntiSpamSettingPython学习:XT b/Pb

顶:35 踩:51
对本文中的事件或人物打分:
当前平均分:0 (265次打分)
对本篇资讯内容的质量打分:
当前平均分:-0.22 (261次打分)
【已经有244人表态】
36票
感动
30票
路过
29票
高兴
27票
难过
30票
搞笑
26票
愤怒
33票
无聊
33票
同情
上一篇 下一篇