SoapUI Groovy Script 获取 Http Request

上一篇 / 下一篇  2015-07-21 16:40:29 / 个人分类:web service

目标: 用Groovy Script. 获取 HTTP Request 的URL
方法:
def endpoints = messageExchange.getEndpoint()
log.info("endpoint.."+endpoints)

解决过程: 花了很长时间搜索如何用Groovy Script获取HTTP Request,尝试过以下方法都没有达到目标:

testCase.getTestStepByName(“myTestStep”).getProperty(“Request”).getValue()

context.testCase.getTestStepAt(0).getProperty(“Request”).getValue()

testRunner.testCase.getTestStepAt(0).getProperty(“Request”).getValue()

context.testCase.getTestStepByName(it.name).getProperty("request").value

context.testCase.getTestStepAt(0).getProperty("destination").getValue()

testRequestStep = context.testCase.getTestStepAt(1) //to capture the first test step
testRequest = testRequestStep.getTestRequest()
content = testRequest.getRequestContent()

messageExchange.getRequestContent().toString()

后来才醒悟,我不是需要整个HTTP Request(包括Header,Content,等等),我只需要一个HTTP Request 的URL,其实对Soapui 来说是一个Full Endpoint

后来才发现一个语句就搞定了,所以写下了供参考。

参考过的文章都很有启发,可以学习下:









  

TAG: http Request request SoapUI

 

评分:0

我来说两句

我的栏目

日历

« 2024-04-15  
 123456
78910111213
14151617181920
21222324252627
282930    

数据统计

  • 访问量: 8846
  • 日志数: 6
  • 建立时间: 2015-07-16
  • 更新时间: 2015-10-09

RSS订阅

Open Toolbar