简体   繁体   English

是否可以通过SOAPUI中的脚本编辑器更改REST API中的查询参数?

[英]is it possible to change the query parameters in REST API from script editor in SOAPUI?

i am doing load test on this REST API using SOAPUI. 我正在使用SOAPUI在此REST API上进行负载测试。

http://maps.googleapis.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false  

i ve successfully setup the testsuite and all. 我已经成功设置了测试套件和所有。 my doubt is is it possible to change the query parameters in the REST API url by passing values from the script editor(either javascript or groovy) for the test suite when i perform test? 我怀疑是否可以在执行测试时通过传递来自测试套件的脚本编辑器(javascript或groovy)的值来更改REST API url中的查询参数? if so, how should i write the script? 如果是这样,我应该如何编写脚本?

Hope I am clear with my ques. 希望我对我的问题很清楚。

The parameters are manipulated via the main tab for a REST test request. 这些参数通过REST测试请求的主选项卡进行操作。

The icons look like 图标看起来像

  • a box with a circular arrow - revert params to default values 带圆形箭头的框-将参数还原为默认值
  • plain box - clear all params 普通框-清除所有参数
  • a plus with some dashes under it - updates this request params from a specified URL 其下带有一些破折号的加号-从指定的URL更新此请求参数

You can dynamically set the values using groovy 您可以使用groovy动态设置值

If your params look like 如果你的参数看起来像

address  ${address}
sensor   ${useSensor}  

You can set those values in a groovy script with: 您可以使用以下命令在常规脚本中设置这些值:

context.setProperty("address", "1600+Amphitheatre+Parkway,+Mountain+View,+CA")
context.setProperty("useSensor", "false")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM