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

Python MBT 测试用例

热度1113票  浏览76次 时间:2011年7月19日 10:28
Python学习dero.R5q zZ

@Scenario(Param={Python学习gFY9` hq(M9U.F

Zk"L;HGU&A.E0'antiSpamLevel':['0', '1', '2', {'t':'invalid', 'v':3}, {'t':'invalid', 'v':-1}]

*RoH|-E H"A*fs0

~,`a.~-i$j_0, 'actionForSpam':['reserve', 'delete', {'t':'invalid', 'v':'badAction'}]

c)FL4n5z(l \0 Python学习m,a]{A\j

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

XM&u)h-u*MC5y&h0 Python学习4dB5s&p zFX)W

'strategy':'add'})

ac+^1lK'K ju0 Python学习.B }\ g+F%^

def AntiSpamSetting(self):Python学习,c6_-BX9zs7C){

w,\edVP0accessTarget = self.accessTargetPython学习W$rFJ Sm]p{h

6yW_1C7m"w K0antiSpamLevel = self.Param['antiSpamLevel']Python学习CY2^3A1P2uS8r&x

Python学习*o^1u ffOfG

actionForSpam = self.Param['actionForSpam']Python学习_8Z$CQT'm

?']'e$x }7G:_!J-{0rsp = Filter.UpdateAntiSpamSettings(accessTarget, antiSpamLevel, actionForSpam)

`2u#|'^N&d0

6e2T pD&B A0isSetFail = self.Param.GetType('antiSpamLevel') == 'invalid' or self.Param.GetType('actionForSpam') == 'invalid'

mGm!E4D'D;CVT0

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

"Z+S/g[qW0

ZLTG Gp8K\E0rsp = Filter.getAntiSpamSettings(accessTarget)Python学习!G!epq4e-L

3Q)hN _$X0if isSetFail:

Ic GMz#l3Y*UP0 Python学习deg%@9f8qP~

RspCheck(rsp, True, StatusCode.APP_MBOX_FILTER_ANTISPAM_NOTEXIST)Python学习)B+eg9l3O

Python学习l!\x zJ8l3my

else:Python学习.~.Hlu6].A8x U6U

9T w+|7||!L.D0RspCheck(rsp, False, StatusCode.SYS_RESP_OK)

M-Ifq~9V Zh`$F{ iE0 Python学习y q ~[G \"U5V

Assert.AreEqual({"antiSpamLevel":antiSpamLevel, "actionForSpam":actionForSpam}, rsp['data'], 'data check')Python学习2ON^$_;GBV4y

Python学习!y9WE1It[s k

Model View 结果:

pn2|8|*x0

aTc X]0= 表示 “期望结果是”Python学习XB*G XXBS

s`9gYFf+V$cv0AntiSpamSetting (antiSpamLevel:0) Running ...

#I{ ]^sP-?&y5w0

/x-u$\6j&a p0H1^0Passed: AntiSpamSettingPython学习g*sm-nZ;O K`.T y7Y&W/J

$^l4o$t]_5MY0AntiSpamSetting1 (actionForSpam:delete) Running ...

{$j$A aRQ3O)Kj0 Python学习HyvtG#aPO8C

Passed: AntiSpamSetting

!tq-A/gho0

2IO&I6dC s.M0AntiSpamSetting2 (actionForSpam:badAction) Running ...Python学习RgVU"~y N kd

Python学习'[:z`h3a0e%w3B

Passed: AntiSpamSettingPython学习 ]"xQ)i!fqD

Q{ V0\WRZP0AntiSpamSetting3 (antiSpamLevel:1) Running ...

0K:jzh^'[R'_!b0 Python学习nS*X~e)DP6H0`

Passed: AntiSpamSettingPython学习1T0FB z7NW9C6KE$K

![8E,X7a]'`+|0AntiSpamSetting4 (antiSpamLevel:2) Running ...

*FnZKrt t0 Python学习ES J4X9S7m

Passed: AntiSpamSettingPython学习;~G!m3]W(n5\o

Python学习o8`s!e Lv2o

AntiSpamSetting5 (antiSpamLevel:3) Running ...

S Ia$jr/gNGh q0

v ]rW$H'S I8z0Passed: AntiSpamSettingPython学习 zh x9}#m/s4\gy

Python学习#~!yy q'x"oV

AntiSpamSetting6 (antiSpamLevel:-1) Running ...

-c4qnfSN O0

]%k#^\9\0Passed: AntiSpamSettingPython学习Dc|Gs7ZN?

顶:48 踩:62
对本文中的事件或人物打分:
当前平均分:-0 (346次打分)
对本篇资讯内容的质量打分:
当前平均分:-0.18 (334次打分)
【已经有323人表态】
46票
感动
39票
路过
38票
高兴
35票
难过
42票
搞笑
34票
愤怒
44票
无聊
45票
同情
上一篇 下一篇