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

Python MBT 测试用例

热度906票  浏览63次 时间:2011年7月19日 10:28

k9Gq-}R0@Scenario(Param={Python学习z$dDe3j(k&u

3NN N#L{V2p0'antiSpamLevel':['0', '1', '2', {'t':'invalid', 'v':3}, {'t':'invalid', 'v':-1}]Python学习!NSTj0Y-MC

Python学习0E+I(M+?2`a2nCu

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

*G(A)Qh|N'^[N0

-TtM6? i9w0}, Where={'combine':['antiSpamLevel', 'actionForSpam'],Python学习W!\)] A4rf

)m(G:f&a!bhl0'strategy':'add'})Python学习d}6Q~$W(] V:l

Python学习.{ss*uE2cy

def AntiSpamSetting(self):Python学习NXK L#kGy

]j^!a8W;p0accessTarget = self.accessTarget

3O t+Um'K ?@0 Python学习[-\TE/r({EV R8x*u6O)q

antiSpamLevel = self.Param['antiSpamLevel']Python学习ku,q!n f4S%q

e7g0P2Q+mzvQ0actionForSpam = self.Param['actionForSpam']Python学习t)b'{D {

4JlKZ Uf"Sy0rsp = Filter.UpdateAntiSpamSettings(accessTarget, antiSpamLevel, actionForSpam)Python学习5bqO$dP/H

Python学习5Io]F S|D&|G0v

isSetFail = self.Param.GetType('antiSpamLevel') == 'invalid' or self.Param.GetType('actionForSpam') == 'invalid'Python学习#p Y8w {YgC8Ib;t+N

Python学习,?GB!`$Q2pxC

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

ze Lh p0

]y$dH1GRjm0rsp = Filter.getAntiSpamSettings(accessTarget)

"g:IT,r_)|r0

)OYNs]T)_0if isSetFail:

es(CJV;Ql#B9N0 Python学习1J VW'`u

RspCheck(rsp, True, StatusCode.APP_MBOX_FILTER_ANTISPAM_NOTEXIST)Python学习)S aDe _

O,~*Xr)H#U:MR0else:Python学习t5E&^!p/_5m'd/rq

0m N MH4?(T%~.C+cS0RspCheck(rsp, False, StatusCode.SYS_RESP_OK)

6[*}u"r:b+\/t0

:d4l#X a*f[0Assert.AreEqual({"antiSpamLevel":antiSpamLevel, "actionForSpam":actionForSpam}, rsp['data'], 'data check')Python学习fK*D"}@N$B

Python学习 ?,^5wH8z(R }S y T G

Model View 结果:

7S\({R rW0 Python学习'F f7\ox*R

= 表示 “期望结果是”

P8Rqv!hzTEx0

M)C Ifnb"RU"q4L{0AntiSpamSetting (antiSpamLevel:0) Running ...

L V y"ju d_ sLHV,?0 Python学习i-mG?b.w&E4B

Passed: AntiSpamSetting

ttp JQq+p.i/X;m3@ ?0

Cg;jG]4_4Urz0AntiSpamSetting1 (actionForSpam:delete) Running ...

{S'])k ~1s*X.fG8A0 Python学习w[ e/J!@_Z-s\

Passed: AntiSpamSettingPython学习:I!Zy/`B%oV

.J9bAd#?o0AntiSpamSetting2 (actionForSpam:badAction) Running ...Python学习%[dSw$I`Y

Python学习.NY fB.Bx9E7J1\

Passed: AntiSpamSettingPython学习JJ'TvU

g_/| OR:@)[*oQW,t0AntiSpamSetting3 (antiSpamLevel:1) Running ...

_~6s9|'L1Dj5M5s0 Python学习-NoLl#u]

Passed: AntiSpamSettingPython学习vo#i#b2Wc5I9|!\

Python学习*i4a0dUnU/P.c

AntiSpamSetting4 (antiSpamLevel:2) Running ...

3L&TT v3AB _+qj0 Python学习@3_E-^0\0ZJ9|w/g

Passed: AntiSpamSetting

-j0^ TA{0

e4{_*W` R T,@0AntiSpamSetting5 (antiSpamLevel:3) Running ...

G"O*|$s:[#sh)X-o0

Y*k N*HO0Passed: AntiSpamSettingPython学习? bFt RK4wR;B

Python学习 }wv%[*e

AntiSpamSetting6 (antiSpamLevel:-1) Running ...

L2RnN fC8r0

O0j0Y2Ru a dp0Passed: AntiSpamSettingPython学习H"n\'_Ki p;Bg V

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