【SoapUI】在soapui中使用Groovy脚本常用方法
来源:互联网 发布:中国产能利用率数据 编辑:程序博客网 时间:2024/06/10 06:03
1. setPropertyValue
a. 设置 project level property
//set to project level property
testRunner.testCase.testSuite.project.setPropertyValue("Name", "propValue");
b. 设置 testSuite level property
//set to testSuite level property
testRunner.testCase.testSuite.setPropertyValue("Name","propValue");
c. 设置 testCase level property
//set to testCase level property
testRunner.testCase.setPropertyValue("Name","propValue");
d. 设置XML
def projectDir=context.expand('${projectDir}');
def InitialXML = FileUtil.file2String(projectDir+"/XXX.xml");
groovyUtils.setPropertyValue("stepName","Request",InitialXML);
2. 定位到某个testSuites
def testSuite = testRunner.testCase.testSuite.project.testSuites['testSuites Name'];
3. getTestCaseCount()
for(int i=0; i<testSuite.getTestCaseCount(); i++) {
if (!testSuite.getTestCaseAt(i).isDisabled()) {
if (!(testSuite.getTestCaseAt(i).getTestStepByName("stepName")).equals()){
.....
}
}
}
4. getTestSuiteCount()
testRunner.testCase.testSuite.project.getTestSuiteCount()
5. getLabel()
a. 取test case的名称
def tc = testRunner.testCase;
log.info (tc.getLabel());
b. 取test suite的名称
def ts = testRunner.testCase.testSuite;
log.info (ts.getLabel());
6. getName()
去project 名称
def tp = testRunner.testCase.testSuite.project;
log.info (tp.getName());
7. 声明namespace
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def getRequest = groovyUtils.getXmlHolder( 'stepName#Request' );
getRequest.namespaces["ns1"] = "http://...";
8.层级访问
testRunner.testCase.testSuite.project.testSuites[testSuiteName].testCases[testCaseName].testSteps[testStepName]
备注:资料不错,怕遗忘,共享出来,但忘记出处,非常抱歉 ,请见谅!
- 【SoapUI】在soapui中使用Groovy脚本常用方法
- SoapUI中使用Groovy脚本操作数据库 .
- SoapUI中使用Groovy脚本操作数据库
- SoapUI中使用Groovy脚本操作数据库
- SoapUI自动化--Groovy脚本常用操作
- SoapUI中使用Groovy修改请求消息&校验返回消息
- SoapUI中使用Groovy修改请求消息&校验返回消息
- Click!-- 在SOAPUI中使用Gherkin
- Groovy and SoapUI
- SoapUI + Groovy 接口自动化
- SoapUI Groovy Script
- soapUI+groovy 接口测试之部分groovy使用记录
- 在Windows中安装SoapUI
- SoapUI使用
- Soapui
- SoapUI
- soapUi
- SoapUI
- 项目技术总结一之JSONP实现跨域调度
- 学习笔记------数据结构(C语言版)串的定长顺序存储表示
- bzoj1692 队列变换
- ORA-09817错误
- 数据结构实验之链表六:有序链表的建立
- 【SoapUI】在soapui中使用Groovy脚本常用方法
- HTML5开发实战——Sencha Touch篇(2)
- 学习笔记
- 关于博客的头像问题
- 从windows客户端sqlplus连接Oracle 12c PDB报错ORA-65162: The password has expired
- BlogApp之spring整合Guava中的AsyEventBus异步事件
- Machine Learning - An Introduction
- hdu3341Lost's revenge (AC自动机+变进制dp)
- C语言几种整形类型的区别