简体   繁体   English

如何使用Java / Groovy在soapui中读取REST请求

[英]How to read the REST request in soapui using java/groovy

For Example: 例如:

REST Request REST请求

I want to read these REST matrix request using Java or groovy. 我想使用Java或groovy读取这些REST矩阵请求。

What could be the possible solution? 有什么可能的解决方案?

You need to check where they are the properties. 您需要检查它们在哪里。 You review the attachment. 您查看附件。

Show properties 显示属性

You follow this steps: 您请按照下列步骤操作:

    1. Create a testSuite with the testcase. 用测试用例创建一个testSuite。
    1. Add the activity Groovy script and you add this code. 添加活动Groovy脚本,然后添加此代码。

 //Print all properties
log.info  testRunner.testCase.getTestStepByName('NAME_TESTSTEP').getPropertyList().name;
log.info  testRunner.testCase.getTestStepByName('NAME_TESTSTEP').getPropertyList().value;
//Get value propertie
def value_property = testRunner.testCase.getTestStepByName('NAME_TESTSTEP').getPropertyValue('NAME_PROPERTY');
//Print Get value propertie
log.info  value_property 
//Set value Property
testRunner.testCase.getTestStepByName('NAME_TESTSTEP').setPropertyValue('NAME_PROPERTY','VALUE');
    1. You need to update the values ( NAME_TESTSTEP ,NAME_PROPERTY ,VALUE ) 您需要更新值( NAME_TESTSTEP,NAME_PROPERTY,VALUE
    1. Run the grrovy script. 运行grrovy脚本。

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

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