Groovy Script in SoapUI REST Testing
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的更多相关文章
- 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 ...
- 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 ...
- How to use groovy script on jenkins
1. Install groovy plugin 2. Add a step of groovy. (normal & systerm) 3. Execute groovy script im ...
- Access Java API in Groovy Script
$ cat Hello.java package test; public class Hello { public int myadd(int x, int y) { return 10 * x + ...
- [SoapUI] 通过Groovy Script获取当前运行的是哪套Environment
log.info testRunner.testCase.testSuite.project.getActiveEnvironment().getName()
- excel文件的groovy脚本在SoapUI中进行数据驱动测试
SoapUI Pro具有从外部文件读取数据的功能,例如:excel,csv等.但SoapUI不提供从excel文件读取数据的功能.因此,为了从SoapUI中的excel文件中读取数据,我们需要在gro ...
- Setup Script in SoapUI - 停止项目运行 (abort project)
TestSuite需要依赖一个先决条件(比如Login) 当Login失败则立即停止Project运行 在Project的Setup Script的代码如下 import com.eviware.so ...
- Elasticsearch的Groovy Script自定义评分检索
需求:以索引中的boostapp列作为评分的基础分值,同时根据carpublishtime(数据的刷新时间字段)按时间进行衰减. 基于Groovy脚本实现. 1.query脚本方式: { " ...
- [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 ...
随机推荐
- [补] winpcap编程——EAP协议与EAPSOCKET实现
EAP SOCKET Implement Mentohust 时间:20161115,大二上 ## 准备. 什么是 EAP 协议 ? WIKI : https://en.wikipedia.org/w ...
- Java多线程缓存器简单实现
package com.charles.utils; import java.util.HashMap; import java.util.Map; import java.util.concurre ...
- GetConsoleScreenBufferInfo 函数--获取控制台屏幕缓冲区信息
GetConsoleScreenBufferInfo函数 来源:https://msdn.microsoft.com/en-us/library/ms683171(v=vs.85).aspx 作用 获 ...
- spring 页面跳转
RedirectAttributes 的两个方式的获取总结:1:addFlashAttribute @RequestMapping(value="hello") public S ...
- 【CSS】background 的覆盖
1. 样式覆盖问题描述 现象:class1 为dom节点默认样式,class2为dom节点后增加样式,发现class2的background 被class1的覆盖 解决办法:在class2 的back ...
- AC自动机总结及板子(不带指针)
蒟蒻最近想学个AC自动机简直被网上的板子搞疯了,随便点开一个都是带指针的,然而平时用到指针的时候并不多,看到这些代码也完全是看不懂的状态.只好在大概理解后自己脑补(yy)了一下AC自动机的代码,居然还 ...
- web组件工具之获取表单数据:webUtils
本文需要的架包:commons-beanutils-1.8.3.jar.commons-logging-1.1.3.jar.servlet-api.jar. 本文共分为五部分:1)封装通用工具类:从表 ...
- Oracle 12C 新特性 - “可插拔数据库”功能
Oracle 12C加入了一个非常有新意的功能"可插拔数据库"特性,实现了数据库(PDB)在"容器"(CDB)上的拔功能,既能提高系统资源的利用率,也简化大面积 ...
- 用u盘启动计算机
上次只是做好了u盘启动盘,但是并没有说怎么安装系统.接下来说一下怎么装系统.链接:怎么把系统装进u盘(ultraiso) 电脑经常要用到u盘启动.设置u盘启动在bios设置里面进行设置.下面就来讲解一 ...
- 自定义Git之使用centos搭建git 服务器
Github 公开的项目是免费的,但是如果你不想让其他人看到你的项目就需要收费. 这时我们就需要自己搭建一台Git服务器作为私有仓库使用. 接下来我们将以 Centos 为例搭建 Git 服务器. 1 ...