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

Python MBT 测试用例

热度929票  浏览67次 时间:2011年7月19日 10:28
Python学习#A2r8_ r;z a9f

@Scenario(Param={

#|aqZv^2N2@z&d0

"^8UCG)]!^t/G\0'antiSpamLevel':['0', '1', '2', {'t':'invalid', 'v':3}, {'t':'invalid', 'v':-1}]Python学习XY4{R5a9Z`"t

k$z l*]9^(XK0fc0, 'actionForSpam':['reserve', 'delete', {'t':'invalid', 'v':'badAction'}]

m@;C~/d*c0

X!D.f Q&h*A6Od]0}, Where={'combine':['antiSpamLevel', 'actionForSpam'],

b Hsi'Ua*D0 Python学习:S&nC`O:QH.WF

'strategy':'add'})Python学习 {8{S7m$y1nP9\

`"We^4kY6E0def AntiSpamSetting(self):Python学习0Qj}p [

0J*DP1H%r8q(t#U1\0accessTarget = self.accessTargetPython学习i\w+p|h6`$c8a

oq0r S#o#H0antiSpamLevel = self.Param['antiSpamLevel']

2F+hr8m\CsSq0

2w#[0{c ]|Y0actionForSpam = self.Param['actionForSpam']Python学习-A/`~ @K6Hb#x

Python学习;VSm4F6} e#w

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

5fdMR)Pg5w\+]!T3Q0

1K(Q1c"U'~W5jc:W2d0isSetFail = self.Param.GetType('antiSpamLevel') == 'invalid' or self.Param.GetType('actionForSpam') == 'invalid'Python学习H(S`b(r!s4t!b

Python学习4C:`T Z!M&f/jy

RspCheck(rsp, True, StatusCode.SYS_REQ_PARAM_INVALID if isSetFail else StatusCode.SYS_RESP_OK)Python学习,`.Xy o"Eo

Python学习3mU1J7|V-G*{6p

rsp = Filter.getAntiSpamSettings(accessTarget)Python学习9x fW'|}

Python学习,cF*O$Y1|~*^n

if isSetFail:Python学习"R4xn(kQ\K l0\,f

VmwSN;H@ZNp~0RspCheck(rsp, True, StatusCode.APP_MBOX_FILTER_ANTISPAM_NOTEXIST)Python学习 h5ZgSX#l m.[5GG^5@

Python学习0kU{+H%z

else:

z/m,T M|j#I1DF0 Python学习U7|$G1fa#x M

RspCheck(rsp, False, StatusCode.SYS_RESP_OK)Python学习X6BhR3pp1d~ brNO

1K q#fYK)lMmx6J0Assert.AreEqual({"antiSpamLevel":antiSpamLevel, "actionForSpam":actionForSpam}, rsp['data'], 'data check')

S#iF[;uv Ik0 Python学习1?[K2@.U@8i

Model View 结果:

\y C&TCd0 Python学习.N#e(R Qs

= 表示 “期望结果是”

_.U2N|.~m0 Python学习4| ob qy5~8O;T

AntiSpamSetting (antiSpamLevel:0) Running ...Python学习-a6?a"wJ!i6M

Python学习*h;C @"yLP9A,o ]

Passed: AntiSpamSettingPython学习|s!_YT6s5k:S

Python学习Nt)t%sq#gH@vF

AntiSpamSetting1 (actionForSpam:delete) Running ...

~Jsd1_[0

s$t2GT _0Passed: AntiSpamSetting

{2D"W~7?.mW5b8P9hW0 Python学习5_V Q1r` v

AntiSpamSetting2 (actionForSpam:badAction) Running ...Python学习5cE;E2t vF-c~u

Python学习8\R\6r:@vP){

Passed: AntiSpamSetting

#x] mYk I)C4o%CR0 Python学习z@s9E'w!`-T,fV

AntiSpamSetting3 (antiSpamLevel:1) Running ...Python学习}\ x(z1?)I/`

Python学习4z-_$K"vf6Q*a

Passed: AntiSpamSetting

?J _ f;w0 Python学习t9dKy9}[

AntiSpamSetting4 (antiSpamLevel:2) Running ...Python学习9W m+S{"Q]EmI2z z

Python学习's yjQL.{Y

Passed: AntiSpamSettingPython学习:Q(x u3p}(F&C-C

j8rJ]9_-C%a0AntiSpamSetting5 (antiSpamLevel:3) Running ...

3E X [xB s0Gm0

'l3v[+H&Xt0Passed: AntiSpamSettingPython学习GU1{yLW

Python学习-b"X$M}8kEr

AntiSpamSetting6 (antiSpamLevel:-1) Running ...

5b1z.AB!L.I-XB-|3L0

B_2pN+|R0Passed: AntiSpamSettingPython学习c s oC e G,D p|

顶:41 踩:54
对本文中的事件或人物打分:
当前平均分:0.02 (287次打分)
对本篇资讯内容的质量打分:
当前平均分:-0.16 (280次打分)
【已经有267人表态】
38票
感动
30票
路过
32票
高兴
29票
难过
34票
搞笑
28票
愤怒
37票
无聊
39票
同情
上一篇 下一篇