【发布时间】:2017-04-07 16:23:01
【问题描述】:
在 SoapUI(专业版)中,我有 12 个测试步骤:
-
GET请求 - Groovy 脚本女巫从上一步的响应中获取
total值 - 属性
- 财产转让
-
POST请求1 -
POST请求2 -
POST请求3 -
POST请求4 -
POST请求5 -
POST请求6 -
POST请求 7 -
POST请求8
所有POST 请求都有ID 参数。
问题:
如何编写像这样或其他决策方式的 Groovy 脚本:
if total = 8 then set ID parameters of POST 1 = 1,POST 2 = 1,POST 3 = 1,POST 4 = 1,POST 5 = 1,POST 6 = 1,POST 7 = 1,POST 8 = 1
if total = 7 then set ID parameters of POST 1 = 2,POST 2 = 1,POST 3 = 1,POST 4 = 1,POST 5 = 1,POST 6 = 1,POST 7 = 1
if total = 6 then set ID parameters of POST 1 = 2,POST 2 = 2,POST 3 = 1,POST 4 = 1,POST 5 = 1,POST 6 = 1
if total = 5 then set ID parameters of POST 1 = 2,POST 2 = 2,POST 3 = 2,POST 4 = 1,POST 5 = 1
if total = 4 then set ID parameters of POST 1 = 2,POST 2 = 2,POST 3 = 2,POST 4 = 2
if total = 3 then set ID parameters of POST 1 = 3,POST 2 = 3,POST 3 = 2
if total = 2 then set ID parameters of POST 1 = 4,POST 2 = 4
if total = 1 then set ID parameters of POST 1 = 8
【问题讨论】: