groovy - SoapUI 如何通过 Groovy 脚本更新 WSDL 定义和重新创建请求

标签 groovy soapui

我在 SoapUI 中有一个肥皂测试项目。我已将所有请求作为测试步骤添加到测试套件中。

我需要在每次开始测试时更新 WSDL 定义并重新创建请求(同时保留现有值)。

我需要借助 groovy 脚本自动执行此过程,该脚本可以放置在项目中并在每次执行开始前运行。

最佳答案

现在开始工作了.. 这是完整的代码..

import static com.eviware.soapui.impl.wsdl.actions.iface.UpdateInterfaceAction.recreateRequests
import static com.eviware.soapui.impl.wsdl.actions.iface.UpdateInterfaceAction.recreateTestRequests

project = testRunner.testCase.testSuite.project; //get the project reference
def ifaceList = project.getInterfaceList(); //get all the interfaces present in the project in a list

//start a loop for number of interfaces
for(int i = 0; i < project.getInterfaceCount() ; i++)
{

def iface = project.getInterfaceAt(i);
def url = iface.definition;
iface.updateDefinition( url, true); //updateDefinition(String url , Boolean createRequests)

//The above part updates the definition
//The part below recreates the requests based on updated wsdl definition

//syntax - 
//recreateRequests( WsdlInterface iface, boolean buildOptional, boolean createBackups, boolean keepExisting, boolean keepHeaders )

recreateRequests(iface,true,true,true,true);
recreateTestRequests(iface,true,true,true,true);
}
//End of Script//

希望这可以帮助其他人寻找类似的解决方案。

关于groovy - SoapUI 如何通过 Groovy 脚本更新 WSDL 定义和重新创建请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28447452/

相关文章:

java - 无法使用 groovy 脚本在 couchbase 上创建主索引

java - Firefox 检测到服务器正在以一种永远不会完成的方式重定向对此地址的请求

jenkins - 使用 groovy init 创建 Jenkins WorkflowMultibranchProject 作业

web-services - Soapui 免费版可以在输出之间断言吗?

groovy - 如何在常规测试步骤之间共享类对象?

web-services - soapUI 结合了更多模拟服务

spring-boot - Spring Boot + Eureka Server + Hystrix with Turbine : empty turbine. 流

Jenkinsfile 很好地打印参数

java - Java 客户端中的 Soap 连接超时但 SOAPUI 中没有

groovy - 将 groovy 中的 xml 标签插入到 SOAPUI 中的 SOAP 请求中