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

Python MBT 测试用例

热度856票  浏览62次 时间:2011年7月19日 10:28
Python学习ix"x,wELs6c

@Scenario(Param={Python学习Z.x3i4fOA

}n#MJ5p7{F7j)\0'antiSpamLevel':['0', '1', '2', {'t':'invalid', 'v':3}, {'t':'invalid', 'v':-1}]

p0L%[B*Yq~v0 Python学习A@s4xlEi"}4@H

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

r8sH3U2Ypk0

-^MY4MnNY:GG0}, Where={'combine':['antiSpamLevel', 'actionForSpam'],Python学习[-y K2_-`#~k

Python学习$y$Bu'~~,sXka

'strategy':'add'})Python学习!x ldx2{o8d%qF.En

!L&A0I%EX^ aF5bc0T0def AntiSpamSetting(self):Python学习L M"~S)s ]*b

Python学习0fjO1YB

accessTarget = self.accessTargetPython学习/RC;^%`5YC'K

Qq\(mr?0antiSpamLevel = self.Param['antiSpamLevel']Python学习 ^;Vh!N*Z.P

@sV H hn_0actionForSpam = self.Param['actionForSpam']

3B:H6L|xy-R/I'l0

P~(HH"p0rsp = Filter.UpdateAntiSpamSettings(accessTarget, antiSpamLevel, actionForSpam)Python学习$OKh#cA5t

KI`#_ b]0isSetFail = self.Param.GetType('antiSpamLevel') == 'invalid' or self.Param.GetType('actionForSpam') == 'invalid'Python学习)n?e)\/Exo}

Python学习 TU1x$WP2p

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

X9g2oZ1ih^"Q0

@n5A `iS e @6@:B6g0rsp = Filter.getAntiSpamSettings(accessTarget)

-f"[;u%GhG^ ?0

wZk6Rm Dq{R0if isSetFail:

x/U X A.]i(kDe0 Python学习BOn%U@n cE

RspCheck(rsp, True, StatusCode.APP_MBOX_FILTER_ANTISPAM_NOTEXIST)Python学习6CY.x r3q RQF

%] f F`,q2w3nr.Q:i0else:

4k%Yho)H#?xf B0 Python学习*?#DGi|.W

RspCheck(rsp, False, StatusCode.SYS_RESP_OK)

Eq6s^(O S0

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

%K0S1\RX _ e-UF m0

p.Zr9N(kD3X!@0Model View 结果:

G rI z5ZZu.x S-G0 Python学习*p'`qMyEu

= 表示 “期望结果是”

}c`s h]%X4M ^,N0 Python学习8\] {F"O/`#W

AntiSpamSetting (antiSpamLevel:0) Running ...Python学习3~H2?]0C{fZA

4N+~U!a2t@n)B d0Passed: AntiSpamSettingPython学习J~*U0a}:z

v(k;KR _2OM#\0AntiSpamSetting1 (actionForSpam:delete) Running ...

o@mn U]D0 Python学习c:z/xY1XE?!}

Passed: AntiSpamSetting

,J+AibB0^2JOOaT!S j0

!Ls le;s*j8n~)k0AntiSpamSetting2 (actionForSpam:badAction) Running ...Python学习\*V:yy,m{%H

Python学习2l'S;^ZY0F3I

Passed: AntiSpamSetting

,C%r vN0_/es y0

C~J}K \/]3t0AntiSpamSetting3 (antiSpamLevel:1) Running ...

+R;s p3K^:`n2a0

c&Nfl"z2ow0Passed: AntiSpamSettingPython学习;whZC&^G

X+W.f['D_0AntiSpamSetting4 (antiSpamLevel:2) Running ...

0xa C bt eT)E0

nd E1N|/s2AyP0Passed: AntiSpamSetting

V+Y ^!k{0 Python学习+V*^1v!Ei$p|q A

AntiSpamSetting5 (antiSpamLevel:3) Running ...

gI U)wJ+]h0

Y o[2P3p u9K7v0Passed: AntiSpamSettingPython学习&{F,a-aVGvS

CiQ+RW&E0AntiSpamSetting6 (antiSpamLevel:-1) Running ...

$p6L[T,x ^0

'X iy*{ c&Zr0P0Passed: AntiSpamSetting

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