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

Python MBT 测试用例

热度891票  浏览63次 时间:2011年7月19日 10:28
Python学习G%~@-k?l O

@Scenario(Param={

$j;m4e#U[ u ]0

W&y#?/?-t0'antiSpamLevel':['0', '1', '2', {'t':'invalid', 'v':3}, {'t':'invalid', 'v':-1}]

ytkHlW0 Python学习1C`1Wa*BA|:mD

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

s&M:D_ @7o9H#z0 Python学习?8^Tr(l2?)bH

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

A&Zw,E,oU"Md}0 Python学习(j0@] L[

'strategy':'add'})

`sF}1]7c0 Python学习s*\ q S{MWR

def AntiSpamSetting(self):

:\S&DwS1PR y0 Python学习m$SF'n:W J

accessTarget = self.accessTargetPython学习/bO{5ExA6j

Python学习5qz.ta[*v([@JI4B `

antiSpamLevel = self.Param['antiSpamLevel']Python学习KEk(kQ'FVHZ

4s:E x.v#Cr5S7N*Mz y0actionForSpam = self.Param['actionForSpam']Python学习A$`0b"v]c@2rj%pI,F

,^d1D)yeZ} H+?/Z0rsp = Filter.UpdateAntiSpamSettings(accessTarget, antiSpamLevel, actionForSpam)

9M L k}OQ%u0

k@(f.q&z?u8V5j0isSetFail = self.Param.GetType('antiSpamLevel') == 'invalid' or self.Param.GetType('actionForSpam') == 'invalid'

1F^3L3^,A4?x'T7w0 Python学习*h bq W]`/{_$AG

RspCheck(rsp, True, StatusCode.SYS_REQ_PARAM_INVALID if isSetFail else StatusCode.SYS_RESP_OK)

-oa-|]M(L0

/Ma~;eq$Q9gV'II0rsp = Filter.getAntiSpamSettings(accessTarget)Python学习BXcl`UM6{t

Python学习0b-SPG.['w%H)L

if isSetFail:

*c;`ch)r/b0

\J~#h]\o:R0RspCheck(rsp, True, StatusCode.APP_MBOX_FILTER_ANTISPAM_NOTEXIST)

H%l-a*CP)g&{O,u0

_ {3RKj-EP0else:

B$tK6Y}0

(]!T9d/z0~,h0RspCheck(rsp, False, StatusCode.SYS_RESP_OK)Python学习m*l }2d+Y'k7i#e

Python学习!n v&X J4qa~eR6C

Assert.AreEqual({"antiSpamLevel":antiSpamLevel, "actionForSpam":actionForSpam}, rsp['data'], 'data check')Python学习nR.xg'tQ;@

Python学习kMTVN0nc

Model View 结果:

,[ry_,X#o3v0 Python学习 s2aD o4I

= 表示 “期望结果是”

_[r[bx8v0

yD7h0y$zx Rv%b0AntiSpamSetting (antiSpamLevel:0) Running ...

L8j`Tg#W'n0 Python学习 hy's rs^"R;zc({m

Passed: AntiSpamSettingPython学习wE y8[At m;S

Python学习d6N+sI&p"wP6OTo

AntiSpamSetting1 (actionForSpam:delete) Running ...Python学习S/Ow a8wf!w

,g.ItJ&P4o W ^;Fk y0Passed: AntiSpamSetting

TOg-mpL7vc[0 Python学习$Y.sg1v9BS2?oS"H

AntiSpamSetting2 (actionForSpam:badAction) Running ...

2\+U9t/P Vd0 Python学习'vV{&C*GH2U

Passed: AntiSpamSetting

!n?4A M_iDMl!?0 Python学习"Ka L PV}Y wKt3D9L

AntiSpamSetting3 (antiSpamLevel:1) Running ...Python学习m d U"D$G^f

Python学习j K"T1W:L/| |:a

Passed: AntiSpamSetting

`-^$rxr;f]0 Python学习(~_{![(B%Q'LD8|i

AntiSpamSetting4 (antiSpamLevel:2) Running ...

@_9?O a&vEXe7s0

pWr]3D$M0Passed: AntiSpamSetting

j3ao-w&G![#q/QE0

,Zx8`;D5\.r @0AntiSpamSetting5 (antiSpamLevel:3) Running ...

r'O{k$@0_-@HOg0 Python学习dp)t3o*s

Passed: AntiSpamSetting

;windJ@0 Python学习+si,KylB\

AntiSpamSetting6 (antiSpamLevel:-1) Running ...Python学习 h^` h\$@OJf

&x*~_N(OX1w0Passed: AntiSpamSetting

QM#T f%Z"E(SY Y0
顶:37 踩:53
对本文中的事件或人物打分:
当前平均分:-0.02 (277次打分)
对本篇资讯内容的质量打分:
当前平均分:-0.2 (270次打分)
【已经有254人表态】
36票
感动
30票
路过
30票
高兴
29票
难过
32票
搞笑
27票
愤怒
35票
无聊
35票
同情
上一篇 下一篇