1. Run special step:

testRunner.runTestStepByName("stepName/requestName")

get it's response:

testRunner.testCase.testSteps["stepName/requestName"].testRequest.response

2.Set property

def setProperties(Name,Value,Place)
{
name = Name;
target = testRunner.testCase.getTestStepByName(Place);
target.setPropertyValue(name,Value);
}

3.Clean property

def cleanProperty(PropertyListName)
{
PropertyList = testRunner.testCase.getTestStepByName(PropertyListName);
size=PropertyList.getPropertyCount();
if (size!=0)
{
for (i=0;i<size;i++)
{
PropertyList.removeProperty(PropertyList.getPropertyAt(0).name);
}
}
}

4. Get response with XMLHolder

Rest request:

import com.eviware.soapui.support.XmlHolder

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "requestName#ResponseAsXml" )

Soap request:

import com.eviware.soapui.support.XmlHolder

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def holder = groovyUtils.getXmlHolder( "requestName#Response" )

Groovy Script in SoapUI REST Testing的更多相关文章

  1. SoapUI Pro Project Solution Collection –Easy develop Groovy Script to improve SoapUI ability

    As you know the groovy script and java script language is the soapui supported .but unfortunately So ...

  2. Common tasks that you can perform with the Groovy Script test step

    https://support.smartbear.com/readyapi/docs/soapui/steps/groovy.html Get test case object To obtain ...

  3. How to use groovy script on jenkins

    1. Install groovy plugin 2. Add a step of groovy. (normal & systerm) 3. Execute groovy script im ...

  4. Access Java API in Groovy Script

    $ cat Hello.java package test; public class Hello { public int myadd(int x, int y) { return 10 * x + ...

  5. [SoapUI] 通过Groovy Script获取当前运行的是哪套Environment

    log.info testRunner.testCase.testSuite.project.getActiveEnvironment().getName()

  6. excel文件的groovy脚本在SoapUI中进行数据驱动测试

    SoapUI Pro具有从外部文件读取数据的功能,例如:excel,csv等.但SoapUI不提供从excel文件读取数据的功能.因此,为了从SoapUI中的excel文件中读取数据,我们需要在gro ...

  7. Setup Script in SoapUI - 停止项目运行 (abort project)

    TestSuite需要依赖一个先决条件(比如Login) 当Login失败则立即停止Project运行 在Project的Setup Script的代码如下 import com.eviware.so ...

  8. Elasticsearch的Groovy Script自定义评分检索

    需求:以索引中的boostapp列作为评分的基础分值,同时根据carpublishtime(数据的刷新时间字段)按时间进行衰减. 基于Groovy脚本实现. 1.query脚本方式: { " ...

  9. [Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] Exception Handling in groovy

    def x = new String[3] x[0] = "A" x[1] = "B" x[2] = "C" log.info"X ...

随机推荐

  1. MSDTC启用——分布式事务

    一.前言 最近在做一个项目的时候使用了.NET中的System.Transactions(分布式事务),当项目开发完成以后,调用的时候遇到了MSDTC的问题,在查阅了相关资料后将这个问题解决了,大致的 ...

  2. 4.Apache Spark的工作原理

    Apache Spark的工作原理 1 Why Apache Spark 2 关于Apache Spark 3 如何安装Apache Spark 4 Apache Spark的工作原理 5 spark ...

  3. readelf相关命令

    -a --all 显示全部信息,等价于 -h -l -S -s -r -d -V -A -I. -h --file-header 显示elf文件开始的文件头信息. -l --program-heade ...

  4. Solr-Centos7 安装部署solr-5.5.4

    一 下载安装所需文件 http://archive.apache.org/dist/lucene/solr/ solr-5.5.4.tgz http://archive.apache.org/dist ...

  5. 46. leetcode 500. Keyboard Row

    500. Keyboard Row Given a List of words, return the words that can be typed using letters of alphabe ...

  6. 27. leetcode 401. Binary Watch

    A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom ...

  7. CVE-2016-3714 - ImageMagick 命令执行

    ImageMagick是一款使用量很广的图片处理程序,很多厂商都调用了这个程序进行图片处理,包括图片的伸缩.切割.水印.格式转换等等.但近来有研究者发现,当用户传入一个包含『畸形内容』的图片的时候,就 ...

  8. Handler实现线程之间的通信-下载文件动态更新进度条

    1. 原理 每一个线程对应一个消息队列MessageQueue,实现线程之间的通信,可通过Handler对象将数据装进Message中,再将消息加入消息队列,而后线程会依次处理消息队列中的消息. 2. ...

  9. JDBC连接数据库的基本步骤

    第一步:注册驱动==>:Class.forName("数据库驱动的完整名称(mysql的数据库驱动名称:com.mysql.jbdc.Driver)"); 第二步:创建一个数 ...

  10. JavaScript中数组的方法总结

    js数组元素的添加和删除一直比较迷惑,今天终于找到详细说明的资料了,先给个我测试的代码^-^var arr = new Array();arr[0] = "aaa";arr[1] ...