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

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

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







by lindachen @July 21,2015

TAG: http Request request SoapUI

lichtest的个人空间 引用 删除 lichtest   /   2017-10-13 11:49:01
5
 

评分:0

我来说两句

我的栏目

日历

« 2024-05-02  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

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

RSS订阅

Open Toolbar